添加json
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// 每周总活跃
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicGuildActiveWeekReward {
|
||||
|
||||
// id
|
||||
readonly id: number;
|
||||
// 周最低点数
|
||||
readonly weekPointMin: number;
|
||||
// 周最高点数
|
||||
readonly weekPointMax: number;
|
||||
// 奖励
|
||||
readonly reward: RewardInter[];
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ACTIVE_DAY_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildActiveWeekReward = new Map<number, DicGuildActiveWeekReward>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveWeekReward.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
@@ -0,0 +1,25 @@
|
||||
// 军团职位表
|
||||
import { readJsonFile } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGuildPosition {
|
||||
|
||||
// 职位id
|
||||
readonly id: number;
|
||||
// 职位名
|
||||
readonly name: string;
|
||||
// 排名比例
|
||||
readonly rankProportion: number;
|
||||
// 拍卖行额外分成占比
|
||||
readonly sellRatio: number;
|
||||
// 周活跃额外分成比例
|
||||
readonly activeRatio: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_BLUEPRT_COMPOSE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildPosition = new Map<number, DicGuildPosition>();
|
||||
arr.forEach(o => {
|
||||
dicGuildPosition.set(o.id, o);
|
||||
});
|
||||
@@ -119,13 +119,16 @@ export interface DicWishPoolBase {
|
||||
// 等级
|
||||
readonly level: number;
|
||||
// 许愿物品
|
||||
readonly wishGoods: {type: number, quality: number, count: number}[];
|
||||
readonly wishGoodsEquip: { quality: number, count: number }[];
|
||||
// 许愿将魂
|
||||
readonly wishGoodsHero: { quality: number, count: number }[];
|
||||
}
|
||||
|
||||
const DicWishPoolKeys: KeysEnum<DicWishPoolBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
wishGoods: true
|
||||
wishGoodsEquip: true,
|
||||
wishGoodsHero: true
|
||||
};
|
||||
|
||||
// 商店
|
||||
@@ -208,7 +211,8 @@ const strWishPool = readJsonFile(FILENAME.DIC_GUILD_WISH_POOL_BASE);
|
||||
let arrWishPool = JSON.parse(strWishPool);
|
||||
arrWishPool.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.wishGoods = parseWishGoods(o.wishgoods);
|
||||
o.wishGoodsEquip = parseWishGoods(o.wishgoodsEquip);
|
||||
o.wishGoodsHero = parseWishGoods(o.wishgoodsHero);
|
||||
dicWishPoolBase.set(o.level, _.pick(o, Object.keys(DicWishPoolKeys)));
|
||||
});
|
||||
arrWishPool = undefined;
|
||||
@@ -259,16 +263,16 @@ export function parseDonateReward(str: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
// {"type": number, "quality": number, "count": number}
|
||||
// { "quality": number, "count": number}
|
||||
export function parseWishGoods(str: string) {
|
||||
let result = new Array<{ type: number, quality: number, count: number }>();
|
||||
let result = new Array<{ quality: number, count: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [type, quality, count] of decodeArr) {
|
||||
if (isNaN(parseInt(type)) || isNaN(parseInt(quality))|| isNaN(parseInt(count))) {
|
||||
for (let [quality, count] of decodeArr) {
|
||||
if ( isNaN(parseInt(quality))|| isNaN(parseInt(count))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({ type: parseInt(type), quality: parseInt(quality), count: parseInt(count) });
|
||||
result.push({ quality: parseInt(quality), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user