后台:json上传
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
@@ -18,12 +18,13 @@ const DicArmyBossRankKeys: KeysEnum<DicArmyBossRank> = {
|
||||
reward: true,
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_BOSS_RANK_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyBossRank = new Array<DicArmyBossRank>();
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicArmyBossRank.push(_.pick(o, Object.keys(DicArmyBossRankKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
export function loadArmyBossRank() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_BOSS_RANK_REWARD);
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicArmyBossRank.push(_.pick(o, Object.keys(DicArmyBossRankKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
@@ -28,18 +28,20 @@ const DicArmyDevelopConsumeKeys: KeysEnum<DicArmyDevelopConsume> = {
|
||||
timeConsume: true
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_DEVELOPMENTCONSUME);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyDevelopConsume = new Map<number, DicArmyDevelopConsume>();
|
||||
arr.forEach(o => {
|
||||
o.honourConsume = parseGoodStr(o.honourConsume);
|
||||
o.prePositions = [];
|
||||
o.preposition.split('&').map(element => {
|
||||
if (!!parseInt(element))
|
||||
o.prePositions.push(parseInt(element));
|
||||
});
|
||||
export function loadArmyDevelopConsume() {
|
||||
|
||||
dicArmyDevelopConsume.set(o.id,_.pick(o, Object.keys(DicArmyDevelopConsumeKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_DEVELOPMENTCONSUME);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.honourConsume = parseGoodStr(o.honourConsume);
|
||||
o.prePositions = [];
|
||||
o.preposition.split('&').map(element => {
|
||||
if (!!parseInt(element))
|
||||
o.prePositions.push(parseInt(element));
|
||||
});
|
||||
|
||||
dicArmyDevelopConsume.set(o.id,_.pick(o, Object.keys(DicArmyDevelopConsumeKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
@@ -16,12 +16,13 @@ const DicArmyDonateKeys: KeysEnum<DicArmyDonate> = {
|
||||
boxRewards: true
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_DONATE_BOX_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyDonate = new Map<number, DicArmyDonate>();
|
||||
arr.forEach(o => {
|
||||
o.boxRewards = parseGoodStr(o.boxReward);
|
||||
dicArmyDonate.set(o.id, _.pick(o, Object.keys(DicArmyDonateKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
export function loadArmyDonate() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_DONATE_BOX_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.boxRewards = parseGoodStr(o.boxReward);
|
||||
dicArmyDonate.set(o.id, _.pick(o, Object.keys(DicArmyDonateKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
@@ -23,19 +23,21 @@ const DicArmyTrainJuDianKeys: KeysEnum<DicArmyTrainJuDian> = {
|
||||
soloRewardRatio: true
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_TRAIN_JU_DIAN);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyTrainJuDian = new Map<number, DicArmyTrainJuDian>();
|
||||
arr.forEach(o => {
|
||||
o.trainInstances = o.gkid.split('|').map(element => {
|
||||
let arr = element.split('&');
|
||||
return {hid: parseInt(arr[0]), warId: parseInt(arr[1]), progress: parseInt(arr[2])};
|
||||
export function loadArmyTrainJuDian() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_JU_DIAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.trainInstances = o.gkid.split('|').map(element => {
|
||||
let arr = element.split('&');
|
||||
return {hid: parseInt(arr[0]), warId: parseInt(arr[1]), progress: parseInt(arr[2])};
|
||||
});
|
||||
o.jinjieReward = parseGoodStr(o.jinjieReward);
|
||||
|
||||
o.heroRewards = parseGoodStr(o.shilianReward);
|
||||
|
||||
dicArmyTrainJuDian.set(o.id,_.pick(o, Object.keys(DicArmyTrainJuDianKeys)));
|
||||
});
|
||||
o.jinjieReward = parseGoodStr(o.jinjieReward);
|
||||
|
||||
o.heroRewards = parseGoodStr(o.shilianReward);
|
||||
|
||||
dicArmyTrainJuDian.set(o.id,_.pick(o, Object.keys(DicArmyTrainJuDianKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 藏宝图合成表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicBlueprtCompose {
|
||||
@@ -15,10 +15,12 @@ export interface DicBlueprtCompose {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_BLUEPRT_COMPOSE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicBlueprtCompose = new Map<number, DicBlueprtCompose>();
|
||||
arr.forEach(o => {
|
||||
dicBlueprtCompose.set(o.quality, o);
|
||||
});
|
||||
export function loadBlueprtCompose() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_BLUEPRT_COMPOSE);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicBlueprtCompose.set(o.quality, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 藏宝图掉落率
|
||||
import { decodeArrayListStr, readJsonFile } from '../util'
|
||||
import { decodeArrayListStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicBlueprtPossibility {
|
||||
@@ -13,14 +13,15 @@ export interface DicBlueprtPossibility {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_BLUEPRT_POSSIBILITY);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicBlueprtPossibility = new Array<DicBlueprtPossibility>();
|
||||
arr.forEach(o => {
|
||||
o.possibility = parsePossibility(o.possibility);
|
||||
dicBlueprtPossibility.push(o);
|
||||
});
|
||||
export function loadBlueprtPossibility() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_BLUEPRT_POSSIBILITY);
|
||||
arr.forEach(o => {
|
||||
o.possibility = parsePossibility(o.possibility);
|
||||
dicBlueprtPossibility.push(o);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function parsePossibility(str: string) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 主公经验
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicCharExp {
|
||||
@@ -9,13 +9,15 @@ export interface DicCharExp {
|
||||
readonly exp: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CHAR_EXP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicCharExp = new Map<number, number>();
|
||||
export function loadCharExp() {
|
||||
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
dicCharExp.set(o.level, exp);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_CHAR_EXP);
|
||||
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
dicCharExp.set(o.level, exp);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 聊天举报表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicChatAccuse {
|
||||
@@ -10,12 +10,13 @@ export interface DicChatAccuse {
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CHAT_ACCUSE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicChatAccuse = new Map<number, DicChatAccuse>();
|
||||
export function loadChatAccuse() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicChatAccuse.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_CHAT_ACCUSE);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicChatAccuse.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 聊天模板表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicChatSystem {
|
||||
@@ -10,8 +10,7 @@ export interface DicChatSystem {
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CHAT_SYSTEM);
|
||||
let arr = JSON.parse(str);
|
||||
let arr = readFileAndParse(FILENAME.DIC_CHAT_SYSTEM);
|
||||
|
||||
export const dicChatSystem = new Map<number, DicChatSystem>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 军团诸侯混战城池表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicCityActivity {
|
||||
@@ -22,14 +22,15 @@ export interface DicCityActivity {
|
||||
readonly week: number[];
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CITY_ACTIVITY);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicCityActivity = new Map<number, DicCityActivity>();
|
||||
export function loadCityActivity() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.preCity = parseNumberList(o.preCity);
|
||||
o.week = parseNumberList(o.week);
|
||||
dicCityActivity.set( o.id, o );
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_CITY_ACTIVITY);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.preCity = parseNumberList(o.preCity);
|
||||
o.week = parseNumberList(o.week);
|
||||
dicCityActivity.set( o.id, o );
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 诸侯混战军团排名奖励表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicCityActivityReward {
|
||||
@@ -18,16 +18,17 @@ export interface DicCityActivityReward {
|
||||
readonly honour: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_CITY_ACTIVITY_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicCityActivityReward = new Map<number, DicCityActivityReward[]>();
|
||||
export function loadCityActivityReward() {
|
||||
|
||||
arr.forEach(o => {
|
||||
if(dicCityActivityReward.has(o.type)) {
|
||||
dicCityActivityReward.get(o.type).push(o);
|
||||
} else {
|
||||
dicCityActivityReward.set(o.type, [o]);
|
||||
}
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_CITY_ACTIVITY_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
if(dicCityActivityReward.has(o.type)) {
|
||||
dicCityActivityReward.get(o.type).push(o);
|
||||
} else {
|
||||
dicCityActivityReward.set(o.type, [o]);
|
||||
}
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 每日总表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicDaily {
|
||||
@@ -16,11 +16,13 @@ export interface DicDaily {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_DAILY);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicDaily = new Array<DicDaily>();
|
||||
arr.forEach(o => {
|
||||
o.difficultLvl = parseNumberList(o.difficultLvl);
|
||||
dicDaily.push(o);
|
||||
});
|
||||
export function loadDaily() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_DAILY);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.difficultLvl = parseNumberList(o.difficultLvl);
|
||||
dicDaily.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 奇遇表
|
||||
import { parseGoodStr, decodeArrayStr, readJsonFile, parseNumberList } from '../util'
|
||||
import { parseGoodStr, decodeArrayStr, readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
|
||||
@@ -32,19 +32,22 @@ export interface DicEvent {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_EVENT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicEvent = new Map<number, DicEvent>();
|
||||
export const dicEventList = new Array<DicEvent>();
|
||||
arr.forEach(o => {
|
||||
o.winReward = parseGoodStr(o.winReward);
|
||||
o.loseReward = parseGoodStr(o.loseReward);
|
||||
o.suitLevel = parseSuitLevel(o.suitLevel);
|
||||
o.movePointArray = parseNumberList(o.movePointArray);
|
||||
dicEventList.push(o);
|
||||
dicEvent.set(o.eventID, o);
|
||||
});
|
||||
|
||||
export function loadEvent () {
|
||||
let arr = readFileAndParse(FILENAME.DIC_EVENT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.winReward = parseGoodStr(o.winReward);
|
||||
o.loseReward = parseGoodStr(o.loseReward);
|
||||
o.suitLevel = parseSuitLevel(o.suitLevel);
|
||||
o.movePointArray = parseNumberList(o.movePointArray);
|
||||
dicEventList.push(o);
|
||||
dicEvent.set(o.eventID, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
|
||||
function parseSuitLevel(str: string) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 远征关卡表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicExpedition {
|
||||
@@ -22,10 +22,13 @@ export interface DicExpedition {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_EXPEDITION);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicExpedition = new Map<number, DicExpedition>();
|
||||
arr.forEach(o => {
|
||||
dicExpedition.set(o.id, o);
|
||||
});
|
||||
export function loadExpedition() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_EXPEDITION);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicExpedition.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 远征点数奖励表
|
||||
import { parseGoodStr, readJsonFile } from '../util';
|
||||
import { parseGoodStr, readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -11,11 +11,14 @@ export interface DicExpeditionPoint {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_EXPEDITION_POINT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicExpeditionPoint = new Map<number, DicExpeditionPoint>();
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicExpeditionPoint.set(o.point, o);
|
||||
});
|
||||
export function loadExpeditionPoint() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_EXPEDITION_POINT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicExpeditionPoint.set(o.point, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 时装表
|
||||
import { decodeArrayListStr, readJsonFile } from '../util';
|
||||
import { decodeArrayListStr, readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicFashions {
|
||||
@@ -15,15 +15,17 @@ export interface DicFashions {
|
||||
readonly actorId: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_FASHIONS);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicFashions = new Map<number, DicFashions>();
|
||||
arr.forEach(o => {
|
||||
o.globalAttr = parseAttr(o.globalAttr);
|
||||
o.actorAttr = parseAttr(o.actorAttr);
|
||||
dicFashions.set(o.id, o);
|
||||
});
|
||||
export function loadFashions() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_FASHIONS);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.globalAttr = parseAttr(o.globalAttr);
|
||||
o.actorAttr = parseAttr(o.actorAttr);
|
||||
dicFashions.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{id: number, number: number}>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将羁绊表
|
||||
import { decodeArrayListStr, readJsonFile, parseNumberList } from '../util';
|
||||
import { decodeArrayListStr, readFileAndParse, parseNumberList } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicFriendShip {
|
||||
@@ -21,19 +21,21 @@ export interface DicFriendShip {
|
||||
readonly costCoin: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_FRIEND_SHIP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const friendShips = new Map<string, DicFriendShip>();
|
||||
export const friendShipHidAandIds = new Map<number, {actorId: number, level:number}>();
|
||||
arr.forEach(o => {
|
||||
o.attributes = parseAttribute(o.attribute);
|
||||
o.hids = parseNumberList(o.memberId);
|
||||
friendShips.set(o.shipId + '_' + o.level, o);
|
||||
let fiendShipHidAandId = friendShipHidAandIds.get(o.shipId);
|
||||
if (!fiendShipHidAandId || fiendShipHidAandId.level < o.level)
|
||||
friendShipHidAandIds.set(o.shipId, {actorId: o.actorId, level: o.level});
|
||||
});
|
||||
export function loadFriendShip() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.attributes = parseAttribute(o.attribute);
|
||||
o.hids = parseNumberList(o.memberId);
|
||||
friendShips.set(o.shipId + '_' + o.level, o);
|
||||
let fiendShipHidAandId = friendShipHidAandIds.get(o.shipId);
|
||||
if (!fiendShipHidAandId || fiendShipHidAandId.level < o.level)
|
||||
friendShipHidAandIds.set(o.shipId, {actorId: o.actorId, level: o.level});
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttribute(str: string) {
|
||||
let result = new Array<{id: number, number: number}>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将羁绊好感等级表
|
||||
import { readJsonFile } from '../util';
|
||||
import { readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicFriendShipLevel {
|
||||
@@ -13,15 +13,17 @@ export interface DicFriendShipLevel {
|
||||
readonly expSum: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_FRIEND_SHIP_LEVEL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export let maxFriendShipLv = 0;
|
||||
export const dicFriendShipLevelMap = new Map<number, DicFriendShipLevel>();
|
||||
let expSum = 0;
|
||||
arr.forEach(o => {
|
||||
expSum += o.exp;
|
||||
o.expSum = expSum;
|
||||
dicFriendShipLevelMap.set(o.level, o);
|
||||
if(o.level > maxFriendShipLv) maxFriendShipLv = o.level;
|
||||
});
|
||||
export function loadFriendShipLevel() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP_LEVEL);
|
||||
let expSum = 0;
|
||||
arr.forEach(o => {
|
||||
expSum += o.exp;
|
||||
o.expSum = expSum;
|
||||
dicFriendShipLevelMap.set(o.level, o);
|
||||
if(o.level > maxFriendShipLv) maxFriendShipLv = o.level;
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 开启功能表
|
||||
import { readJsonFile } from '../util';
|
||||
import { readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicFuncSwitch {
|
||||
@@ -16,10 +16,12 @@ export interface DicFuncSwitch {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_FUNC_SWITCH);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicFuncSwitch = new Map<number, DicFuncSwitch>();
|
||||
arr.forEach(o => {
|
||||
dicFuncSwitch.set(o.id, o);
|
||||
});
|
||||
export function loadFuncSwitch() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_FUNC_SWITCH);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicFuncSwitch.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseNumberList, parseGoodStr, decodeArrayListStr } from '../util'
|
||||
import { readFileAndParse, parseNumberList, parseGoodStr, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -15,18 +15,20 @@ export interface DicGacha {
|
||||
readonly percent: { id: number, weight: number }[];
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GACHA);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGacha = new Map<number, DicGacha>(); // id => dic
|
||||
arr.forEach(o => {
|
||||
o.count = parseNumberList(o.count);
|
||||
o.free = parseFree(o.free);
|
||||
o.cost = parseGoodStr(o.cost);
|
||||
o.percent = parsePercent(o.percent);
|
||||
dicGacha.set(o.id, o);
|
||||
});
|
||||
export function loadGacha() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_GACHA);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.count = parseNumberList(o.count);
|
||||
o.free = parseFree(o.free);
|
||||
o.cost = parseGoodStr(o.cost);
|
||||
o.percent = parsePercent(o.percent);
|
||||
dicGacha.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseFree(str: string) {
|
||||
let arr = parseNumberList(str);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME, GACHA_CONTENT_TYPE } from '../../consts'
|
||||
|
||||
export interface DicGachaContent {
|
||||
@@ -12,17 +12,19 @@ export interface DicGachaContent {
|
||||
readonly count: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GACHA_CONTENT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGachaContent = new Map<number, DicGachaContent>(); // id => dic
|
||||
export const dicGachaContentHero = new Map<number, number>(); // quality => dic
|
||||
arr.forEach(o => {
|
||||
o.param = parseNumberList(o.param);
|
||||
if(o.type == GACHA_CONTENT_TYPE.HERO) {
|
||||
dicGachaContentHero.set(o.param[0], o.id);
|
||||
}
|
||||
dicGachaContent.set(o.id, o);
|
||||
});
|
||||
export function loadGachaContent() {
|
||||
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_GACHA_CONTENT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.param = parseNumberList(o.param);
|
||||
if(o.type == GACHA_CONTENT_TYPE.HERO) {
|
||||
dicGachaContentHero.set(o.param[0], o.id);
|
||||
}
|
||||
dicGachaContent.set(o.id, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGkPvp {
|
||||
@@ -6,10 +6,13 @@ export interface DicGkPvp {
|
||||
readonly point: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GATE_ACTIVITY_POINT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGateActivityPoint = new Map<number, number>();
|
||||
arr.forEach(o => {
|
||||
dicGateActivityPoint.set(o.id, o.point);
|
||||
});
|
||||
export function loadGateActivityPoint() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_GATE_ACTIVITY_POINT);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicGateActivityPoint.set(o.id, o.point);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 礼包奖励表
|
||||
import { decodeArrayListStr, readJsonFile } from '../util';
|
||||
import { decodeArrayListStr, readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardParam } from '../../domain/activityField/rewardField';
|
||||
|
||||
@@ -17,14 +17,17 @@ export interface DicGiftPackage {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GIFT_PACKAGE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGiftPackage = new Map<number, DicGiftPackage>();
|
||||
arr.forEach(o => {
|
||||
o.reward = parseAttr(o.reward);
|
||||
dicGiftPackage.set(o.id, o);
|
||||
});
|
||||
export function loadGiftPackage() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_GIFT_PACKAGE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseAttr(o.reward);
|
||||
dicGiftPackage.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{ type: number, id: number, count: number }>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGkPvp {
|
||||
@@ -8,12 +8,14 @@ export interface DicGkPvp {
|
||||
readonly warType: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GK_PVP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGkPvp = new Map<number, DicGkPvp>();
|
||||
export const dicGkPvps = new Array<number>();
|
||||
arr.forEach(o => {
|
||||
dicGkPvp.set(o.war_id, o);
|
||||
dicGkPvps.push(o.war_id);
|
||||
});
|
||||
export function loadGkPvp() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_GK_PVP);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicGkPvp.set(o.war_id, o);
|
||||
dicGkPvps.push(o.war_id);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 物品表
|
||||
import {decodeArrayListStr, readJsonFile, parseGoodStr, parseNumberList, decodeArrayStr} from '../util'
|
||||
import {decodeArrayListStr, readFileAndParse, parseGoodStr, parseNumberList, decodeArrayStr} from '../util'
|
||||
import { FILENAME, IT_TYPE, ABI_TYPE , GOOD_TYPE} from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -64,9 +64,6 @@ export interface DicGoods {
|
||||
readonly timeLimit: number;
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -101,53 +98,57 @@ export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprt = new Map<number, Array<number>>();
|
||||
export const figureCondition = new Map<number, {params: number[], id: number, gid: number}[]>(); // type => {params, id, gid}
|
||||
|
||||
arr.forEach(o => {
|
||||
o.goodsAbility = parseAbility(o);
|
||||
o.goodsAbilityUp = parseAbilityUp(o);
|
||||
o.composeMaterial = parseGoodStr(o.composeMaterial);
|
||||
o.decomposeItem = parseGoodStr(o.decomposeItem);
|
||||
o.specialAttr = parseSpecialAttr(o.specialAttr);
|
||||
o.specialMaterial = parseSpecialMaterial(o.specialMaterial);
|
||||
o.randomEffect = parseNumberList(o.randomEffect);
|
||||
o.timeLimit = o.timelimit;
|
||||
if (o.goodType == IT_TYPE.EQUIP_PIECE) {
|
||||
let good = findWhere(arr, { pieceId: o.good_id });
|
||||
if (!!good)
|
||||
o.equipId = good.good_id;
|
||||
}
|
||||
let condition = parseConditionStr(o.condition);
|
||||
for(let {id, type, params} of condition) {
|
||||
let mapArr = figureCondition.get(type)||new Array<{params: number[], id: number, gid: number}>();
|
||||
mapArr.push({ params, id: id, gid: o.good_id});
|
||||
figureCondition.set(type, mapArr);
|
||||
}
|
||||
o.condition = condition;
|
||||
dicGoods.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys)));
|
||||
|
||||
if (o.itid == IT_TYPE.BLUEPRT) {
|
||||
let arr = blueprt.get(o.quality)||new Array<number>();
|
||||
arr.push(o.good_id);
|
||||
blueprt.set(o.quality, arr);
|
||||
} 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)));
|
||||
export function loadGoods() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_GOODS);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.goodsAbility = parseAbility(o);
|
||||
o.goodsAbilityUp = parseAbilityUp(o);
|
||||
o.composeMaterial = parseGoodStr(o.composeMaterial);
|
||||
o.decomposeItem = parseGoodStr(o.decomposeItem);
|
||||
o.specialAttr = parseSpecialAttr(o.specialAttr);
|
||||
o.specialMaterial = parseSpecialMaterial(o.specialMaterial);
|
||||
o.randomEffect = parseNumberList(o.randomEffect);
|
||||
o.timeLimit = o.timelimit;
|
||||
if (o.goodType == IT_TYPE.EQUIP_PIECE) {
|
||||
let good = findWhere(arr, { pieceId: o.good_id });
|
||||
if (!!good)
|
||||
o.equipId = good.good_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
let condition = parseConditionStr(o.condition);
|
||||
for(let {id, type, params} of condition) {
|
||||
let mapArr = figureCondition.get(type)||new Array<{params: number[], id: number, gid: number}>();
|
||||
mapArr.push({ params, id: id, gid: o.good_id});
|
||||
figureCondition.set(type, mapArr);
|
||||
}
|
||||
o.condition = condition;
|
||||
dicGoods.set(o.good_id, _.pick(o, Object.keys(DicGoodsKeys)));
|
||||
|
||||
if (o.itid == IT_TYPE.BLUEPRT) {
|
||||
let arr = blueprt.get(o.quality)||new Array<number>();
|
||||
arr.push(o.good_id);
|
||||
blueprt.set(o.quality, arr);
|
||||
} 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)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseSpecialAttr(str: string) {
|
||||
let specialAttr = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 每日个人可领奖励
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -14,13 +14,14 @@ export interface DicGuildActiveDayReward {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ACTIVE_DAY_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildActiveDayReward = new Map<number, DicGuildActiveDayReward>();
|
||||
export function loadGuildActiveDayReward() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveDayReward.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_ACTIVE_DAY_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveDayReward.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 各种操作可以增加的活跃
|
||||
import { readJsonFile, decodeIdCntArrayStr } from '../util'
|
||||
import { readFileAndParse, decodeIdCntArrayStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGuildActiveWays {
|
||||
@@ -13,14 +13,15 @@ export interface DicGuildActiveWays {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_ACTIVE_POINT_WAYS);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildActiveWays = new Map<number, DicGuildActiveWays>();
|
||||
export function loadGuildActiveWays() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.activePoint = decodeIdCntArrayStr(o.activePoint, 1);
|
||||
if(!o.count) o.count = o.cout;
|
||||
dicGuildActiveWays.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_ACTIVE_POINT_WAYS);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.activePoint = decodeIdCntArrayStr(o.activePoint, 1);
|
||||
if(!o.count) o.count = o.cout;
|
||||
dicGuildActiveWays.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 每周总活跃
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -16,13 +16,14 @@ export interface DicGuildActiveWeekReward {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ACTIVE_DAY_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildActiveWeekReward = new Array<DicGuildActiveWeekReward>();
|
||||
export function loadGuildActiveWeekReward() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveWeekReward.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_ACTIVE_DAY_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveWeekReward.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 军团活动
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGuildActivity {
|
||||
@@ -25,17 +25,18 @@ export interface DicGuildActivity {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GUILD_ACTIVITY);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildActivity = new Map<number, DicGuildActivity>();
|
||||
export function loadGuildActivity() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.openDay = parseNumberList(o.openDay);
|
||||
let time = o.startTime.split(':');
|
||||
o.startTime = parseInt(time[0]);
|
||||
o.startMinute = parseInt(time[1]);
|
||||
o.startSeconds = parseInt(time[2]);
|
||||
dicGuildActivity.set( o.id, o );
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_ACTIVITY);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.openDay = parseNumberList(o.openDay);
|
||||
let time = o.startTime.split(':');
|
||||
o.startTime = parseInt(time[0]);
|
||||
o.startMinute = parseInt(time[1]);
|
||||
o.startSeconds = parseInt(time[2]);
|
||||
dicGuildActivity.set( o.id, o );
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 公会权限
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
|
||||
@@ -15,15 +15,16 @@ export interface DicGuildAuction {
|
||||
readonly rewards: RewardInter[];
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GUILD_AUCTION);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildAuction = new Map<number, DicGuildAuction[]>();
|
||||
export function loadGuildAuction() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.rewards = parseGoodStr(o.rewards);
|
||||
let rank = dicGuildAuction.get(o.id)||[];
|
||||
rank.push(o);
|
||||
dicGuildAuction.set(o.id, rank);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_AUCTION);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.rewards = parseGoodStr(o.rewards);
|
||||
let rank = dicGuildAuction.get(o.id)||[];
|
||||
rank.push(o);
|
||||
dicGuildAuction.set(o.id, rank);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 公会权限
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGuildAuth {
|
||||
@@ -11,13 +11,13 @@ export interface DicGuildAuth {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GUILD_AUTH);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildAuth = new Map<number, number[]>();
|
||||
export function loadGuildAuth() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_AUTH);
|
||||
|
||||
arr.forEach(o => {
|
||||
let authority = parseNumberList(o.authority)
|
||||
dicGuildAuth.set(o.id, authority);
|
||||
});
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
let authority = parseNumberList(o.authority)
|
||||
dicGuildAuth.set(o.id, authority);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 军团职位表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicGuildPosition {
|
||||
@@ -16,10 +16,12 @@ export interface DicGuildPosition {
|
||||
readonly activeRatio: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_GUILD_POSITION);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicGuildPosition = new Map<number, DicGuildPosition>();
|
||||
arr.forEach(o => {
|
||||
dicGuildPosition.set(o.id, o);
|
||||
});
|
||||
export function loadGuildPosition() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_GUILD_POSITION);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicGuildPosition.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 武将表
|
||||
|
||||
import { ABI_TYPE, FILENAME } from '../../consts'
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicHero {
|
||||
@@ -31,22 +31,23 @@ export interface DicHero {
|
||||
readonly recruit: boolean;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobid: true, skill: true, pieceId: true, initialStars: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true, initialSkin: true, recruit: true};
|
||||
export const dicMyHeroes = new Array<number>();
|
||||
export const dicHero = new Map<number, DicHero>();
|
||||
arr.forEach(o => {
|
||||
if(o.heroId > 0 && o.heroId <= 300) {
|
||||
dicMyHeroes.push(o.heroId);
|
||||
}
|
||||
o.baseAbilityArr = parseBaseAbilityArr(o);
|
||||
o.baseAbilityUpArr = parseBaseAbilityUpArr(o);
|
||||
o.recruit = parseInt(o.recruit) == 1;
|
||||
dicHero.set(o.heroId, _.pick(o, Object.keys(DicHeroKeys)));
|
||||
});
|
||||
export function loadHero() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO);
|
||||
arr.forEach(o => {
|
||||
if(o.heroId > 0 && o.heroId <= 300) {
|
||||
dicMyHeroes.push(o.heroId);
|
||||
}
|
||||
o.baseAbilityArr = parseBaseAbilityArr(o);
|
||||
o.baseAbilityUpArr = parseBaseAbilityUpArr(o);
|
||||
o.recruit = parseInt(o.recruit) == 1;
|
||||
dicHero.set(o.heroId, _.pick(o, Object.keys(DicHeroKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseBaseAbilityArr(json) {
|
||||
let map = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 藏宝图合成表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -8,17 +8,19 @@ export interface DicHeroEquip {
|
||||
readonly classId: Array<number>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_EQUIP);
|
||||
let arr = JSON.parse(str);
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicHeroEquipKeys: KeysEnum<DicHeroEquip> = {
|
||||
itId: true,
|
||||
classId: true
|
||||
}
|
||||
export const dicHeroEquip = new Map<number, DicHeroEquip>();
|
||||
arr.forEach(o => {
|
||||
o.classId = parseNumberList(o.classId);
|
||||
dicHeroEquip.set(o.itId, _.pick(o, Object.keys(DicHeroEquipKeys)));
|
||||
});
|
||||
export function loadHeroEquip() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_EQUIP);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.classId = parseNumberList(o.classId);
|
||||
dicHeroEquip.set(o.itId, _.pick(o, Object.keys(DicHeroEquipKeys)));
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将技能表
|
||||
import {parseGoodStr, readJsonFile} from '../util'
|
||||
import {parseGoodStr, readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -16,11 +16,13 @@ export interface DicHeroQualityUp {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_QUALITY_UP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicHeroQualityUp = new Map<number, DicHeroQualityUp>();
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
dicHeroQualityUp.set(o.quality, o);
|
||||
});
|
||||
export function loadHeroQualityUp() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_QUALITY_UP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
dicHeroQualityUp.set(o.quality, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将技能表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME, ABI_STAGE } from '../../consts'
|
||||
|
||||
export interface DicHeroScroll {
|
||||
@@ -19,21 +19,22 @@ export interface DicHeroScroll {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_SCROLL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicHeroScroll = new Map<string, DicHeroScroll>();
|
||||
export const preHeroScroll = new Map<number, DicHeroScroll>(); // 前一个
|
||||
let pre: DicHeroScroll;
|
||||
export function loadHeroScroll() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroScroll.set(`${o.quality}_${o.stars}_${o.qualityUp}_${o.colorstars}`, o);
|
||||
if(pre && pre.quality == o.quality) preHeroScroll.set(o.id, pre);
|
||||
pre = o;
|
||||
});
|
||||
arr = undefined;
|
||||
pre = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_SCROLL);
|
||||
let pre: DicHeroScroll;
|
||||
|
||||
arr.forEach(o => {
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroScroll.set(`${o.quality}_${o.stars}_${o.qualityUp}_${o.colorstars}`, o);
|
||||
if(pre && pre.quality == o.quality) preHeroScroll.set(o.id, pre);
|
||||
pre = o;
|
||||
});
|
||||
arr = undefined;
|
||||
pre = undefined;
|
||||
}
|
||||
|
||||
function parseCeAttr(elem) {
|
||||
let ceAttr = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将技能表
|
||||
import {decodeArrayListStr, readJsonFile} from '../util'
|
||||
import {decodeArrayListStr, readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicHeroSkill {
|
||||
@@ -15,15 +15,16 @@ export interface DicHeroSkill {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_SKILL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicHeroSkill = new Map<number, DicHeroSkill>();
|
||||
arr.forEach(o => {
|
||||
o.starSeidArr = parseSeid(o.starSeid);
|
||||
o.colorStarSeidArr = parseSeid(o.colorStarSeid);
|
||||
dicHeroSkill.set(o.skillid, o);
|
||||
});
|
||||
export function loadHeroSkill() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_SKILL);
|
||||
arr.forEach(o => {
|
||||
o.starSeidArr = parseSeid(o.starSeid);
|
||||
o.colorStarSeidArr = parseSeid(o.colorStarSeid);
|
||||
dicHeroSkill.set(o.skillid, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseSeid(str: string) {
|
||||
let arr = new Array<{star: number, value: number, type: number}>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将升星表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { ABI_STAGE, FILENAME } from '../../consts';
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -18,17 +18,20 @@ export interface DicHeroStar {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_STAR);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicHeroStarKeys: KeysEnum<DicHeroStar> = {id: true, quality: true, star: true, advanceUpFragmentNum: true, ceAttr: true};
|
||||
|
||||
export const dicHeroStar = new Map<string, DicHeroStar>();
|
||||
arr.forEach(o => {
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroStar.set(`${o.quality}_${o.star}`, _.pick(o, Object.keys(DicHeroStarKeys)));
|
||||
});
|
||||
export function loadHeroStar() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_STAR);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroStar.set(`${o.quality}_${o.star}`, _.pick(o, Object.keys(DicHeroStarKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseCeAttr(elem) {
|
||||
let ceAttr = new Map<number, number>();
|
||||
@@ -37,5 +40,4 @@ function parseCeAttr(elem) {
|
||||
ceAttr.set(ABI_STAGE.DEF, elem.def_up);
|
||||
ceAttr.set(ABI_STAGE.MDEF, elem.mdef_up);
|
||||
return ceAttr;
|
||||
}
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将觉醒表
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { ABI_STAGE, FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -21,18 +21,20 @@ export interface DicHeroWake {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_HERO_WAKE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicHeroWakeKeys: KeysEnum<DicHeroWake> = {id: true, quality: true, star: true, fragmentNum: true, consume: true, ceAttr: true};
|
||||
|
||||
export const dicHeroWake = new Map<string, DicHeroWake>();
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroWake.set(`${o.quality}_${o.star}`, _.pick(o, Object.keys(DicHeroWakeKeys)));
|
||||
});
|
||||
export function loadHeroWake() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_HERO_WAKE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicHeroWake.set(`${o.quality}_${o.star}`, _.pick(o, Object.keys(DicHeroWakeKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseCeAttr(elem) {
|
||||
let ceAttr = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 兵种表
|
||||
import {readJsonFile, parseNumberList, parseGoodStr} from '../util'
|
||||
import { readFileAndParse, parseNumberList, parseGoodStr} from '../util'
|
||||
import { FILENAME, ABI_STAGE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -28,9 +28,6 @@ export interface DicJob {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_JOB);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicJobKeys: KeysEnum<DicJob> = {jobid: true, name: true, grade: true, unlockLevel: true, job_class: true, type: true, seid: true,trainingConsume: true, upGradeConsume: true, ceAttr: true};
|
||||
|
||||
@@ -38,19 +35,25 @@ export const dicJob = new Map<number, DicJob>();
|
||||
export const jobClassMaxGrades = new Map<number, {grade:number, jobid:number}>();
|
||||
export const jobClassAndgrades = new Map<string, {jobid:number, unlockLevel:number}>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.seid = parseNumberList(o.seid);
|
||||
o.trainingConsume = parseGoodStr(o.trainingConsume);
|
||||
o.upGradeConsume = parseGoodStr(o.upGradeConsume);
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys)));
|
||||
let jobClass = jobClassMaxGrades.get(o.job_class);
|
||||
if (!jobClass || jobClass.grade < o.grade) {
|
||||
jobClassMaxGrades.set(o.job_class, {grade: o.grade,jobid: o.jobid});
|
||||
}
|
||||
jobClassAndgrades.set(o.job_class+'_'+o.grade,{unlockLevel:o.unlockLevel, jobid:o.jobid});
|
||||
export function loadJob() {
|
||||
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_JOB);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.seid = parseNumberList(o.seid);
|
||||
o.trainingConsume = parseGoodStr(o.trainingConsume);
|
||||
o.upGradeConsume = parseGoodStr(o.upGradeConsume);
|
||||
o.ceAttr = parseCeAttr(o);
|
||||
dicJob.set(o.jobid, _.pick(o, Object.keys(DicJobKeys)));
|
||||
let jobClass = jobClassMaxGrades.get(o.job_class);
|
||||
if (!jobClass || jobClass.grade < o.grade) {
|
||||
jobClassMaxGrades.set(o.job_class, {grade: o.grade,jobid: o.jobid});
|
||||
}
|
||||
jobClassAndgrades.set(o.job_class+'_'+o.grade,{unlockLevel:o.unlockLevel, jobid:o.jobid});
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseCeAttr(elem) {
|
||||
let ceAttr = new Map<number, number>();
|
||||
@@ -59,6 +62,4 @@ function parseCeAttr(elem) {
|
||||
ceAttr.set(ABI_STAGE.DEF, elem.def);
|
||||
ceAttr.set(ABI_STAGE.MDEF, elem.mdef);
|
||||
return ceAttr;
|
||||
}
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 主公经验
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicKingExp {
|
||||
@@ -9,16 +9,17 @@ export interface DicKingExp {
|
||||
readonly exp: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_KING_EXP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicKingExp = new Map<number, {sum: number, cur: number}>();
|
||||
export let maxPlayerLv = 0;
|
||||
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||
});
|
||||
arr = null;
|
||||
export function loadKingExp() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_KING_EXP);
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||
});
|
||||
arr = null;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 邮件内容
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicMail {
|
||||
@@ -10,13 +10,13 @@ export interface DicMail {
|
||||
readonly time: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_MAIL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicMail = new Map<number, DicMail>();
|
||||
export function loadMail() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.time = o.time * 24 * 60 * 60;
|
||||
dicMail.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_MAIL);
|
||||
arr.forEach(o => {
|
||||
o.time = o.time * 24 * 60 * 60;
|
||||
dicMail.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 主线任务阶段内容
|
||||
import {readJsonFile, parseNumberList, parseGoodStr} from '../util'
|
||||
import {readFileAndParse, parseNumberList, parseGoodStr} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -14,14 +14,15 @@ export interface DicMainTaskStage {
|
||||
readonly reward: RewardInter[];
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_MAIN_TASK_STAGE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicMainTaskStage = new Map<number, DicMainTaskStage>();
|
||||
export function loadMainTaskStage() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.mainTaskId = parseNumberList(o.mainTaskId);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicMainTaskStage.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_MAIN_TASK_STAGE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.mainTaskId = parseNumberList(o.mainTaskId);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicMainTaskStage.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
export interface DicPvpBox {
|
||||
@@ -9,12 +9,14 @@ export interface DicPvpBox {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_BOX);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpBoxs = new Array<DicPvpBox>();
|
||||
export function loadPvpBox() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicPvpBoxs.push(o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_BOX);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicPvpBoxs.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -11,11 +11,13 @@ export interface DicHeroRewads {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_HERO_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicHeroRewads = new Array<DicHeroRewads>();
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicHeroRewads.push(o);
|
||||
});
|
||||
export function loadPvpHeroReward() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_HERO_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicHeroRewads.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// pvp三个对手
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicPvpOpponent {
|
||||
@@ -15,13 +15,14 @@ export interface DicPvpOpponent {
|
||||
readonly ratio: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_OPPONENT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpOpponent = new Map<number, DicPvpOpponent>();
|
||||
export function loadPvpOpponent() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicPvpOpponent.set(o.id, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_OPPONENT);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicPvpOpponent.set(o.id, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -10,15 +10,18 @@ export interface DicRankRewads {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_RANK_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRankRewads = new Array<DicRankRewads>();
|
||||
export var dicRankMax: DicRankRewads;
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
if (!dicRankMax||o.min > dicRankMax.min) {
|
||||
dicRankMax = o;
|
||||
}
|
||||
dicRankRewads.push(o);
|
||||
});
|
||||
export let dicRankMax: DicRankRewads;
|
||||
export function loadPvpRankReward() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_RANK_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
if (!dicRankMax||o.min > dicRankMax.min) {
|
||||
dicRankMax = o;
|
||||
}
|
||||
dicRankRewads.push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// pvp三个对手
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -12,16 +12,17 @@ export interface DicPvpRefreshConsume {
|
||||
readonly consume: RewardInter[]
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_REFRESH_CONSUME);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpRefreshConsume = new Map<number, RewardInter[]>();
|
||||
export let maxPvpRefreshCnt = 0;
|
||||
export function loadPvpRefreshConsume() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
if(o.count > maxPvpRefreshCnt) maxPvpRefreshCnt = o.count;
|
||||
dicPvpRefreshConsume.set(o.count, o.consume);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_REFRESH_CONSUME);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
if(o.count > maxPvpRefreshCnt) maxPvpRefreshCnt = o.count;
|
||||
dicPvpRefreshConsume.set(o.count, o.consume);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// pvp三个对手
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicPvpTeamLevel {
|
||||
@@ -13,13 +13,14 @@ export interface DicPvpTeamLevel {
|
||||
readonly topLineupMax: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_TEAM_LEVEL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpTeamLevel = new Array<DicPvpTeamLevel>();
|
||||
export function loadPvpTeamLevel() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicPvpTeamLevel.push(o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_PVP_TEAM_LEVEL);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicPvpTeamLevel.push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 奇遇题库
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicQuestion {
|
||||
@@ -14,15 +14,17 @@ export interface DicQuestion {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_QUESTION);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicQuestion = new Map<number, DicQuestion>();
|
||||
export function loadQuestion() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.answer = parseAnswer(o.a1, o.a2, o.a3, o.a4)
|
||||
dicQuestion.set(o.id, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_QUESTION);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.answer = parseAnswer(o.a1, o.a2, o.a3, o.a4)
|
||||
dicQuestion.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAnswer(a1: string, a2: string, a3: string, a4: string) {
|
||||
let answer = new Array<string>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RMB商品价格表
|
||||
import { readJsonFile } from '../util';
|
||||
import { readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicRMB {
|
||||
@@ -13,10 +13,12 @@ export interface DicRMB {
|
||||
readonly message: string;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RMB);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRMB = new Map<string, DicRMB>();
|
||||
arr.forEach(o => {
|
||||
dicRMB.set(o.productID, o);
|
||||
});
|
||||
export function loadRMB() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_RMB);
|
||||
arr.forEach(o => {
|
||||
dicRMB.set(o.productID, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 粮草先行道具
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -22,25 +22,26 @@ export interface DicRaceActivity {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RACE_ACTIVITY);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicRaceKeys: KeysEnum<DicRaceActivity> = {id: true, type: true, effectType: true, effect: true, continueTime: true, continueDistance: true, effectTime: true};
|
||||
|
||||
export const dicRaceActivity = new Map<number, DicRaceActivity>();
|
||||
export const dicRaceTypes = new Map<number, Map<number, number[]>>();
|
||||
export function loadRaceActivity() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.effectTime = o.effecttime;
|
||||
o.effect = parseNumberList(o.effect);
|
||||
dicRaceActivity.set(o.id, _.pick(o, Object.keys(DicRaceKeys)));
|
||||
if(!dicRaceTypes.has(o.type)) {
|
||||
dicRaceTypes.set(o.type, new Map<number, number[]>());
|
||||
}
|
||||
if(!dicRaceTypes.get(o.type).has(o.effectType)) {
|
||||
dicRaceTypes.get(o.type).set(o.effectType, []);
|
||||
}
|
||||
dicRaceTypes.get(o.type).get(o.effectType).push(o.id);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_RACE_ACTIVITY);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.effectTime = o.effecttime;
|
||||
o.effect = parseNumberList(o.effect);
|
||||
dicRaceActivity.set(o.id, _.pick(o, Object.keys(DicRaceKeys)));
|
||||
if(!dicRaceTypes.has(o.type)) {
|
||||
dicRaceTypes.set(o.type, new Map<number, number[]>());
|
||||
}
|
||||
if(!dicRaceTypes.get(o.type).has(o.effectType)) {
|
||||
dicRaceTypes.get(o.type).set(o.effectType, []);
|
||||
}
|
||||
dicRaceTypes.get(o.type).get(o.effectType).push(o.id);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将特技表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRandomEffectPool {
|
||||
@@ -19,13 +19,13 @@ export interface DicRandomEffectPool {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RANDOM_EFFECT_POOL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRandomEffectPool = new Map<number, DicRandomEffectPool>();
|
||||
export function loadRandomEffectPool() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_RANDOM_EFFECT_POOL);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.gainValueArr = parseNumberList(o.gainValue)
|
||||
dicRandomEffectPool.set(o.id, o);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
o.gainValueArr = parseNumberList(o.gainValue)
|
||||
dicRandomEffectPool.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 排行榜表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRank {
|
||||
@@ -13,14 +13,14 @@ export interface DicRank {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RANK);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRank = new Array<DicRank>();
|
||||
export function loadRank() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRank.push(o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_RANK);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicRank.push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 排行榜奖励表
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -16,15 +16,15 @@ export interface DicRankReward {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RANK_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRankReward = new Map<number, DicRankReward>();
|
||||
export function loadRankReward() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicRankReward.set(o.id, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_RANK_REWARD);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicRankReward.set(o.id, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 排行榜表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRecruit {
|
||||
@@ -13,14 +13,14 @@ export interface DicRecruit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_RECRUIT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRecruit = new Array<DicRecruit>();
|
||||
export function loadRecruit() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRecruit.push(o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_RECRUIT);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicRecruit.push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将特技表
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -18,15 +18,15 @@ export interface DicRefine {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_REFINE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRefine = new Map<number, DicRefine>();
|
||||
export function loadRefine() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.material = parseGoodStr(o.material)
|
||||
dicRefine.set(o.level, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_REFINE);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.material = parseGoodStr(o.material)
|
||||
dicRefine.set(o.level, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 好友表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRoleFriend {
|
||||
@@ -17,14 +17,14 @@ export interface DicRoleFriend {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ROLE_FRIEND);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRoleFriend = new Map<number, DicRoleFriend>();
|
||||
export function loadRoleFriend() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRoleFriend.set(o.lv, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROLE_FRIEND);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicRoleFriend.set(o.lv, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 亲密度等级表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRoleFriendLv {
|
||||
@@ -17,17 +17,18 @@ export interface DicRoleFriendLv {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ROLE_FRIEND_LEVEL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicRoleFriendLv = new Map<number, DicRoleFriendLv>();
|
||||
let sum = 0;
|
||||
export function loadRoleFriendLv() {
|
||||
|
||||
arr.forEach(o => {
|
||||
sum += o.value;
|
||||
o.sum = sum;
|
||||
dicRoleFriendLv.set(o.lv, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROLE_FRIEND_LEVEL);
|
||||
|
||||
arr = undefined;
|
||||
let sum = 0;
|
||||
|
||||
arr.forEach(o => {
|
||||
sum += o.value;
|
||||
o.sum = sum;
|
||||
dicRoleFriendLv.set(o.lv, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 百家学宫列表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicSchool {
|
||||
@@ -12,15 +12,15 @@ export interface DicSchool {
|
||||
readonly upAttribute: Array<number>;
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SCHOOL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicSchool = new Map<number, DicSchool>();
|
||||
export function loadSchool() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.upAttribute = parseNumberList(o.upAttribute)
|
||||
dicSchool.set(o.id, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_SCHOOL);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.upAttribute = parseNumberList(o.upAttribute)
|
||||
dicSchool.set(o.id, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 百家学宫列表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicSchoolRate {
|
||||
@@ -18,14 +18,14 @@ export interface DicSchoolRate {
|
||||
readonly assiAttrAddValue: number;
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SCHOOL_RATE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicSchoolRate = new Map<string, DicSchoolRate>();
|
||||
export function loadSchoolRate() {
|
||||
|
||||
arr.forEach(o => {
|
||||
dicSchoolRate.set(`${o.stars}_${o.colorstars}_${o.quality}`, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_SCHOOL_RATE);
|
||||
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
dicSchoolRate.set(`${o.stars}_${o.colorstars}_${o.quality}`, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 武将特技表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicSe {
|
||||
@@ -20,14 +20,14 @@ export interface DicSe {
|
||||
readonly index: number;
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicSe = new Map<number, DicSe>();
|
||||
export function loadSe() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_SE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.index = 0;
|
||||
o.gainValueArr = parseNumberList(o.gainvalue)
|
||||
dicSe.set(o.id, o);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
o.index = 0;
|
||||
o.gainValueArr = parseNumberList(o.gainvalue)
|
||||
dicSe.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 商店商品表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicShop {
|
||||
@@ -26,20 +26,21 @@ export interface DicShop {
|
||||
readonly price: number;
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SHOP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicShopItem = new Map<number, DicShop>(); // itemid => DicShop
|
||||
export const dicShop = new Map<number, DicShop[]>(); // shop => DicShop[]
|
||||
export function loadShop() {
|
||||
|
||||
arr.forEach(o => {
|
||||
o.guildLvLimit = o.guildlvlimit == '&'?0: o.guildlvlimit;
|
||||
o.purchaseLimit = o.purchaselimit == '&'?-1: o.purchaselimit;
|
||||
if(!dicShop.has(o.shop)) {
|
||||
dicShop.set(o.shop, [o]);
|
||||
} else {
|
||||
dicShop.get(o.shop).push(o);
|
||||
}
|
||||
dicShopItem.set(o.id, o);
|
||||
});
|
||||
let arr = readFileAndParse(FILENAME.DIC_SHOP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.guildLvLimit = o.guildlvlimit == '&'?0: o.guildlvlimit;
|
||||
o.purchaseLimit = o.purchaselimit == '&'?-1: o.purchaselimit;
|
||||
if(!dicShop.has(o.shop)) {
|
||||
dicShop.set(o.shop, [o]);
|
||||
} else {
|
||||
dicShop.get(o.shop).push(o);
|
||||
}
|
||||
dicShopItem.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 商店表
|
||||
import { readJsonFile, parseNumberList } from '../util'
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicShopList {
|
||||
@@ -13,14 +13,14 @@ export interface DicShopList {
|
||||
readonly money: number[];
|
||||
}
|
||||
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SHOP_LIST);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicShopList = new Map<number, DicShopList>();
|
||||
export function loadShopList() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_SHOP_LIST);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.type = parseNumberList(o.typeid);
|
||||
o.money = parseNumberList(o.moneyid);
|
||||
dicShopList.set(o.shopid, o);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
o.type = parseNumberList(o.typeid);
|
||||
o.money = parseNumberList(o.moneyid);
|
||||
dicShopList.set(o.shopid, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 强化消耗表
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicStrengthenCost {
|
||||
@@ -9,11 +9,12 @@ export interface DicStrengthenCost {
|
||||
readonly costCoin: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_STRENGTHEN_COST);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicStrengthenCost = new Map<number, number>();
|
||||
export function loadStrengthenCost() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_STRENGTHEN_COST);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicStrengthenCost.set(o.level, o.costCoin);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
dicStrengthenCost.set(o.level, o.costCoin);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 军团建筑物
|
||||
import {readJsonFile, parseGoodStr, parseNumberList, decodeArrayListStr} from '../util'
|
||||
import {readFileAndParse, parseGoodStr, parseNumberList, decodeArrayListStr} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -146,11 +146,6 @@ export interface DicStoreBase {
|
||||
readonly storeGoods: {id: number, count: number, num: number}[];
|
||||
}
|
||||
|
||||
const DicStoreKeys: KeysEnum<DicStoreBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
storeGoods: true
|
||||
};
|
||||
|
||||
export const dicStructureConsume = new Map<number, Map<number, number>>(); // 升级消耗 structureId => level => consume
|
||||
export const dicCenterBase = new Map<number, DicCentreBase>(); // 中军大帐
|
||||
@@ -163,96 +158,97 @@ export const dicWishPoolBase = new Map<number, DicWishPoolBase>(); // 许愿池
|
||||
export const dicStoreBase = new Map<number, DicWishPoolBase>(); // 许愿池
|
||||
export let maxMemberCnt = 0; // 满配最大人数
|
||||
|
||||
// 中军大帐
|
||||
const strCenter = readJsonFile(FILENAME.DIC_GUILD_STRUCTURE_CENTER);
|
||||
let arrCenter = JSON.parse(strCenter);
|
||||
arrCenter.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
if(o.peopleNum > maxMemberCnt) maxMemberCnt = o.peopleNum;
|
||||
dicCenterBase.set(o.level, _.pick(o, Object.keys(DicCenterKeys)));
|
||||
});
|
||||
arrCenter = undefined;
|
||||
export function loadStructure() {
|
||||
|
||||
// 炼器堂
|
||||
const strEquip = readJsonFile(FILENAME.DIC_GUILD_EQUIP_PRODUCE_BASE);
|
||||
let arrEquip = JSON.parse(strEquip);
|
||||
arrEquip.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.qualityProduce = parseNumberList(o.qualityProduce);
|
||||
dicEquipPriduceBase.set(o.level, _.pick(o, Object.keys(DicEquipProduceKeys)));
|
||||
});
|
||||
arrEquip = undefined;
|
||||
|
||||
// 演武台
|
||||
const strBoss = readJsonFile(FILENAME.DIC_GUILD_BOSS_BASE);
|
||||
let arrBoss = JSON.parse(strBoss);
|
||||
arrBoss.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.wars = o.warIdHP.split('|').map((warStrs)=> {
|
||||
if (!warStrs) {
|
||||
return;
|
||||
}
|
||||
let warArr = warStrs.split('&');
|
||||
return { warId: parseInt(warArr[0]), bossHp: parseInt(warArr[1])}
|
||||
const DicStoreKeys: KeysEnum<DicStoreBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
storeGoods: true
|
||||
};
|
||||
// 中军大帐
|
||||
let arrCenter = readFileAndParse(FILENAME.DIC_GUILD_STRUCTURE_CENTER);
|
||||
arrCenter.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
if(o.peopleNum > maxMemberCnt) maxMemberCnt = o.peopleNum;
|
||||
dicCenterBase.set(o.level, _.pick(o, Object.keys(DicCenterKeys)));
|
||||
});
|
||||
dicBossBase.set(o.level, _.pick(o, Object.keys(DicBossKeys)));
|
||||
dicBossBaseByBossLv.set(o.bossLevel, _.pick(o, Object.keys(DicBossKeys)));
|
||||
});
|
||||
arrBoss = undefined;
|
||||
arrCenter = undefined;
|
||||
|
||||
// 练兵场
|
||||
const strTrain = readJsonFile(FILENAME.DIC_GUILD_TRAIN_BASE);
|
||||
let arrTrain = JSON.parse(strTrain);
|
||||
arrTrain.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
dicTrainBase.set(o.level, _.pick(o, Object.keys(DicTrainKeys)));
|
||||
});
|
||||
arrTrain = undefined;
|
||||
|
||||
// 捐献所
|
||||
const strDonate = readJsonFile(FILENAME.DIC_GUILD_DONATE_BASE);
|
||||
let arrDonate = JSON.parse(strDonate);
|
||||
arrDonate.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.donateReward = parseDonateReward(o.donatevalue, o.honourReward, o.fundReward);
|
||||
dicDonateBase.set(o.level, _.pick(o, Object.keys(DicDonateKeys)));
|
||||
});
|
||||
arrDonate = undefined;
|
||||
|
||||
// 许愿池
|
||||
const strWishPool = readJsonFile(FILENAME.DIC_GUILD_WISH_POOL_BASE);
|
||||
let arrWishPool = JSON.parse(strWishPool);
|
||||
arrWishPool.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.wishGoodsEquips = o.wishgoodsEquip.split('|').map(wishGoodsEquip=>{
|
||||
let wishGoodsEquips = wishGoodsEquip.split('&');
|
||||
return {quality: parseInt(wishGoodsEquips[0]), count: parseInt(wishGoodsEquips[1])};
|
||||
// 炼器堂
|
||||
let arrEquip = readFileAndParse(FILENAME.DIC_GUILD_EQUIP_PRODUCE_BASE);
|
||||
arrEquip.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.qualityProduce = parseNumberList(o.qualityProduce);
|
||||
dicEquipPriduceBase.set(o.level, _.pick(o, Object.keys(DicEquipProduceKeys)));
|
||||
});
|
||||
o.wishGoodsHeros = o.wishgoodsHero.split('|').map(wishGoodsHero=>{
|
||||
let wishGoodsHeros = wishGoodsHero.split('&');
|
||||
return {quality: parseInt(wishGoodsHeros[0]), count: parseInt(wishGoodsHeros[1])};
|
||||
arrEquip = undefined;
|
||||
|
||||
// 演武台
|
||||
let arrBoss = readFileAndParse(FILENAME.DIC_GUILD_BOSS_BASE);
|
||||
arrBoss.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.wars = o.warIdHP.split('|').map((warStrs)=> {
|
||||
if (!warStrs) {
|
||||
return;
|
||||
}
|
||||
let warArr = warStrs.split('&');
|
||||
return { warId: parseInt(warArr[0]), bossHp: parseInt(warArr[1])}
|
||||
});
|
||||
dicBossBase.set(o.level, _.pick(o, Object.keys(DicBossKeys)));
|
||||
dicBossBaseByBossLv.set(o.bossLevel, _.pick(o, Object.keys(DicBossKeys)));
|
||||
});
|
||||
dicWishPoolBase.set(o.level, _.pick(o, Object.keys(DicWishPoolKeys)));
|
||||
});
|
||||
arrWishPool = undefined;
|
||||
arrBoss = undefined;
|
||||
|
||||
// 商店
|
||||
const strStore = readJsonFile(FILENAME.DIC_GUILD_STORE_BASE);
|
||||
let arrStore = JSON.parse(strStore);
|
||||
arrStore.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.storeGoods = parseStoreGoods(o.storeGoods);
|
||||
dicStoreBase.set(o.level, _.pick(o, Object.keys(DicStoreKeys)));
|
||||
});
|
||||
arrStore = undefined;
|
||||
// 练兵场
|
||||
let arrTrain = readFileAndParse(FILENAME.DIC_GUILD_TRAIN_BASE);
|
||||
arrTrain.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
dicTrainBase.set(o.level, _.pick(o, Object.keys(DicTrainKeys)));
|
||||
});
|
||||
arrTrain = undefined;
|
||||
|
||||
// 升级消耗
|
||||
function setStructureConsume(o) {
|
||||
let map = dicStructureConsume.get(o.structureId);
|
||||
if(!map) map = new Map<number, number>();
|
||||
map.set(o.level, o.consume);
|
||||
dicStructureConsume.set(o.structureId, map);
|
||||
// 捐献所
|
||||
let arrDonate = readFileAndParse(FILENAME.DIC_GUILD_DONATE_BASE);
|
||||
arrDonate.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.donateReward = parseDonateReward(o.donatevalue, o.honourReward, o.fundReward);
|
||||
dicDonateBase.set(o.level, _.pick(o, Object.keys(DicDonateKeys)));
|
||||
});
|
||||
arrDonate = undefined;
|
||||
|
||||
// 许愿池
|
||||
let arrWishPool = readFileAndParse(FILENAME.DIC_GUILD_WISH_POOL_BASE);
|
||||
arrWishPool.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.wishGoodsEquips = o.wishgoodsEquip.split('|').map(wishGoodsEquip=>{
|
||||
let wishGoodsEquips = wishGoodsEquip.split('&');
|
||||
return {quality: parseInt(wishGoodsEquips[0]), count: parseInt(wishGoodsEquips[1])};
|
||||
});
|
||||
o.wishGoodsHeros = o.wishgoodsHero.split('|').map(wishGoodsHero=>{
|
||||
let wishGoodsHeros = wishGoodsHero.split('&');
|
||||
return {quality: parseInt(wishGoodsHeros[0]), count: parseInt(wishGoodsHeros[1])};
|
||||
});
|
||||
dicWishPoolBase.set(o.level, _.pick(o, Object.keys(DicWishPoolKeys)));
|
||||
});
|
||||
arrWishPool = undefined;
|
||||
|
||||
// 商店
|
||||
let arrStore = readFileAndParse(FILENAME.DIC_GUILD_STORE_BASE);
|
||||
arrStore.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
o.storeGoods = parseStoreGoods(o.storeGoods);
|
||||
dicStoreBase.set(o.level, _.pick(o, Object.keys(DicStoreKeys)));
|
||||
});
|
||||
arrStore = undefined;
|
||||
|
||||
// 升级消耗
|
||||
function setStructureConsume(o) {
|
||||
let map = dicStructureConsume.get(o.structureId);
|
||||
if(!map) map = new Map<number, number>();
|
||||
map.set(o.level, o.consume);
|
||||
dicStructureConsume.set(o.structureId, map);
|
||||
}
|
||||
}
|
||||
|
||||
// {"type": number, "count": number}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 镇念塔表
|
||||
import { decodeArrayListStr, readJsonFile, parseNumberList } from '../util'
|
||||
import { decodeArrayListStr, readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicSuit {
|
||||
@@ -14,17 +14,18 @@ export interface DicSuit {
|
||||
readonly tireInfo: Array<number>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_SUIT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicSuit = new Map<number, DicSuit>();
|
||||
export function loadSuit() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_SUIT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.effect = parseSuitEffect(o.effect);
|
||||
o.tireInfo = parseNumberList(o.tireInfo);
|
||||
dicSuit.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
arr.forEach(o => {
|
||||
o.effect = parseSuitEffect(o.effect);
|
||||
o.tireInfo = parseNumberList(o.tireInfo);
|
||||
dicSuit.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseSuitEffect(str: string) {
|
||||
let result = new Array<{ count: number, seid: number }>();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 任务
|
||||
import { RewardInter } from '../interface';
|
||||
import { readJsonFile, parseNumberList, parseGoodStr } from '../util';
|
||||
import { readFileAndParse, parseNumberList, parseGoodStr } from '../util';
|
||||
import { FILENAME, TASK_FUN_TYPE} from '../../consts';
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -95,36 +95,33 @@ taskMap.set(TASK_FUN_TYPE.DAILY, dicDailyTask);
|
||||
taskMap.set(TASK_FUN_TYPE.ACHIEVEMENT, dicAchievement);
|
||||
|
||||
export const dicTaskType = new Map<number, DicTask[]>();
|
||||
export function loadTask() {
|
||||
|
||||
const mainTask = readJsonFile(FILENAME.DIC_MAIN_TASK);
|
||||
let arrMainTask = JSON.parse(mainTask);
|
||||
arrMainTask.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicMainTask.set(o.id, _.pick(o, Object.keys(DicMainTaskKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.MAIN, o);
|
||||
});
|
||||
arrMainTask = undefined;
|
||||
|
||||
const dailyTask = readJsonFile(FILENAME.DIC_DAILY_TASK);
|
||||
let arrDailyTask = JSON.parse(dailyTask);
|
||||
arrDailyTask.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicDailyTask.set(o.id, _.pick(o, Object.keys(DicDailyTaskKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.DAILY, o);
|
||||
});
|
||||
arrDailyTask = undefined;
|
||||
|
||||
const achievement = readJsonFile(FILENAME.DIC_ACHIEVEMENT);
|
||||
let arrAchievement = JSON.parse(achievement);
|
||||
arrAchievement.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicAchievement.set(o.id, _.pick(o, Object.keys(DicAchievementKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.ACHIEVEMENT, o);
|
||||
});
|
||||
arrAchievement = undefined;
|
||||
const arrMainTask = readFileAndParse(FILENAME.DIC_MAIN_TASK);
|
||||
arrMainTask.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicMainTask.set(o.id, _.pick(o, Object.keys(DicMainTaskKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.MAIN, o);
|
||||
});
|
||||
|
||||
const arrDailyTask = readFileAndParse(FILENAME.DIC_DAILY_TASK);
|
||||
arrDailyTask.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicDailyTask.set(o.id, _.pick(o, Object.keys(DicDailyTaskKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.DAILY, o);
|
||||
});
|
||||
|
||||
const arrAchievement = readFileAndParse(FILENAME.DIC_ACHIEVEMENT);
|
||||
arrAchievement.forEach(o => {
|
||||
o.taskParam = parseNumberList(o.taskParam);
|
||||
o.taskReward = parseGoodStr(o.taskReward);
|
||||
dicAchievement.set(o.id, _.pick(o, Object.keys(DicAchievementKeys)));
|
||||
pushDicTaskType(o.taskType, TASK_FUN_TYPE.ACHIEVEMENT, o);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function pushDicTaskType(taskType: number, type: number, o: any) {
|
||||
if(!dicTaskType.has(taskType)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 主线任务阶段内容
|
||||
import {readJsonFile, parseGoodStr} from '../util'
|
||||
import {readFileAndParse, parseGoodStr} from '../util'
|
||||
import { FILENAME, TASK_FUN_TYPE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -13,25 +13,25 @@ export interface DicTaskBox {
|
||||
}
|
||||
|
||||
export const dicTaskBox = new Map<number, Map<number, DicTaskBox>>();
|
||||
export function loadTaskBox() {
|
||||
|
||||
const str1 = readJsonFile(FILENAME.DIC_TASK_BOX);
|
||||
let arr1 = JSON.parse(str1);
|
||||
arr1.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
|
||||
});
|
||||
arr1 = undefined;
|
||||
|
||||
const str2 = readJsonFile(FILENAME.DIC_ACHIEVEMENT_BOX);
|
||||
let arr2 = JSON.parse(str2);
|
||||
arr2.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
|
||||
});
|
||||
arr2 = undefined;
|
||||
let arr1 = readFileAndParse(FILENAME.DIC_TASK_BOX);
|
||||
arr1.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
|
||||
});
|
||||
arr1 = undefined;
|
||||
|
||||
let arr2 = readFileAndParse(FILENAME.DIC_ACHIEVEMENT_BOX);
|
||||
arr2.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
|
||||
});
|
||||
arr2 = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 物品表
|
||||
import { decodeArrayListStr, readJsonFile, parseGoodStr } from '../util'
|
||||
import { decodeArrayListStr, readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME, ABI_TYPE} from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
@@ -25,34 +25,36 @@ export interface DicTeraph {
|
||||
readonly assiAttrValue:Map<number, number>; // 次级属性
|
||||
readonly upGradeMaterial:Array<RewardInter>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_TERAPH);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicTeraphKeys: KeysEnum<DicTeraph> = {
|
||||
id: true,
|
||||
index: true,
|
||||
grade: true,
|
||||
mainAttrMax: true,
|
||||
mainAttrUp: true,
|
||||
criRate: true,
|
||||
criEffect: true,
|
||||
upMaterial: true,
|
||||
assiAttrValue: true,
|
||||
upGradeMaterial: true,
|
||||
}
|
||||
export const dicTeraph = new Map<string, DicTeraph>();
|
||||
arr.forEach(o => {
|
||||
o.assiAttrValue = parseAttr(o.assiAttrValue);
|
||||
o.upGradeMaterial = parseGoodStr(o.upGradeMaterial);
|
||||
o.upMaterial = parseGoodStr(o.upMaterial);
|
||||
o.mainAttrMax = parseMainAttrMax(o);
|
||||
o.mainAttrUp = parseMainAttrUp(o);
|
||||
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
|
||||
});
|
||||
export function loadTeraph() {
|
||||
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_TERAPH);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicTeraphKeys: KeysEnum<DicTeraph> = {
|
||||
id: true,
|
||||
index: true,
|
||||
grade: true,
|
||||
mainAttrMax: true,
|
||||
mainAttrUp: true,
|
||||
criRate: true,
|
||||
criEffect: true,
|
||||
upMaterial: true,
|
||||
assiAttrValue: true,
|
||||
upGradeMaterial: true,
|
||||
}
|
||||
|
||||
arr.forEach(o => {
|
||||
o.assiAttrValue = parseAttr(o.assiAttrValue);
|
||||
o.upGradeMaterial = parseGoodStr(o.upGradeMaterial);
|
||||
o.upMaterial = parseGoodStr(o.upMaterial);
|
||||
o.mainAttrMax = parseMainAttrMax(o);
|
||||
o.mainAttrUp = parseMainAttrUp(o);
|
||||
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 物品表
|
||||
import { decodeArrayListStr, readJsonFile, parseGoodStr } from '../util'
|
||||
import { decodeArrayListStr, readFileAndParse, parseGoodStr } from '../util'
|
||||
import { FILENAME, ABI_TYPE} from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -19,9 +19,6 @@ export interface DicTitle {
|
||||
readonly material:Array<{id: number, number: number}>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_TITLE);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicTitleKeys: KeysEnum<DicTitle> = {
|
||||
id: true,
|
||||
@@ -31,14 +28,19 @@ const DicTitleKeys: KeysEnum<DicTitle> = {
|
||||
material: true
|
||||
}
|
||||
export const dicTitle = new Map<number, DicTitle>();
|
||||
arr.forEach(o => {
|
||||
o.mainAttrValue = parseMainAttr(o);
|
||||
o.assiAttrValue = parseAttr(o.assiAttrValue);
|
||||
o.material = parseGoodStr(o.material);
|
||||
dicTitle.set(o.id, _.pick(o, Object.keys(DicTitleKeys)));
|
||||
});
|
||||
export function loadTitle() {
|
||||
|
||||
arr = undefined;
|
||||
let arr = readFileAndParse(FILENAME.DIC_TITLE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.mainAttrValue = parseMainAttr(o);
|
||||
o.assiAttrValue = parseAttr(o.assiAttrValue);
|
||||
o.material = parseGoodStr(o.material);
|
||||
dicTitle.set(o.id, _.pick(o, Object.keys(DicTitleKeys)));
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Map<number, number>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 镇念塔表
|
||||
import {parseGoodStr, decodeArrayListStr, readJsonFile, parseNumberList} from '../util'
|
||||
import {parseGoodStr, decodeArrayListStr, readFileAndParse, parseNumberList} from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
|
||||
@@ -14,17 +14,19 @@ export interface DicTower {
|
||||
readonly rewardOfcollect: Array<RewardInter>;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_TOWER);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicTower = new Map<number, DicTower>();
|
||||
export function loadTower() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_TOWER);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.warArray = parseNumberList(o.warArray);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.rewardOfcollect = parseGoodStrOfCollect(o.rewardOfcollect);
|
||||
dicTower.set(o.towerFloor, o);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
o.warArray = parseNumberList(o.warArray);
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.rewardOfcollect = parseGoodStrOfCollect(o.rewardOfcollect);
|
||||
dicTower.set(o.towerFloor, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseGoodStrOfCollect(str: string) {
|
||||
let result = new Array<{id: number, count: number}>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 镇念塔派遣任务表
|
||||
import {parseGoodStr, decodeArrayListStr, decodeArrayStr, readJsonFile} from '../util'
|
||||
import {parseGoodStr, decodeArrayListStr, decodeArrayStr, readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts';
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -32,18 +32,19 @@ export interface DicTowerTask {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_TOWER_TASK);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicTowerTask = new Map<number, DicTowerTask>();
|
||||
export function loadTowerTask() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_TOWER_TASK);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.additionalReward = parseGoodStr(o.additionalReward);
|
||||
o.termsForAdd = parseTermsForAdd(o.termsForAdd);
|
||||
o.suitFloor = parseSuitFloor(o.suitFloor as string);
|
||||
dicTowerTask.set(o.taskId, o);
|
||||
});
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
o.additionalReward = parseGoodStr(o.additionalReward);
|
||||
o.termsForAdd = parseTermsForAdd(o.termsForAdd);
|
||||
o.suitFloor = parseSuitFloor(o.suitFloor as string);
|
||||
dicTowerTask.set(o.taskId, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseTermsForAdd(str: string) {
|
||||
let result = new Array<{type: number, param: number, count: number}>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const _ = require('lodash');
|
||||
@@ -24,27 +24,29 @@ const DicTrainSoloRewardKeys: KeysEnum<DicTrainSoloReward> = {
|
||||
failHonour: true,
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_TRAIN_SOLO_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicTrainSoloReward = new Map<number, DicTrainSoloReward>();
|
||||
arr.forEach(o => {
|
||||
o.winReward.split('|').map(cur=>{
|
||||
let arr = cur.split('&');
|
||||
if (arr[0] == 1) {
|
||||
o.winScore = parseInt(arr[1]);
|
||||
} else if (arr[0] == 2) {
|
||||
o.winHonour = parseInt(arr[1]);
|
||||
}
|
||||
})
|
||||
o.failReward.split('|').map(cur=>{
|
||||
let arr = cur.split('&');
|
||||
if (arr[0] == 1) {
|
||||
o.failScore = parseInt(arr[1]);
|
||||
} else if (arr[0] == 2) {
|
||||
o.failHonour = parseInt(arr[1]);
|
||||
}
|
||||
})
|
||||
dicTrainSoloReward.set(o.id,_.pick(o, Object.keys(DicTrainSoloRewardKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
export function loadTrainSoloReward() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_SOLO_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.winReward.split('|').map(cur=>{
|
||||
let arr = cur.split('&');
|
||||
if (arr[0] == 1) {
|
||||
o.winScore = parseInt(arr[1]);
|
||||
} else if (arr[0] == 2) {
|
||||
o.winHonour = parseInt(arr[1]);
|
||||
}
|
||||
})
|
||||
o.failReward.split('|').map(cur=>{
|
||||
let arr = cur.split('&');
|
||||
if (arr[0] == 1) {
|
||||
o.failScore = parseInt(arr[1]);
|
||||
} else if (arr[0] == 2) {
|
||||
o.failHonour = parseInt(arr[1]);
|
||||
}
|
||||
})
|
||||
dicTrainSoloReward.set(o.id,_.pick(o, Object.keys(DicTrainSoloRewardKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, decodeArrayStr, readJsonFile} from '../util'
|
||||
import {decodeArrayListStr, decodeArrayStr, readFileAndParse} from '../util'
|
||||
import { WAR_RELATE_TABLES, WAR_TYPE } from '../../consts';
|
||||
|
||||
export interface DicWar {
|
||||
@@ -37,28 +37,28 @@ export interface DicWar {
|
||||
export const dicWar = new Map<number, DicWar>();
|
||||
export const dicWarPvp = new Array<DicWar>();
|
||||
export const dicDailyWarByType = new Map<number, DicWar[]>();
|
||||
|
||||
for(let filename of WAR_RELATE_TABLES) {
|
||||
const str = readJsonFile(filename);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.fixReward = parseFixReward(o.fixReward);
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
dicWarPvp.push(o);
|
||||
} else if (o.warType == WAR_TYPE.DAILY) {
|
||||
if(!dicDailyWarByType.has(o.dailyType)) {
|
||||
dicDailyWarByType.set(o.dailyType, []);
|
||||
export function loadWar() {
|
||||
for(let filename of WAR_RELATE_TABLES) {
|
||||
let arr = readFileAndParse(filename);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.fixReward = parseFixReward(o.fixReward);
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
dicWarPvp.push(o);
|
||||
} else if (o.warType == WAR_TYPE.DAILY) {
|
||||
if(!dicDailyWarByType.has(o.dailyType)) {
|
||||
dicDailyWarByType.set(o.dailyType, []);
|
||||
}
|
||||
dicDailyWarByType.get(o.dailyType).push(o);
|
||||
}
|
||||
dicDailyWarByType.get(o.dailyType).push(o);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function parseFixReward(str: string = '') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, readWarJsonFileList} from '../util'
|
||||
import {decodeArrayListStr, readWarJsonFileAndParse} from '../util'
|
||||
|
||||
export interface DicWarJson {
|
||||
|
||||
@@ -49,18 +49,19 @@ export interface DicWarJson {
|
||||
}
|
||||
|
||||
export const dicWarJson = new Map<number, Array<DicWarJson>>();
|
||||
readWarJsonFileList().forEach(str => {
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
let warjson = new Array<DicWarJson>();
|
||||
let warid = 0;
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttribute(o.attribute);
|
||||
warid = o.warId;
|
||||
warjson.push(o);
|
||||
});
|
||||
dicWarJson.set(warid, warjson);
|
||||
})
|
||||
export function loadWarJson() {
|
||||
readWarJsonFileAndParse().forEach(arr => {
|
||||
|
||||
let warjson = new Array<DicWarJson>();
|
||||
let warid = 0;
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttribute(o.attribute);
|
||||
warid = o.warId;
|
||||
warjson.push(o);
|
||||
});
|
||||
dicWarJson.set(warid, warjson);
|
||||
})
|
||||
}
|
||||
|
||||
export function parseAttribute(str: string) {
|
||||
let result = new Array<{ id: number, val: number }>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 寻宝表
|
||||
import { readJsonFile } from '../util'
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicXunbao {
|
||||
@@ -14,10 +14,12 @@ export interface DicXunbao {
|
||||
// readonly assistanceLevel: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_XUNBAO);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicXunbao = new Map<number, DicXunbao>();
|
||||
arr.forEach(o => {
|
||||
dicXunbao.set(o.quality, o);
|
||||
});
|
||||
export function loadXunbao() {
|
||||
let arr = readFileAndParse(FILENAME.DIC_XUNBAO);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicXunbao.set(o.quality, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user