Merge branch 'feature/backend'
This commit is contained in:
@@ -56,8 +56,10 @@ app.set('name', 'chatofpomelo-websocket');
|
||||
// 加载数据库和redis
|
||||
app.configure(function () {
|
||||
app.loadConfig('database', app.getBase() + '/config/database');
|
||||
app.loadConfig('serverName', app.getBase() + '/config/serverName');
|
||||
console.log('env:', app.get('env'));
|
||||
console.log('db:', app.get('database'));
|
||||
console.log('serverName:', app.get('serverName'))
|
||||
|
||||
mongoose.connect(app.get('database').mongo, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false }, (err) => {
|
||||
if (err) {
|
||||
|
||||
23
game-server/app/servers/activity/remote/activityRemote.ts
Normal file
23
game-server/app/servers/activity/remote/activityRemote.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new ActivityRemote(app);
|
||||
}
|
||||
|
||||
export class ActivityRemote {
|
||||
|
||||
constructor(private app: Application) {
|
||||
this.app = app;
|
||||
this.channelService = app.get('channelService');
|
||||
}
|
||||
|
||||
private channelService: ChannelService;
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new BattleRemote(app);
|
||||
@@ -69,4 +70,11 @@ export class BattleRemote {
|
||||
channel.leave(uid, sid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { PrivateMessageType } from '../../../db/PrivateMessage';
|
||||
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
|
||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||
import { getWorldChannelSid, groupRoomId } from '../../../services/chatService';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new ChatRemote(app);
|
||||
@@ -188,4 +189,11 @@ export class ChatRemote {
|
||||
if (!channel) return;
|
||||
channel.pushMessage(this.RACE_ACTIVITY_START, resResult(STATUS.SUCCESS, { }));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,10 +226,25 @@ export class EntryHandler {
|
||||
// console.error('set rid for session service failed! error is : %j', err.stack);
|
||||
// }
|
||||
// });
|
||||
session.on('closed', this.onUserLeave.bind(this));
|
||||
session.on('closed', this.onGmUserLeave.bind(this));
|
||||
|
||||
// put user into channel
|
||||
return resResult(STATUS.SUCCESS);
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
serverType: this.app.get('serverName')
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* User log out handler
|
||||
*
|
||||
* @param {Object} app current application
|
||||
* @param {Object} session current session object
|
||||
*
|
||||
*/
|
||||
async onGmUserLeave(session: FrontendSession, reason: string) {
|
||||
if (!session || !session.uid) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Application, ChannelService, FrontendSession, pinus, RemoterClass } from 'pinus';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
export default function (app: Application) {
|
||||
return new ConnectorRemote(app);
|
||||
}
|
||||
@@ -34,4 +35,11 @@ export class ConnectorRemote {
|
||||
this.channelService.pushMessageByUids(route, resResult(STATUS.SUCCESS, {mails:data}), uids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { STATUS } from '../../../consts/statusCode';
|
||||
import { GMMailModel } from '../../../db/GMMail';
|
||||
import { setGmMails } from '../../../pubUtils/gmData/gmDataUtil';
|
||||
import { getRoleOnlineInfo } from '../../../services/redisService';
|
||||
import { dispatch } from '../../../util/dispatcher';
|
||||
export default function(app: Application) {
|
||||
return new GmHandler(app);
|
||||
}
|
||||
@@ -80,4 +81,49 @@ export class GmHandler {
|
||||
setGmMails([mail]);//更新邮件缓存
|
||||
this.app.rpc.role.roleRemote.sendGmMailsToRoles.toServer('role-server-1',[mail]);//检查是否是群体邮件,并下发群体邮件,非群体邮件通过Filter刷新下发
|
||||
}
|
||||
|
||||
async reloadResource(msg: {}, session: BackendSession) {
|
||||
try {
|
||||
let activityServers = this.app.getServersByType('activity');
|
||||
for(let { id } of activityServers) {
|
||||
await this.app.rpc.activity.activityRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let battleServers = this.app.getServersByType('battle');
|
||||
for(let { id } of battleServers) {
|
||||
await this.app.rpc.battle.battleRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let chatServers = this.app.getServersByType('chat');
|
||||
for(let { id } of chatServers) {
|
||||
await this.app.rpc.chat.chatRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let connectServers = this.app.getServersByType('connector');
|
||||
for(let { id } of connectServers) {
|
||||
await this.app.rpc.connector.connectorRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let guildServers = this.app.getServersByType('guild');
|
||||
for(let { id } of guildServers) {
|
||||
await this.app.rpc.guild.guildRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let roleServers = this.app.getServersByType('role');
|
||||
for(let { id } of roleServers) {
|
||||
await this.app.rpc.role.roleRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let systimerServers = this.app.getServersByType('systimer');
|
||||
for(let { id } of systimerServers) {
|
||||
await this.app.rpc.systimer.systimerRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let orderServers = this.app.getServersByType('order');
|
||||
for(let { id } of orderServers) {
|
||||
await this.app.rpc.order.orderRemote.reloadResources.toServer(id);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isOK: true
|
||||
});
|
||||
} catch(e) {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isOK: false,
|
||||
err: e.stack
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
23
game-server/app/servers/guild/remote/guildRemote.ts
Normal file
23
game-server/app/servers/guild/remote/guildRemote.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new GuildRemote(app);
|
||||
}
|
||||
|
||||
export class GuildRemote {
|
||||
|
||||
constructor(private app: Application) {
|
||||
this.app = app;
|
||||
this.channelService = app.get('channelService');
|
||||
}
|
||||
|
||||
private channelService: ChannelService;
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
23
game-server/app/servers/order/remote/orderRemote.ts
Normal file
23
game-server/app/servers/order/remote/orderRemote.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new OrderRemote(app);
|
||||
}
|
||||
|
||||
export class OrderRemote {
|
||||
|
||||
constructor(private app: Application) {
|
||||
this.app = app;
|
||||
this.channelService = app.get('channelService');
|
||||
}
|
||||
|
||||
private channelService: ChannelService;
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,15 @@ import { HeroModel, Connect } from '../../../db/Hero';
|
||||
import { CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ABI_STAGE, DEBUG_MAGIC_WORD, HERO_INITIAL_QUALITY, REDIS_KEY, TASK_TYPE } from '../../../consts';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { ItemModel } from '../../../db/Item';
|
||||
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById, getFavourLvByExp } from '../../../pubUtils/data';
|
||||
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById, getFavourLvByExp, reloadDicParam } from '../../../pubUtils/data';
|
||||
import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { getDropItems, FIGURE_UNLOCK_CONDITION } from '../../../consts/constModules/itemConst'
|
||||
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax, pushHeroWakeUp } from '../../../services/chatService';
|
||||
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||
import { Attribute } from '../../../domain/roleField/attribute';
|
||||
import { checkTaskWithHero, checkTask } from '../../../services/taskService';
|
||||
import { accomplishTask } from '../../../pubUtils/taskUtil';
|
||||
import { EQUIP } from '../../../pubUtils/dicParam';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new HeroHandler(app);
|
||||
@@ -26,39 +26,8 @@ export class HeroHandler {
|
||||
}
|
||||
|
||||
public async test(msg: {}, session: BackendSession) {
|
||||
let roles = await RoleModel.find({}).lean();
|
||||
for (let role of roles) {
|
||||
let { roleId, attr: roleAttr, topLineup } = role;
|
||||
let heros = await HeroModel.findByRole(roleId);
|
||||
let sumCe = 0;
|
||||
|
||||
let pvpdefense = await PvpDefenseModel.findByRoleId(roleId);
|
||||
let { heroes: defHeroes } = pvpdefense;
|
||||
|
||||
for (let hero of heros) {
|
||||
let { hid, attr: heroAttr } = hero;
|
||||
let attr = new Attribute();
|
||||
attr.setByDbData(roleAttr, heroAttr);
|
||||
let ce = attr.calCe();
|
||||
await HeroModel.updateHeroInfo(roleId, hid, { ce, historyCe: ce });
|
||||
sumCe += ce;
|
||||
let curHero = topLineup.find(cur => cur.hid == hid);
|
||||
if (curHero) curHero.ce = ce;
|
||||
|
||||
let curDefHero = defHeroes.find(cur => cur.actorId == hid);
|
||||
if (curDefHero) curDefHero.ce = ce;
|
||||
console.log(roleId, hid, ce, sumCe)
|
||||
}
|
||||
let topLineupCe = topLineup.reduce((pre, cur) => {
|
||||
return pre + cur.ce
|
||||
}, 0);
|
||||
let defCe = defHeroes.reduce((pre, cur) => {
|
||||
return pre + cur.ce
|
||||
}, 0);
|
||||
|
||||
await RoleModel.updateRoleInfo(roleId, { ce: sumCe, topLineup, topLineupCe });
|
||||
await PvpDefenseModel.updateInfo(roleId, { defCe, heroes: defHeroes }); // 更新pvp防守阵战力
|
||||
}
|
||||
let heroes = [...gameData.hero];
|
||||
return resResult(STATUS.SUCCESS, {heroes})
|
||||
}
|
||||
|
||||
// ! 测试接口,用来测试前清理并初始化某个武将;代码抄自:gm-server/app/service/users.ts deleteHero
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinu
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { sendRolesMails } from '../../../services/mailService';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
export default function (app: Application) {
|
||||
return new RoleRemote(app);
|
||||
}
|
||||
@@ -18,4 +19,11 @@ export class RoleRemote {
|
||||
sendGmMailsToRoles(mails) {
|
||||
sendRolesMails(mails)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Application, ChannelService } from 'pinus';
|
||||
import { resetPvpSeasonTime, setPvpDefResult, guildActivityStart, gateActivityEnd, cityActivityEnd, raceActivityEnd } from '../../../services/timeTaskService';
|
||||
import PvpDefenseType from '../../../db/PvpDefense';
|
||||
import { DicGuildActivity } from '../../../pubUtils/dictionary/DicGuildActivity';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
export default function (app: Application) {
|
||||
return new SystimerRemote(app);
|
||||
}
|
||||
@@ -37,4 +38,11 @@ export class SystimerRemote {
|
||||
public async raceActivityEnd() {
|
||||
return await raceActivityEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,22 +12,29 @@ import { GuildRemote } from './chat/remote/guildRemote';
|
||||
import { GMRemote } from './gm/remote/gmRemote';
|
||||
import { RoleRemote } from './role/remote/roleRemote';
|
||||
import { GuildActivityRemote } from './guild/remote/guildActivityRemote';
|
||||
import { GuildRemote as GuildRemote2 } from './guild/remote/guildRemote';
|
||||
import { ActivityRemote } from './activity/remote/activityRemote';
|
||||
import { OrderRemote } from './order/remote/orderRemote';
|
||||
declare global {
|
||||
interface UserRpc {
|
||||
guild: {
|
||||
guildActivityRemote: RemoterClass<FrontendSession, GuildActivityRemote>;
|
||||
},
|
||||
chat: {
|
||||
chatRemote: RemoterClass<FrontendSession, ChatRemote>;
|
||||
guildRemote: RemoterClass<FrontendSession, GuildRemote>;
|
||||
activity: {
|
||||
activityRemote: RemoterClass<FrontendSession, ActivityRemote>;
|
||||
};
|
||||
battle: {
|
||||
comBattleRemote: RemoterClass<FrontendSession, ComBattleRemote>;
|
||||
battleRemote: RemoterClass<FrontendSession, BattleRemote>;
|
||||
};
|
||||
chat: {
|
||||
chatRemote: RemoterClass<FrontendSession, ChatRemote>;
|
||||
guildRemote: RemoterClass<FrontendSession, GuildRemote>;
|
||||
};
|
||||
connector: {
|
||||
connectorRemote: RemoterClass<FrontendSession, ConnectorRemote>;
|
||||
};
|
||||
guild: {
|
||||
guildRemote: RemoterClass<FrontendSession, GuildRemote2>;
|
||||
guildActivityRemote: RemoterClass<FrontendSession, GuildActivityRemote>;
|
||||
},
|
||||
systimer: {
|
||||
systimerRemote: RemoterClass<FrontendSession, SystimerRemote>;
|
||||
},
|
||||
@@ -36,6 +43,9 @@ declare global {
|
||||
},
|
||||
role: {
|
||||
roleRemote: RemoterClass<FrontendSession, RoleRemote>;
|
||||
},
|
||||
order: {
|
||||
orderRemote: RemoterClass<FrontendSession, OrderRemote>;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
game-server/config/serverName.ts
Normal file
26
game-server/config/serverName.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
module.exports = {
|
||||
'development': {
|
||||
'type': 'development',
|
||||
'name': '本地服'
|
||||
},
|
||||
'production': {
|
||||
'type': 'production',
|
||||
'name': '正式服'
|
||||
},
|
||||
'alpha': {
|
||||
'type': 'alpha',
|
||||
'name': '测试服'
|
||||
},
|
||||
'dev': {
|
||||
'type': 'dev',
|
||||
'name': '开发服'
|
||||
},
|
||||
'isbn': {
|
||||
'type': 'isbn',
|
||||
'name': '版号服'
|
||||
},
|
||||
'monitor': {
|
||||
'type': 'monitor',
|
||||
'name': '监控服'
|
||||
}
|
||||
};
|
||||
@@ -2,14 +2,19 @@ import { Controller } from 'egg';
|
||||
import { Stream } from 'stream';
|
||||
import { STATUS } from '@consts';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const unzip = require("unzip-stream");
|
||||
const temp = require('temp');
|
||||
const compressing = require("compressing");
|
||||
const moment = require("moment");
|
||||
const pump = require('mz-modules/pump');
|
||||
|
||||
const folderName = 'hot_update_files';
|
||||
const hotUpdateAddr = `/root/${folderName}`;
|
||||
const publishPath = '/root/hot_update_backup';
|
||||
import {exec} from 'child_process'
|
||||
import { reloadResources } from '@pubUtils/data';
|
||||
const sendToWormhole = require('stream-wormhole');
|
||||
|
||||
|
||||
export default class UploadController extends Controller {
|
||||
@@ -154,46 +159,121 @@ export default class UploadController extends Controller {
|
||||
})
|
||||
}
|
||||
|
||||
private jsonFolderName = 'resource';
|
||||
private jsonFolderPath = `/root/zyz/shared/${this.jsonFolderName}`;
|
||||
private jsonFolder = '/app/resource/jsons';
|
||||
private warjsonFolder = '/app/resource/warJsons';
|
||||
private tsFolder = '/app/pubUtils';
|
||||
|
||||
private distJsonFolder = `/../game-server/dist${this.jsonFolder}`;
|
||||
private distWarjsonFolder = `/../game-server/dist${this.warjsonFolder}`;
|
||||
private distTsFolder = `/../game-server/dist${this.tsFolder}`;
|
||||
|
||||
public async uploadJson() {
|
||||
const { ctx } = this;
|
||||
const stream = await ctx.getFileStream();
|
||||
// const filename = stream.filename;
|
||||
// const target = path.join(url, filename);
|
||||
|
||||
const parts = ctx.multipart({ });
|
||||
const files = [];
|
||||
|
||||
if(stream.mimeType == 'application/zip') {
|
||||
try {
|
||||
let dirPath = await temp.mkdir(this.jsonFolderName); // 临时文件夹
|
||||
|
||||
console.log('读取文件');
|
||||
await this.doUnzipExtra(stream, dirPath);
|
||||
let files = new Array<{path:string,name:string}>();
|
||||
this.getFileList(dirPath, files);
|
||||
console.log(files);
|
||||
|
||||
console.log('保存文件');
|
||||
if (!fs.existsSync(this.jsonFolderPath)) {
|
||||
fs.mkdirSync(this.jsonFolderPath);
|
||||
try {
|
||||
let stream;
|
||||
while ((stream = await parts()) != null) {
|
||||
const filename = stream.filename;
|
||||
let filenameWithoutEx = filename?filename.split('.')[0]:'';
|
||||
if (stream.mimeType == 'application/json') {
|
||||
if (filenameWithoutEx.match(/^\d{1,}$/)) {
|
||||
let target1 = path.join(this.config.baseDir, this.warjsonFolder, filename);
|
||||
let target2 = path.join(this.config.baseDir, this.distWarjsonFolder, filename);
|
||||
const writeStream = fs.createWriteStream(target1);
|
||||
await pump(stream, writeStream);
|
||||
fs.copyFileSync(target1, target2);
|
||||
// files.push(filename);
|
||||
} else {
|
||||
let target1 = path.join(this.config.baseDir, this.jsonFolder, filename);
|
||||
let target2 = path.join(this.config.baseDir, this.distJsonFolder, filename);
|
||||
const writeStream = fs.createWriteStream(target1);
|
||||
await pump(stream, writeStream);
|
||||
fs.copyFileSync(target1, target2);
|
||||
files.push(filename);
|
||||
}
|
||||
} else if (stream.mimeType == 'application/octet-stream') {
|
||||
let target1 = path.join(this.config.baseDir, this.tsFolder, filename);
|
||||
let target2 = path.join(this.config.baseDir, this.distTsFolder, filename);
|
||||
const writeStream = fs.createWriteStream(target1);
|
||||
await pump(stream, writeStream);
|
||||
fs.copyFileSync(target1, target2);
|
||||
files.push(filename);
|
||||
}
|
||||
for (let {path, name} of files) {
|
||||
console.log(`${this.jsonFolderPath}/${name}`);
|
||||
fs.renameSync(path, `${this.jsonFolderPath}/${name}`);
|
||||
}
|
||||
|
||||
temp.cleanupSync();
|
||||
return ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
"files": JSON.stringify(files)
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return ctx.body = ctx.service.utils.resResult(STATUS.INTERNAL_ERR);
|
||||
sendToWormhole(stream);
|
||||
}
|
||||
|
||||
} else {
|
||||
return ctx.body = ctx.service.utils.resResult(STATUS.GM_UPLOAD_FORMAT_ERR);
|
||||
}catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
return ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
"files": files
|
||||
});
|
||||
|
||||
// console.log('****', stream);
|
||||
// // const filename = stream.filename;
|
||||
// // const target = path.join(url, filename);
|
||||
|
||||
// if(stream.mimeType == 'application/zip') {
|
||||
// try {
|
||||
// let dirPath = await temp.mkdir(this.jsonFolderName); // 临时文件夹
|
||||
|
||||
// console.log('读取文件');
|
||||
// await this.doUnzipExtra(stream, dirPath);
|
||||
// let files = new Array<{path:string,name:string}>();
|
||||
// this.getFileList(dirPath, files);
|
||||
// console.log(files);
|
||||
|
||||
// console.log('保存文件');
|
||||
// if (!fs.existsSync(this.jsonFolderPath)) {
|
||||
// fs.mkdirSync(this.jsonFolderPath);
|
||||
// }
|
||||
// for (let {path, name} of files) {
|
||||
// console.log(`${this.jsonFolderPath}/${name}`);
|
||||
// fs.renameSync(path, `${this.jsonFolderPath}/${name}`);
|
||||
// }
|
||||
|
||||
// temp.cleanupSync();
|
||||
// return ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
// "files": JSON.stringify(files)
|
||||
// });
|
||||
// } catch (err) {
|
||||
// console.log(err)
|
||||
// return ctx.body = ctx.service.utils.resResult(STATUS.INTERNAL_ERR);
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// return ctx.body = ctx.service.utils.resResult(STATUS.GM_UPLOAD_FORMAT_ERR);
|
||||
// }
|
||||
}
|
||||
|
||||
public async reloadResource() {
|
||||
const { ctx } = this;
|
||||
|
||||
try {
|
||||
|
||||
reloadResources();
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { isOK: true });
|
||||
return;
|
||||
} catch(e) {
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { isOK: false, err: e.stack });
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function childExec(commond: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(commond, function(error, stdout, stderr){
|
||||
if(error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
console.log('stdout: ' + stdout);
|
||||
console.log('stderr: ' + typeof stderr);
|
||||
resolve(stdout);
|
||||
});
|
||||
})
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export default (app: Application) => {
|
||||
router.get('/api/currentUser', tokenParser, controller.login.currentUser);
|
||||
router.post('/api/upload/hotupdate', tokenParser, controller.upload.upload);
|
||||
router.post('/api/upload/uploadjson', tokenParser, controller.upload.uploadJson);
|
||||
router.post('/api/upload/reloadresource', tokenParser, controller.upload.reloadResource);
|
||||
|
||||
router.post('/api/gmaccount/getgmlist', tokenParser, controller.gmaccount.getGmList);
|
||||
router.post('/api/gmaccount/createaccount',tokenParser, controller.gmaccount.createGmAccount);
|
||||
|
||||
@@ -37,7 +37,11 @@ export default (appInfo: EggAppInfo) => {
|
||||
config.multipart = {
|
||||
fileSize: '100mb',
|
||||
mode: 'stream',
|
||||
fileExtensions: ['.zip', '.tar.gz'], // 扩展几种上传的文件格式
|
||||
whitelist: [
|
||||
'.json', '.ts', '.zip'
|
||||
],
|
||||
fileExtensions: ['.json', '.ts', '.zip', '.tar.gz'], // 扩展几种上传的文件格式
|
||||
autoFields: true
|
||||
};
|
||||
|
||||
config.alinode = {
|
||||
|
||||
5
gm-server/package-lock.json
generated
5
gm-server/package-lock.json
generated
@@ -2698,6 +2698,11 @@
|
||||
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
|
||||
"dev": true
|
||||
},
|
||||
"child_process": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz",
|
||||
"integrity": "sha1-sffn/HPSXn/R1FWtyU4UODAYK1o="
|
||||
},
|
||||
"chokidar": {
|
||||
"version": "2.1.8",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"dependencies": {
|
||||
"await-stream-ready": "^1.0.1",
|
||||
"bcrypt": "^5.0.0",
|
||||
"child_process": "^1.0.2",
|
||||
"compressing": "^1.5.1",
|
||||
"csprng": "^0.1.2",
|
||||
"egg": "^2.6.1",
|
||||
@@ -35,6 +36,7 @@
|
||||
"moment": "^2.29.0",
|
||||
"pump": "^3.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"stream-wormhole": "^1.1.0",
|
||||
"temp": "^0.9.1",
|
||||
"underscore": "^1.12.0",
|
||||
"unzip-stream": "^0.3.0"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { DAILY_CONST } from './../consts';
|
||||
import { getZeroPoint } from '../pubUtils/timeUtil';
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TASK_TYPE, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityBuyRecordsModelType } from '../../db/ActivityBuyRecords';
|
||||
import { ActivityGrowthFundModelType } from '../../db/ActivityGrowthFund';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import moment = require('moment');
|
||||
import { ACTIVITY_RESOURCES_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityShopModelType } from '../../db/ActivityShop';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { SELF_SERVICE_SHOP_CELL_TYPE, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivitySelfServiceShopModelType } from '../../db/ActivitySelfServiceShop';
|
||||
import { deltaDays } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
// 自助商店数据坑位数据
|
||||
|
||||
@@ -1,85 +1,87 @@
|
||||
import { dicHero, dicMyHeroes } from "./dictionary/DicHero";
|
||||
import { dicGoods, blueprt, dicJewel, figureCondition } from "./dictionary/DicGoods";
|
||||
import { dicBlueprtCompose } from "./dictionary/DicBlueprtCompose";
|
||||
import { dicBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
|
||||
import { dicDaily } from "./dictionary/DicDaily";
|
||||
import { dicEvent, dicEventList } from "./dictionary/DicEvent";
|
||||
import { dicExpedition, DicExpedition } from "./dictionary/DicExpedition";
|
||||
import { dicExpeditionPoint } from "./dictionary/DicExpeditionPoint";
|
||||
import { dicFuncSwitch } from "./dictionary/DicFuncSwitch";
|
||||
import { dicHeroSkill } from "./dictionary/DicHeroSkill";
|
||||
import { dicJob, jobClassAndgrades, jobClassMaxGrades } from "./dictionary/DicJob";
|
||||
import { dicKingExp, maxPlayerLv } from "./dictionary/DicKingExp";
|
||||
import { dicCharExp } from "./dictionary/DicCharExp";
|
||||
import { dicQuestion } from "./dictionary/DicQuestion";
|
||||
import { dicSe } from "./dictionary/DicSe";
|
||||
import { dicTower } from "./dictionary/DicTower";
|
||||
import { dicTowerTask } from "./dictionary/DicTowerTask";
|
||||
import { dicWar, dicWarPvp, dicDailyWarByType } from "./dictionary/DicWar";
|
||||
import { dicWarJson } from "./dictionary/DicWarJson";
|
||||
import { dicXunbao } from "./dictionary/DicXunbao";
|
||||
import { dicHero, dicMyHeroes, loadHero } from "./dictionary/DicHero";
|
||||
import { dicGoods, blueprt, dicJewel, figureCondition, loadGoods } from "./dictionary/DicGoods";
|
||||
import { dicBlueprtCompose, loadBlueprtCompose } from "./dictionary/DicBlueprtCompose";
|
||||
import { dicBlueprtPossibility, loadBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
|
||||
import { dicDaily, loadDaily } from "./dictionary/DicDaily";
|
||||
import { dicEvent, dicEventList, loadEvent } from "./dictionary/DicEvent";
|
||||
import { dicExpedition, DicExpedition, loadExpedition } from "./dictionary/DicExpedition";
|
||||
import { dicExpeditionPoint, loadExpeditionPoint } from "./dictionary/DicExpeditionPoint";
|
||||
import { dicFuncSwitch, loadFuncSwitch } from "./dictionary/DicFuncSwitch";
|
||||
import { dicHeroSkill, loadHeroSkill } from "./dictionary/DicHeroSkill";
|
||||
import { dicJob, jobClassAndgrades, jobClassMaxGrades, loadJob } from "./dictionary/DicJob";
|
||||
import { dicKingExp, maxPlayerLv, loadKingExp } from "./dictionary/DicKingExp";
|
||||
import { dicCharExp, loadCharExp } from "./dictionary/DicCharExp";
|
||||
import { dicQuestion, loadQuestion } from "./dictionary/DicQuestion";
|
||||
import { dicSe, loadSe } from "./dictionary/DicSe";
|
||||
import { dicTower, loadTower } from "./dictionary/DicTower";
|
||||
import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
|
||||
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar } from "./dictionary/DicWar";
|
||||
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
|
||||
import { dicXunbao, loadXunbao } from "./dictionary/DicXunbao";
|
||||
import { SPECIAL_ATTR, COM_BTL_LV_RANGE } from "../consts";
|
||||
import { dicFashions } from "./dictionary/DicFashions";
|
||||
import { friendShips, friendShipHidAandIds } from "./dictionary/DicFriendShip";
|
||||
import { maxFriendShipLv, dicFriendShipLevelMap } from "./dictionary/DicFriendShipLevel";
|
||||
import { dicHeroQualityUp } from "./dictionary/DicHeroQualityUp";
|
||||
import { dicHeroStar } from "./dictionary/DicHeroStar";
|
||||
import { dicHeroWake } from "./dictionary/DicHeroWake";
|
||||
import { dicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
import { dicStrengthenCost } from './dictionary/DicStrengthenCost';
|
||||
import { dicRefine } from './dictionary/DicRefine';
|
||||
import { dicHeroEquip } from './dictionary/DicHeroEquip';
|
||||
import { dicSuit } from './dictionary/DicSuit';
|
||||
import { dicTitle } from './dictionary/DicTitle';
|
||||
import { dicTeraph } from './dictionary/DicTeraph';
|
||||
import { dicSchool } from './dictionary/DicSchool';
|
||||
import { dicSchoolRate } from './dictionary/DicSchoolRate';
|
||||
import { dicHeroScroll, preHeroScroll } from './dictionary/DicHeroScroll';
|
||||
import { dicPvpOpponent } from './dictionary/DicPvpOpponent';
|
||||
import { dicPvpTeamLevel } from './dictionary/DicPvpTeamLevel';
|
||||
import { dicPvpRefreshConsume, maxPvpRefreshCnt } from './dictionary/DicPvpRefreshConsume';
|
||||
import { dicGkPvp, dicGkPvps } from './dictionary/DicGkPvp';
|
||||
import { dicHeroRewads } from './dictionary/DicPvpHeroReward';
|
||||
import { dicRankRewads, dicRankMax } from './dictionary/DicPvpRankReward';
|
||||
import { dicPvpBoxs } from './dictionary/DicPvpBox';
|
||||
import { dicGuildAuth } from './dictionary/DicGuildAuth';
|
||||
import { dicCenterBase, dicEquipPriduceBase, dicBossBase, dicTrainBase, dicDonateBase, dicWishPoolBase, dicStoreBase, dicStructureConsume, dicBossBaseByBossLv } from "./dictionary/DicStructure";
|
||||
import { dicGuildActiveDayReward } from './dictionary/DicGuildActiveDayReward';
|
||||
import { dicGuildActiveWeekReward } from './dictionary/DicGuildActiveWeekReward';
|
||||
import { dicGuildActiveWays } from './dictionary/DicGuildActiveWays';
|
||||
import { dicGuildPosition } from "./dictionary/DicGuildPosition";
|
||||
import { dicMail } from "./dictionary/DicMail";
|
||||
import { dicArmyTrainJuDian } from './dictionary/DicArmyTrainJuDian';
|
||||
import { dicTrainSoloReward } from './dictionary/DicTrainSoloReward';
|
||||
import { dicFashions, loadFashions } from "./dictionary/DicFashions";
|
||||
import { friendShips, friendShipHidAandIds, loadFriendShip } from "./dictionary/DicFriendShip";
|
||||
import { maxFriendShipLv, dicFriendShipLevelMap, loadFriendShipLevel } from "./dictionary/DicFriendShipLevel";
|
||||
import { dicHeroQualityUp, loadHeroQualityUp } from "./dictionary/DicHeroQualityUp";
|
||||
import { dicHeroStar, loadHeroStar } from "./dictionary/DicHeroStar";
|
||||
import { dicHeroWake, loadHeroWake } from "./dictionary/DicHeroWake";
|
||||
import { dicRandomEffectPool, loadRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
import { dicStrengthenCost, loadStrengthenCost } from './dictionary/DicStrengthenCost';
|
||||
import { dicRefine, loadRefine } from './dictionary/DicRefine';
|
||||
import { dicHeroEquip, loadHeroEquip } from './dictionary/DicHeroEquip';
|
||||
import { dicSuit, loadSuit } from './dictionary/DicSuit';
|
||||
import { dicTitle, loadTitle } from './dictionary/DicTitle';
|
||||
import { dicTeraph, loadTeraph } from './dictionary/DicTeraph';
|
||||
import { dicSchool, loadSchool } from './dictionary/DicSchool';
|
||||
import { dicSchoolRate, loadSchoolRate } from './dictionary/DicSchoolRate';
|
||||
import { dicHeroScroll, preHeroScroll, loadHeroScroll } from './dictionary/DicHeroScroll';
|
||||
import { dicPvpOpponent, loadPvpOpponent } from './dictionary/DicPvpOpponent';
|
||||
import { dicPvpTeamLevel, loadPvpTeamLevel } from './dictionary/DicPvpTeamLevel';
|
||||
import { dicPvpRefreshConsume, maxPvpRefreshCnt, loadPvpRefreshConsume } from './dictionary/DicPvpRefreshConsume';
|
||||
import { dicGkPvp, dicGkPvps, loadGkPvp } from './dictionary/DicGkPvp';
|
||||
import { dicHeroRewads, loadPvpHeroReward } from './dictionary/DicPvpHeroReward';
|
||||
import { dicRankRewads, dicRankMax, loadPvpRankReward } from './dictionary/DicPvpRankReward';
|
||||
import { dicPvpBoxs, loadPvpBox } from './dictionary/DicPvpBox';
|
||||
import { dicGuildAuth, loadGuildAuth } from './dictionary/DicGuildAuth';
|
||||
import { dicCenterBase, dicEquipPriduceBase, dicBossBase, dicTrainBase, dicDonateBase, dicWishPoolBase, dicStoreBase, dicStructureConsume, dicBossBaseByBossLv, loadStructure } from "./dictionary/DicStructure";
|
||||
import { dicGuildActiveDayReward, loadGuildActiveDayReward } from './dictionary/DicGuildActiveDayReward';
|
||||
import { dicGuildActiveWeekReward, loadGuildActiveWeekReward } from './dictionary/DicGuildActiveWeekReward';
|
||||
import { dicGuildActiveWays, loadGuildActiveWays } from './dictionary/DicGuildActiveWays';
|
||||
import { dicGuildPosition, loadGuildPosition } from "./dictionary/DicGuildPosition";
|
||||
import { dicMail, loadMail } from "./dictionary/DicMail";
|
||||
import { dicArmyTrainJuDian, loadArmyTrainJuDian } from './dictionary/DicArmyTrainJuDian';
|
||||
import { dicTrainSoloReward, loadTrainSoloReward } from './dictionary/DicTrainSoloReward';
|
||||
import { RewardInter } from "./interface";
|
||||
import { dicArmyDevelopConsume } from '../pubUtils/dictionary/DicArmyDevelopConsume';
|
||||
import { dicArmyBossRank } from '../pubUtils/dictionary/DicArmyBossRank';
|
||||
import { dicArmyDonate } from '../pubUtils/dictionary/DicArmyDonateBoxReward';
|
||||
import { dicRoleFriend, DicRoleFriend } from "./dictionary/DicRoleFriend";
|
||||
import { dicRoleFriendLv } from "./dictionary/DicRoleFriendLv";
|
||||
import { dicArmyDevelopConsume, loadArmyDevelopConsume } from './dictionary/DicArmyDevelopConsume';
|
||||
import { dicArmyBossRank, loadArmyBossRank } from './dictionary/DicArmyBossRank';
|
||||
import { dicArmyDonate, loadArmyDonate } from './dictionary/DicArmyDonateBoxReward';
|
||||
import { dicRoleFriend, DicRoleFriend, loadRoleFriend } from "./dictionary/DicRoleFriend";
|
||||
import { dicRoleFriendLv, loadRoleFriendLv } from "./dictionary/DicRoleFriendLv";
|
||||
import { Attribute } from "../domain/roleField/attribute";
|
||||
import { dicGuildActivity, DicGuildActivity } from './dictionary/DicGuildActivity';
|
||||
import { dicGateActivityPoint } from './dictionary/DicGateActivityPoint';
|
||||
import { dicGuildAuction } from './dictionary/DicGuildAuction';
|
||||
import { dicGuildActivity, DicGuildActivity, loadGuildActivity } from './dictionary/DicGuildActivity';
|
||||
import { dicGateActivityPoint, loadGateActivityPoint } from './dictionary/DicGateActivityPoint';
|
||||
import { dicGuildAuction, loadGuildAuction } from './dictionary/DicGuildAuction';
|
||||
import { getCurDay } from "./timeUtil";
|
||||
import { dicCityActivity } from "./dictionary/DicCityActivity";
|
||||
import { dicChatAccuse } from "./dictionary/DicChatAccuse";
|
||||
import { dicCityActivityReward } from "./dictionary/DicCityActivityReward";
|
||||
import { dicRaceActivity, dicRaceTypes } from './dictionary/DicRaceActivity';
|
||||
import { dicCityActivity, loadCityActivity } from "./dictionary/DicCityActivity";
|
||||
import { dicChatAccuse, loadChatAccuse } from "./dictionary/DicChatAccuse";
|
||||
import { dicCityActivityReward, loadCityActivityReward } from "./dictionary/DicCityActivityReward";
|
||||
import { dicRaceActivity, dicRaceTypes, loadRaceActivity } from './dictionary/DicRaceActivity';
|
||||
import { GUILDACTIVITY, RECRUIT } from "./dicParam";
|
||||
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandValueByMinMax, getRandEelm } from "./util";
|
||||
import * as param from "./dicParam";
|
||||
import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandValueByMinMax, getRandEelm, readTsFile } from "./util";
|
||||
import { RACE_EVENT_TYPE } from "../consts";
|
||||
import { dicShop, dicShopItem } from "./dictionary/DicShop";
|
||||
import { dicShopList } from "./dictionary/DicShopList";
|
||||
import { dicRank } from "./dictionary/DicRank";
|
||||
import { dicRankReward } from "./dictionary/DicRankReward";
|
||||
import { dicTaskType, taskMap, dicMainTask, dicDailyTask, dicAchievement } from "./dictionary/DicTask";
|
||||
import { dicMainTaskStage } from "./dictionary/DicMainTaskStage";
|
||||
import { dicTaskBox } from './dictionary/DicTaskBox';
|
||||
import { dicGacha } from "./dictionary/DicGacha";
|
||||
import { dicGachaContent, dicGachaContentHero } from "./dictionary/DicGachaContent";
|
||||
import { dicGiftPackage } from "./dictionary/DicGiftPackage";
|
||||
import { dicRecruit } from './dictionary/DicRecruit';
|
||||
import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
|
||||
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
|
||||
import { dicRank, loadRank } from "./dictionary/DicRank";
|
||||
import { dicRankReward, loadRankReward } from "./dictionary/DicRankReward";
|
||||
import { dicTaskType, taskMap, dicMainTask, dicDailyTask, dicAchievement, loadTask } from "./dictionary/DicTask";
|
||||
import { dicMainTaskStage, loadMainTaskStage } from "./dictionary/DicMainTaskStage";
|
||||
import { dicTaskBox, loadTaskBox } from './dictionary/DicTaskBox';
|
||||
import { dicGacha, loadGacha } from "./dictionary/DicGacha";
|
||||
import { dicGachaContent, dicGachaContentHero, loadGachaContent } from "./dictionary/DicGachaContent";
|
||||
import { dicGiftPackage, loadGiftPackage } from "./dictionary/DicGiftPackage";
|
||||
import { dicRecruit, loadRecruit } from './dictionary/DicRecruit';
|
||||
import { loadRMB } from './dictionary/DicRMB';
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -173,9 +175,9 @@ export const gameData = {
|
||||
cityActivityReward: dicCityActivityReward,
|
||||
raceActivityEvents: dicRaceActivity,
|
||||
raceTypes: dicRaceTypes,
|
||||
raceActivityEncounter: decodeRaceActivityEncounter(),
|
||||
raceNormalItems: decodeRaceNormalItems(),
|
||||
raceEventItems: decodeRaceEventItems(),
|
||||
raceActivityEncounter: { events: new Map<number, number>(), eventNum: 0 },
|
||||
raceNormalItems: new Array<{id: number, min: number, max: number}>(),
|
||||
raceEventItems: new Array<{id: number, count: number}>(),
|
||||
shop: dicShop,
|
||||
shopItem: dicShopItem,
|
||||
shopList: dicShopList,
|
||||
@@ -192,11 +194,11 @@ export const gameData = {
|
||||
gacha: dicGacha,
|
||||
gachaContent: dicGachaContent,
|
||||
gachaContentHero: dicGachaContentHero,
|
||||
gachaHope: getGachaHopePercent(),
|
||||
gachaTurntable: getGachaTurntablePercent(),
|
||||
heroTransPiece: getHeroTransPiece(),
|
||||
gachaHope: new Array<{id: number, weight: number}>(),
|
||||
gachaTurntable: new Array<{quality: number, count: number}>(),
|
||||
heroTransPiece: new Map<number, number>(),
|
||||
giftPackage: dicGiftPackage,
|
||||
comBtlLvRange: parseComBtlLvRange(),
|
||||
comBtlLvRange: new Map<number, Array<number>>(),
|
||||
recruit: dicRecruit
|
||||
};
|
||||
|
||||
@@ -331,7 +333,7 @@ function parseComBtlLvRange() {
|
||||
}
|
||||
map.set(range.id, lvs);
|
||||
});
|
||||
return map
|
||||
gameData.comBtlLvRange = map
|
||||
}
|
||||
|
||||
export function comBtlRangeByLv(lv: number) {
|
||||
@@ -588,7 +590,7 @@ function decodeRaceActivityEncounter() {
|
||||
if (value == RACE_EVENT_TYPE.EVENT) eventNum++;
|
||||
newMap.set(parseInt(key), value);
|
||||
}
|
||||
return { events: newMap, eventNum };
|
||||
gameData.raceActivityEncounter = { events: newMap, eventNum };
|
||||
}
|
||||
|
||||
function decodeRaceNormalItems() {
|
||||
@@ -603,12 +605,12 @@ function decodeRaceNormalItems() {
|
||||
}
|
||||
result.push({ id: parseInt(id), min: parseInt(min), max: parseInt(max) });
|
||||
}
|
||||
return result
|
||||
gameData.raceNormalItems = result;
|
||||
}
|
||||
|
||||
function decodeRaceEventItems() {
|
||||
let str = GUILDACTIVITY.RACEACTIVITY_EVENT_ITEMS || "";
|
||||
return parseGoodStr(str);
|
||||
gameData.raceEventItems = parseGoodStr(str);
|
||||
}
|
||||
|
||||
export function getRaceEventItems() {
|
||||
@@ -639,7 +641,7 @@ export function getRandExpedition(cnt = 1) {
|
||||
// 抽卡心愿单概率
|
||||
function getGachaHopePercent() {
|
||||
let arr = decodeArrayListStr(RECRUIT.RECRUIT_WISH_LIST);
|
||||
return arr.map(cur => {
|
||||
gameData.gachaHope = arr.map(cur => {
|
||||
return { id: parseInt(cur[0]), weight: parseInt(cur[1]) }
|
||||
});
|
||||
}
|
||||
@@ -647,7 +649,7 @@ function getGachaHopePercent() {
|
||||
// 抽卡转盘概率
|
||||
function getGachaTurntablePercent() {
|
||||
let arr = decodeArrayListStr(RECRUIT.RECRUIT_BONUS_HERO_QUANTITY);
|
||||
return arr.map(cur => {
|
||||
gameData.gachaTurntable = arr.map(cur => {
|
||||
return { quality: parseInt(cur[0]), count: parseInt(cur[1]) }
|
||||
});
|
||||
}
|
||||
@@ -658,5 +660,140 @@ function getHeroTransPiece() {
|
||||
for (let [id, count] of map) {
|
||||
newMap.set(parseInt(id), count);
|
||||
}
|
||||
return newMap
|
||||
}
|
||||
gameData.heroTransPiece = newMap
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
loadDatas();
|
||||
}
|
||||
|
||||
// 解析一部分dicParam的数据
|
||||
function parseDicParam() {
|
||||
decodeRaceActivityEncounter();
|
||||
decodeRaceNormalItems();
|
||||
decodeRaceEventItems();
|
||||
getGachaHopePercent();
|
||||
getGachaTurntablePercent();
|
||||
getHeroTransPiece();
|
||||
parseComBtlLvRange();
|
||||
}
|
||||
|
||||
// 加载json
|
||||
function loadDatas() {
|
||||
loadHero();
|
||||
loadGoods();
|
||||
loadBlueprtCompose();
|
||||
loadBlueprtPossibility();
|
||||
loadDaily();
|
||||
loadEvent();
|
||||
loadExpedition();
|
||||
loadExpeditionPoint();
|
||||
loadFuncSwitch();
|
||||
loadHeroSkill();
|
||||
loadJob();
|
||||
loadKingExp();
|
||||
loadCharExp();
|
||||
loadQuestion();
|
||||
loadSe();
|
||||
loadTower();
|
||||
loadTowerTask();
|
||||
loadWar();
|
||||
loadWarJson();
|
||||
loadXunbao();
|
||||
loadFashions();
|
||||
loadFriendShip();
|
||||
loadFriendShipLevel();
|
||||
loadHeroQualityUp();
|
||||
loadHeroStar();
|
||||
loadHeroWake();
|
||||
loadRandomEffectPool();
|
||||
loadStrengthenCost();
|
||||
loadRefine();
|
||||
loadHeroEquip();
|
||||
loadSuit();
|
||||
loadTitle();
|
||||
loadTeraph();
|
||||
loadSchool();
|
||||
loadSchoolRate();
|
||||
loadHeroScroll();
|
||||
loadPvpOpponent();
|
||||
loadPvpTeamLevel();
|
||||
loadPvpRefreshConsume();
|
||||
loadGkPvp();
|
||||
loadPvpHeroReward();
|
||||
loadPvpRankReward();
|
||||
loadPvpBox();
|
||||
loadGuildAuth();
|
||||
loadStructure();
|
||||
loadGuildActiveDayReward();
|
||||
loadGuildActiveWeekReward();
|
||||
loadGuildActiveWays();
|
||||
loadGuildPosition();
|
||||
loadMail();
|
||||
loadArmyTrainJuDian();
|
||||
loadTrainSoloReward();
|
||||
loadArmyDevelopConsume();
|
||||
loadArmyBossRank();
|
||||
loadArmyDonate();
|
||||
loadRoleFriend();
|
||||
loadRoleFriendLv();
|
||||
loadGuildActivity();
|
||||
loadGateActivityPoint();
|
||||
loadGuildAuction();
|
||||
loadCityActivity();
|
||||
loadChatAccuse();
|
||||
loadCityActivityReward();
|
||||
loadRaceActivity();
|
||||
loadShop();
|
||||
loadShopList();
|
||||
loadRank();
|
||||
loadRankReward();
|
||||
loadTask();
|
||||
loadMainTaskStage();
|
||||
loadTaskBox();
|
||||
loadGacha();
|
||||
loadGachaContent();
|
||||
loadGiftPackage();
|
||||
loadRecruit();
|
||||
loadRMB();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
export function reloadDicParam() {
|
||||
let file = readTsFile('dicParam');
|
||||
if(file) {
|
||||
let lines = file.split('\n');
|
||||
let outer = '';
|
||||
lines.forEach(line => {
|
||||
if(line.replace(/ /g, '')) {
|
||||
if(line.indexOf('export') != -1) {
|
||||
outer = line.split(' ')[2];
|
||||
// console.log(outer)
|
||||
}
|
||||
if(line.indexOf('export') == -1 && line.indexOf('}') == -1) {
|
||||
let s = line.split(', //')[0].split(':');
|
||||
let key = s[0].replace(/ /g, '');
|
||||
let value = s[1].replace(/ /g, '');
|
||||
let isString = value.match(/(?<=')[^']*/);
|
||||
if(isString) {
|
||||
param[outer][key] = isString[0];
|
||||
} else {
|
||||
param[outer][key] = parseFloat(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parseDicParam();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 后台调用重载资源
|
||||
export function reloadResources() {
|
||||
loadDatas();
|
||||
reloadDicParam();
|
||||
}
|
||||
|
||||
initDatas();
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicArmyBossRank {
|
||||
readonly id: number;
|
||||
readonly rankMin: number;
|
||||
readonly rankMax: number;
|
||||
readonly reward: Array<RewardInter>;
|
||||
}
|
||||
|
||||
const DicArmyBossRankKeys: KeysEnum<DicArmyBossRank> = {
|
||||
id: true,
|
||||
rankMin: true,
|
||||
rankMax: true,
|
||||
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;
|
||||
@@ -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 = '') {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user