创建初始装备
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 物品表
|
||||
import {decodeArrayListStr, readJsonFile, parseReward} from '../util'
|
||||
import {decodeArrayListStr, readJsonFile, parseReward, parseNumberList, decodeArrayStr} from '../util'
|
||||
import { FILENAME, IT_TYPE, ABI_TYPE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -15,12 +15,17 @@ export interface DicGoods {
|
||||
readonly pieces: number;
|
||||
// 合成材料
|
||||
readonly composeMaterial: Array<RewardInter>;
|
||||
// 特殊材料
|
||||
readonly specialMaterial: Array<{id: number[], count: number}>;
|
||||
// 分解所得
|
||||
readonly decomposeItem: Array<RewardInter>;
|
||||
// 物品品质
|
||||
readonly quality: number;
|
||||
// 洞数
|
||||
readonly hole: number;
|
||||
// 随机属性范围
|
||||
readonly randomEffect: Array<number>;
|
||||
|
||||
// 类型id
|
||||
readonly itid: number;
|
||||
// 物品类型
|
||||
@@ -32,7 +37,7 @@ export interface DicGoods {
|
||||
// 强化属性
|
||||
readonly goodsAbilityUp:Map<number, number>;
|
||||
// 套装id
|
||||
readonly setid: number;
|
||||
readonly suitId: number;
|
||||
// 特殊属性
|
||||
readonly specialAttr: Map<number, number>;
|
||||
// 属性外加的值,经验,好感
|
||||
@@ -44,7 +49,26 @@ const str = readJsonFile(FILENAME.DIC_GOODS);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicGoodsKeys: KeysEnum<DicGoods> = {good_id: true, name: true, lvLimted: true, pieces: true, composeMaterial: true, decomposeItem: true, quality: true, hole: true, itid: true, goodType: true, hid: true, goodsAbility: true, goodsAbilityUp: true, setid: true, specialAttr: true, value: true }
|
||||
const DicGoodsKeys: KeysEnum<DicGoods> = {
|
||||
good_id: true,
|
||||
name: true,
|
||||
lvLimted: true,
|
||||
pieces: true,
|
||||
composeMaterial: true,
|
||||
specialMaterial: true,
|
||||
decomposeItem: true,
|
||||
quality: true,
|
||||
hole: true,
|
||||
randomEffect: true,
|
||||
itid: true,
|
||||
goodType: true,
|
||||
hid: true,
|
||||
goodsAbility: true,
|
||||
goodsAbilityUp: true,
|
||||
suitId: true,
|
||||
specialAttr: true,
|
||||
value: true
|
||||
}
|
||||
|
||||
export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprt = new Map<number, Array<number>>();
|
||||
@@ -55,6 +79,8 @@ arr.forEach(o => {
|
||||
o.composeMaterial = parseReward(o.composeMaterial);
|
||||
o.decomposeItem = parseReward(o.decomposeItem);
|
||||
o.specialAttr = parseSpecialAttr(o.specialAttr);
|
||||
o.specialMaterial = parseSpecialMaterial(o.specialMaterial);
|
||||
o.randomEffect = parseNumberList(o.randomEffect);
|
||||
dicGoods.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys)));
|
||||
|
||||
if(o.itid == IT_TYPE.BLUEPRT) {
|
||||
@@ -104,4 +130,18 @@ function parseAbilityUp(json) {
|
||||
map.set(ABI_TYPE.ABI_LUK, json.luk_up||0);
|
||||
map.set(ABI_TYPE.ABI_SPEED, json.speed_up||0);
|
||||
return map
|
||||
}
|
||||
|
||||
function parseSpecialMaterial(str: string) {
|
||||
let specialAttr = new Array<{id: number[], count: number}>();
|
||||
if(str) {
|
||||
let decodeArr = decodeArrayStr(str);
|
||||
if(decodeArr.length >= 2) {
|
||||
let ids = parseNumberList(decodeArr[0]);
|
||||
let count = parseInt(decodeArr[0]);
|
||||
if(isNaN(count)) return specialAttr;
|
||||
specialAttr.push({id: ids, count});
|
||||
}
|
||||
}
|
||||
return specialAttr;
|
||||
}
|
||||
31
shared/pubUtils/dictionary/DicRandomEffectPool.ts
Normal file
31
shared/pubUtils/dictionary/DicRandomEffectPool.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// 武将特技表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRandomEffectPool {
|
||||
|
||||
// 特技id
|
||||
readonly id: number;
|
||||
// 类型
|
||||
readonly type: number;
|
||||
// 包含的值
|
||||
readonly gainValueArr: Array<number>;
|
||||
// 随机值位置
|
||||
readonly index: number;
|
||||
// 随机最小值
|
||||
readonly min: number;
|
||||
// 随机最大值
|
||||
readonly max: number;
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RANDOM_EFFECT_POOL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRandomEffectPool = new Map<number, DicRandomEffectPool>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.gainValueArr = parseNumberList(o.gainvalue)
|
||||
dicRandomEffectPool.set(o.id, o);
|
||||
});
|
||||
Reference in New Issue
Block a user