皮肤:武将、时装表修改

This commit is contained in:
luying
2021-10-19 14:26:17 +08:00
parent b6a904b091
commit da5a43abba
13 changed files with 3205 additions and 2754 deletions
+13 -5
View File
@@ -1,31 +1,39 @@
// 时装表
import { decodeArrayListStr, readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
const _ = require('lodash');
export interface DicFashions {
// 时装id
readonly id: number;
// 皮肤装名
readonly name: string;
// 指向heroSkill表
readonly skillId: number;
// 全局加成
readonly globalAttr: Array<{id: number, number: number}>;
// 单体加成
readonly actorAttr: Array<{id: number, number: number}>;
// 角色id
// 即武将表里的heroId
readonly heroId: number;
// 原武将id,300以内的武将id
readonly actorId: number;
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicFashionsKeys: KeysEnum<DicFashions> = { id: true, name: true, globalAttr: true, actorAttr: true, heroId: true, actorId: true};
export const dicFashions = new Map<number, DicFashions>();
export const dicFashionsByHeroId = new Map<number, DicFashions>();
export function loadFashions() {
dicFashions.clear();
dicFashionsByHeroId.clear();
let arr = readFileAndParse(FILENAME.DIC_FASHIONS);
arr.forEach(o => {
o.id = o.goodId;
o.globalAttr = parseAttr(o.globalAttr);
o.actorAttr = parseAttr(o.actorAttr);
dicFashions.set(o.id, o);
dicFashions.set(o.id, _.pick(o, Object.keys(DicFashionsKeys)));
dicFashionsByHeroId.set(o.heroId, _.pick(o, Object.keys(DicFashionsKeys)));
});
arr = undefined;
}
@@ -39,6 +47,6 @@ function parseAttr(str: string) {
throw new Error('data table format wrong');
}
result.push({id: parseInt(id), number: parseInt(number)});
}
}
return result
}