Files
ZYZ/shared/pubUtils/dictionary/DicRougeEffect.ts
2023-08-30 11:02:52 +08:00

48 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 圣物效果配置表
*/
import { decodeArrayListStr, readFileAndParse } from '../util'
import { ABI_TYPE, FILENAME, ROUGE_EFFECT_TYPE } from '../../consts'
export interface DicRougeEffect {
readonly id: number;
readonly effectId: number;
readonly effectType: number; // 效果的类型具体什么type写个文档
readonly effectParam: number[]; // 效果的具体参数不同的type对这个param的解释不同需要分别定义用&连接
}
export const dicRougeEffect = new Map<number, DicRougeEffect>();
export function loadRougeEffect() {
dicRougeEffect.clear();
let arr = readFileAndParse(FILENAME.DIC_ROUGE_EFFECT);
arr.forEach(o => {
o.effectParam = parseEffectParam(o.effectType, o.effectParam);
// console.log('effectParam', o.effectParam)
// if (!dicRougeEffect.has(o.effectType)) {
// dicRougeEffect.set(o.effectType, []);
// }
// dicRougeEffect.get(o.effectType).push(o);
dicRougeEffect.set(o.effectId, o);
});
arr = undefined;
}
function parseEffectParam(effectType: number, str: string) {
let arr = decodeArrayListStr(str);
switch(effectType) {
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
{
arr = arr.filter(cur => cur[0] == ABI_TYPE.ABI_HP.toString());
break;
}
}
return arr.length > 0? arr[0].map(cur => parseFloat(cur)): [];
}