七天乐-每日特惠礼包
This commit is contained in:
+17
-2
@@ -556,6 +556,21 @@ export function parseHeroStrWithType(str: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
// 根据类型解析物品 {"type":number, "id": number, "count": number} 格式
|
||||
//type 1.英雄,2.物品, 3.RMB
|
||||
export function parseResStr(str: string) {
|
||||
let result = new Array<{ type: number, id: number, count: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [type, id, count] of decodeArr) {
|
||||
if (isNaN(parseInt(type)) || isNaN(parseInt(id)) || isNaN(parseInt(count))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// 数字列表
|
||||
export function parseNumberList(str: string) {
|
||||
let res = new Array<number>();
|
||||
@@ -651,14 +666,14 @@ export function splitString(dataString: string, key: string) {
|
||||
*/
|
||||
export function getFloorStatus(gachaId: number, floor: Floor[]) {
|
||||
let floorMap = new Map<number, number>();
|
||||
for(let { id, count } of floor) {
|
||||
for (let { id, count } of floor) {
|
||||
floorMap.set(id, count);
|
||||
}
|
||||
let dicFloorType = GACHA_TO_FLOOR.get(gachaId);
|
||||
return dicFloorType.map(id => {
|
||||
return {
|
||||
id,
|
||||
count: floorMap.get(id)||0
|
||||
count: floorMap.get(id) || 0
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user