装备:获得天晶石&合成装备
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// 装备表
|
||||
import { readFileAndParse, decodeArrayListStr, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicEquip {
|
||||
// (key) 装备的id
|
||||
readonly id: number;
|
||||
// 装备的位置(武器、衣甲、帽冠、行具)
|
||||
readonly eplaceId: number;
|
||||
// 装备名
|
||||
readonly name: string;
|
||||
// 匹配的武将的职业的大类
|
||||
readonly jobClass: number;
|
||||
// 套装id
|
||||
readonly suitId: number;
|
||||
// 属性提升
|
||||
readonly attribute: {id: number, num: number}[];
|
||||
// 属性成长加成提升
|
||||
readonly attributeUp: {id: number, num: number}[];
|
||||
// 合成消耗
|
||||
readonly composeMaterial: RewardInter[];
|
||||
|
||||
}
|
||||
|
||||
export const dicEquipById = new Map<number, DicEquip>();
|
||||
export const dicEquipIdByJobClassAndEplace = new Map<string, number>();
|
||||
export function loadEquip() {
|
||||
dicEquipById.clear();
|
||||
dicEquipIdByJobClassAndEplace.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttr(o.attribute);
|
||||
o.attributeUp = parseAttr(o.attributeUp);
|
||||
o.composeMaterial = parseGoodStr(o.composeMaterial);
|
||||
dicEquipById.set(o.id, o);
|
||||
dicEquipIdByJobClassAndEplace.set(`${o.jobClass}_${o.eplaceId}`, o.id);
|
||||
});
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// 装备强化表
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicEquipStrength {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 等级
|
||||
readonly lv: number;
|
||||
// 消耗
|
||||
readonly consume: RewardInter[];
|
||||
|
||||
}
|
||||
|
||||
export const dicEquipStrength = new Map<number, DicEquipStrength>();
|
||||
export function loadEquipStrength() {
|
||||
dicEquipStrength.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
dicEquipStrength.set(o.lv, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// 装备套装表
|
||||
import { readFileAndParse, parseNumberList, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicEquipSuit {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 匹配的武将的职业的大类
|
||||
readonly jobClass: number;
|
||||
// 套装内含的装备编号
|
||||
readonly equips: number[];
|
||||
// 按星级可解锁的属性
|
||||
readonly effect: { star: number, seid: number }[];
|
||||
// 解锁条件索引
|
||||
readonly effectCondition: Map<number, number>
|
||||
}
|
||||
|
||||
export const dicEquipSuit = new Map<number, DicEquipSuit>();
|
||||
export function loadEquipSuit() {
|
||||
dicEquipSuit.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.equips = parseNumberList(o.equips);
|
||||
parseRandomEffect(o, o.effect);
|
||||
dicEquipSuit.set(o.jobClass, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseRandomEffect(o: any, str: string) {
|
||||
if (!str) return null;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
let effect: number[] = [], effectCondition = new Map<number, number>();
|
||||
for (let [star, seid] of decodeArr) {
|
||||
if (isNaN(parseInt(star)) || isNaN(parseFloat(seid))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
effect.push(parseInt(seid));
|
||||
effectCondition.set(parseInt(seid), parseInt(star));
|
||||
}
|
||||
o.effect = effect;
|
||||
o.effectCondition = effectCondition;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// 物品表
|
||||
import { decodeArrayListStr, readFileAndParse, parseGoodStr, parseNumberList, decodeArrayStr } from '../util'
|
||||
import { FILENAME, IT_TYPE, ABI_TYPE, GOOD_TYPE } from '../../consts'
|
||||
import { FILENAME, IT_TYPE, ABI_TYPE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
import { findWhere } from 'underscore';
|
||||
@@ -108,14 +108,12 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
|
||||
charLimited: true,
|
||||
equipLvl: true
|
||||
}
|
||||
export const dicJewel = new Map<number, DicGoods>();
|
||||
export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprtWithQuality = new Map<number, Array<number>>();
|
||||
export const blueprtWithQualityAndStar = new Map<string, Array<number>>();
|
||||
export const figureCondition = new Map<number, { params: number[], id: number, gid: number }[]>(); // type => {params, id, gid}
|
||||
|
||||
export function loadGoods() {
|
||||
dicJewel.clear();
|
||||
dicGoods.clear();
|
||||
blueprtWithQuality.clear();
|
||||
blueprtWithQualityAndStar.clear();
|
||||
@@ -155,22 +153,6 @@ export function loadGoods() {
|
||||
let arr2 = blueprtWithQuality.get(o.quality) || new Array<number>();
|
||||
arr.push(o.good_id);
|
||||
blueprtWithQuality.set(o.quality, arr2);
|
||||
} else if (o.goodType == GOOD_TYPE.JEWEL) {
|
||||
let material = o.composeMaterial[0];
|
||||
if (!!material && !!material.id) {
|
||||
let lastJewel = findWhere(arr, { good_id: material.id });
|
||||
if (!!lastJewel) {
|
||||
lastJewel.count = material.count;
|
||||
lastJewel.nextJewelId = o.good_id;
|
||||
if (!!o.specialMaterial.ids[0]) {
|
||||
lastJewel.specialCount = o.specialMaterial.count;
|
||||
lastJewel.nextSpecialId = o.specialMaterial.ids[0];
|
||||
}
|
||||
dicJewel.set(lastJewel.good_id, _.pick(lastJewel, Object.keys(DicGoodsKeys)));
|
||||
}
|
||||
} else {
|
||||
dicJewel.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// 天晶石表
|
||||
import { decodeArrayListStr, readFileAndParse, parseGoodStr, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicJewel {
|
||||
// 物品id
|
||||
readonly good_id: number;
|
||||
// 天晶石名
|
||||
readonly name: string;
|
||||
// 装备栏id
|
||||
readonly eplaceId: number;
|
||||
// itid
|
||||
readonly itid: number;
|
||||
// 天晶石阶
|
||||
readonly lv: number;
|
||||
// 天晶石品质
|
||||
readonly quality: number;
|
||||
// 天晶石属性条数
|
||||
readonly effectCount: number;
|
||||
// 套装效果
|
||||
readonly randomEffect: number[];
|
||||
// 对应藏宝图id
|
||||
readonly mapGoodId: number;
|
||||
// 淬炼消耗
|
||||
readonly quenchConsume: RewardInter[];
|
||||
}
|
||||
|
||||
|
||||
export const dicJewel = new Map<number, DicJewel>();
|
||||
export function loadJewel() {
|
||||
dicJewel.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_JEWEL);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.randomEffect = parseNumberList(o.randomEffect);
|
||||
o.quenchConsume = parseGoodStr(o.quenchConsume);
|
||||
dicJewel.set(o.good_id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// 镇念塔表
|
||||
// 套装表
|
||||
import { decodeArrayListStr, readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user