武将:职业训练
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 兵种表
|
||||
import { readFileAndParse, parseNumberList, parseGoodStr} from '../util'
|
||||
import { readFileAndParse, parseNumberList, parseGoodStr, decodeArrayListStr} from '../util'
|
||||
import { FILENAME, ABI_STAGE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -24,7 +24,7 @@ export interface DicJob {
|
||||
// 升阶消耗
|
||||
readonly upGradeConsume: Array<RewardInter>;
|
||||
// 每阶升级属性
|
||||
readonly ceAttr: Map<number, number>
|
||||
readonly ceAttr: Map<number, {id: number, attr: number}>
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export function loadJob() {
|
||||
o.seid = parseNumberList(o.seid);
|
||||
o.trainingConsume = parseGoodStr(o.trainingConsume);
|
||||
o.upGradeConsume = parseGoodStr(o.upGradeConsume);
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
o.ceAttr = parseCeAttr(o.attr);
|
||||
dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys)));
|
||||
let jobClass = jobClassMaxGrades.get(o.job_class);
|
||||
if (!jobClass || jobClass.grade < o.grade) {
|
||||
@@ -55,11 +55,16 @@ export function loadJob() {
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseCeAttr(elem) {
|
||||
let ceAttr = new Map<number, number>();
|
||||
ceAttr.set(ABI_STAGE.HP, elem.hp);
|
||||
ceAttr.set(ABI_STAGE.ATK, elem.atk);
|
||||
ceAttr.set(ABI_STAGE.DEF, elem.def);
|
||||
ceAttr.set(ABI_STAGE.MDEF, elem.mdef);
|
||||
return ceAttr;
|
||||
function parseCeAttr(str: string) {
|
||||
let result = new Map<number, { id: number, attr: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let i = 0; i < decodeArr.length; i++) {
|
||||
let [id, attr] = decodeArr[i];
|
||||
if (isNaN(parseInt(id)) || isNaN(parseInt(attr))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.set(i, { id: parseInt(id), attr: parseFloat(attr) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user