战力:初步
This commit is contained in:
@@ -103,6 +103,7 @@ import { dicJewelCondition, loadJewelCondition } from './dictionary/DicJewelCond
|
||||
import { dicMainStarBox, dicMainStarBoxByChapter, loadMainStarBox } from './dictionary/DicMainStarBox';
|
||||
import { dicHeroTalent, initTalents, loadHeroTalent } from './dictionary/DicHeroTalent';
|
||||
import { Talent } from "../db/Hero";
|
||||
import { dicEquipStrengthAttr, loadEquipStrengthAttr } from './dictionary/DicEquipStrengthAttr';
|
||||
|
||||
export const gameData = {
|
||||
daily: dicDaily,
|
||||
@@ -257,6 +258,7 @@ export const gameData = {
|
||||
heroTalent: dicHeroTalent,
|
||||
initTalents: initTalents,
|
||||
talentPointOfJob: talentPointOfJob,
|
||||
equipStrengthAttr: dicEquipStrengthAttr
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -882,6 +884,11 @@ export function getHeroInitTalent(skinId: number) {
|
||||
return ids.map(id => (new Talent(id)));
|
||||
}
|
||||
|
||||
export function getEquipStrenthenAttr(equipId: number, lv: number) {
|
||||
let result = gameData.equipStrengthAttr.get(`${equipId}_${lv}`);
|
||||
return result
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
@@ -1049,6 +1056,7 @@ function loadDatas() {
|
||||
loadJewelCondition();
|
||||
loadMainStarBox();
|
||||
loadHeroTalent();
|
||||
loadEquipStrengthAttr();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
|
||||
39
shared/pubUtils/dictionary/DicEquipStrengthAttr.ts
Normal file
39
shared/pubUtils/dictionary/DicEquipStrengthAttr.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// 装备强化表
|
||||
import { readFileAndParse, parseGoodStr, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicEquipStrengthAttr {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 装备id
|
||||
readonly equipId: number;
|
||||
// 等级
|
||||
readonly lv: number;
|
||||
// 属性
|
||||
readonly attr: {id: number, num: number}[];
|
||||
}
|
||||
|
||||
export const dicEquipStrengthAttr = new Map<string, DicEquipStrengthAttr>();
|
||||
export function loadEquipStrengthAttr() {
|
||||
dicEquipStrengthAttr.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP_STRENGTH_ATTR);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.attr = parseAttr(o.attr);
|
||||
dicEquipStrengthAttr.set(`${o.equipId}_${o.lv}`, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{id: number, num: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let [id, num] of decodeArr) {
|
||||
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({id: parseInt(id), num: parseInt(num)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user