添加主线关卡和每日关卡
This commit is contained in:
@@ -29,15 +29,23 @@ export function getGamedata(key) {
|
||||
}
|
||||
|
||||
export function getWarById(warid) {
|
||||
let warInfo = gamedata['dic_zyz_gk']||[];
|
||||
return warInfo.find(cur => {
|
||||
return cur.war_id == warid
|
||||
});
|
||||
const wars = ['dic_zyz_gk', 'dic_daily_war', 'dic_event_war']; // 关卡相关的表
|
||||
let result;
|
||||
for(let filename of wars) {
|
||||
let warInfo = gamedata[filename]||[];
|
||||
for(let war of warInfo) {
|
||||
if(war.war_id == warid) {
|
||||
result = war; break;
|
||||
}
|
||||
}
|
||||
if(result) break;
|
||||
}
|
||||
return result||[];
|
||||
}
|
||||
|
||||
export function getGoodById(gid) {
|
||||
console.log(gid)
|
||||
let goodsInfo = gamedata['goods']||[];
|
||||
let goodsInfo = gamedata['dic_goods']||[];
|
||||
return goodsInfo.find(cur => {
|
||||
return cur.good_id == gid
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
export function genCode(len) {
|
||||
const chars = '123456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
const charArr = chars.split('');
|
||||
@@ -7,4 +8,29 @@
|
||||
code += charArr[Math.floor(Math.random() * charArr.length)];
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
export function decodeStr(type, str) {
|
||||
if(str == '&') str = '';
|
||||
return str.split('|').map(cur => {
|
||||
let arr = cur.split('&');
|
||||
let result = {};
|
||||
switch (type) {
|
||||
case 'fixReward': {
|
||||
let [gid, count] = arr;
|
||||
result = { gid: parseInt(gid), count: parseInt(count)};
|
||||
break;
|
||||
}
|
||||
case 'conditionReward': {
|
||||
let [gid, count, condition] = arr;
|
||||
result = { gid: parseInt(gid), count: parseInt(count), condition: parseInt(condition) };
|
||||
break;
|
||||
}
|
||||
case 'randomReward': {
|
||||
let [gid, count, frequency] = arr;
|
||||
result = { gid: parseInt(gid), count: parseInt(count), frequency: parseInt(frequency) };
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user