今日挑战互动接口

This commit is contained in:
qiaoxin
2021-04-25 17:46:01 +08:00
parent 7bb445693d
commit 8cb2ba2a8b
13 changed files with 493 additions and 156 deletions

View File

@@ -540,6 +540,21 @@ export function parseGoodStrWithType(str: string) {
return result
}
// 根据类型解析物品 {"type":number, "hid": number, "count": number} 格式
//type 1.英雄2.物品
export function parseHeroStrWithType(str: string) {
let result = new Array<{ type: number, hid: number, count: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [type, hid, count] of decodeArr) {
if (isNaN(parseInt(type)) || isNaN(parseInt(hid)) || isNaN(parseInt(count))) {
throw new Error('data table format wrong');
}
result.push({ type: parseInt(type), hid: parseInt(hid), count: parseInt(count) });
}
return result
}
// 数字列表
export function parseNumberList(str: string) {
let res = new Array<number>();