形象:设置头像相框形象
This commit is contained in:
@@ -56,8 +56,12 @@ export interface DicGoods {
|
||||
readonly nextJewelId?: number;
|
||||
readonly specialCount?: number;
|
||||
readonly nextSpecialId?: number;
|
||||
// 对应的装备id
|
||||
readonly equipId?: number;
|
||||
// 对应的装备id
|
||||
readonly equipId?: number;
|
||||
// 解锁条件
|
||||
readonly condition: {type: number, param: number}[];
|
||||
// 时间限制
|
||||
readonly timeLimit: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GOODS);
|
||||
@@ -88,11 +92,15 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
|
||||
nextJewelId: true,
|
||||
specialCount: true,
|
||||
nextSpecialId: true,
|
||||
equipId: true
|
||||
equipId: true,
|
||||
condition: true,
|
||||
timeLimit: true
|
||||
}
|
||||
export const dicJewel = new Map<number, DicGoods>();
|
||||
export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprt = new Map<number, Array<number>>();
|
||||
export const figureCondition = new Map<number, { param: number, id: number }[]>(); // type => {param, id}
|
||||
|
||||
arr.forEach(o => {
|
||||
o.goodsAbility = parseAbility(o);
|
||||
o.goodsAbilityUp = parseAbilityUp(o);
|
||||
@@ -106,6 +114,13 @@ arr.forEach(o => {
|
||||
if (!!good)
|
||||
o.equipId = good.good_id;
|
||||
}
|
||||
let condition = parseConditionStr(o.condition);
|
||||
for(let {type, param} of condition) {
|
||||
let mapArr = figureCondition.get(type)||new Array<{param: number, id: number}>();
|
||||
mapArr.push({ param, id: o.good_id});
|
||||
figureCondition.set(type, mapArr);
|
||||
}
|
||||
o.condition = condition;
|
||||
dicGoods.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys)));
|
||||
|
||||
if (o.itid == IT_TYPE.BLUEPRT) {
|
||||
@@ -183,4 +198,18 @@ function parseSpecialMaterial(str: string) {
|
||||
specialAttr.count = count;
|
||||
}
|
||||
return specialAttr;
|
||||
}
|
||||
}
|
||||
|
||||
// 解析物品 {"type": number, "param": number} 格式
|
||||
export function parseConditionStr(str: string) {
|
||||
let result = new Array<{ type: number, param: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [type, param] of decodeArr) {
|
||||
if (isNaN(parseInt(type)) || isNaN(parseInt(param))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ type: parseInt(type), param: parseInt(param) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user