From d06acfecee0ffa53c8eeeecae58887bfd3da7032 Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 19 May 2023 17:53:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E7=BA=BF=E4=B8=8A=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4):=20json=E7=BA=BF=E4=B8=8A=E6=9B=B4=E6=96=B0=E6=96=B9?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../servers/activity/remote/activityRemote.ts | 32 +- .../app/servers/battle/remote/battleRemote.ts | 31 +- .../app/servers/chat/remote/chatRemote.ts | 32 +- .../comBattle/remote/comBattleRemote.ts | 32 +- .../connector/remote/connectorRemote.ts | 32 +- game-server/app/servers/gm/remote/gmRemote.ts | 39 +- .../app/servers/guild/remote/guildRemote.ts | 32 +- .../app/servers/order/remote/orderRemote.ts | 32 +- .../app/servers/role/remote/roleRemote.ts | 31 +- .../servers/systimer/remote/systimerRemote.ts | 32 +- shared/pubUtils/data.ts | 488 +++++++++++------- 11 files changed, 600 insertions(+), 213 deletions(-) diff --git a/game-server/app/servers/activity/remote/activityRemote.ts b/game-server/app/servers/activity/remote/activityRemote.ts index 7f0e3f9d3..6acf8bb18 100644 --- a/game-server/app/servers/activity/remote/activityRemote.ts +++ b/game-server/app/servers/activity/remote/activityRemote.ts @@ -1,7 +1,7 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; import { ActivityModel, ActivityModelType } from '../../../db/Activity'; import { ServerlistModel } from '../../../db/Serverlist'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { taflush } from '../../../services/sdkService'; import { ActivityInRemote } from '../../../domain/activityField/activityField'; @@ -13,6 +13,7 @@ import { setApiIsClose } from '../../../services/chatService'; import { setKvToMemory } from '../../../services/pushService'; import { sendPublicAccountGift } from '../../../services/activity/bindPhoneService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -31,9 +32,26 @@ export class ActivityRemote { /** * 重载json资源 */ - public async reloadResources() { + public reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } @@ -183,4 +201,12 @@ export class ActivityRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/battle/remote/battleRemote.ts b/game-server/app/servers/battle/remote/battleRemote.ts index 36e39bd3f..8f35feca7 100644 --- a/game-server/app/servers/battle/remote/battleRemote.ts +++ b/game-server/app/servers/battle/remote/battleRemote.ts @@ -1,6 +1,6 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; import { PVPConfigModel, PVPConfigType } from '../../../db/PvpConfig'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { setApiIsClose } from '../../../services/chatService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { setServerGroup } from '../../../services/serverService'; @@ -11,6 +11,7 @@ import { taflush } from '../../../services/sdkService'; import { setPvpSeasonNum, setPvpSettleSeasonNum } from '../../../services/timeTaskService'; import { errlogger } from '../../../util/logger'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -86,14 +87,30 @@ export class BattleRemote { /** * 重载json资源 */ - public async reloadResources() { + public reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } public async setPvpSettleSeasonNum(pvpConfig: PVPConfigType) { try { @@ -190,4 +207,12 @@ export class BattleRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/chat/remote/chatRemote.ts b/game-server/app/servers/chat/remote/chatRemote.ts index 91bfea7dc..9231be1d0 100644 --- a/game-server/app/servers/chat/remote/chatRemote.ts +++ b/game-server/app/servers/chat/remote/chatRemote.ts @@ -1,5 +1,5 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { _checkFilterWords, taflush } from '../../../services/sdkService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { errlogger } from '../../../util/logger'; @@ -7,6 +7,7 @@ import { addUserToChannel, sendMessageToChannel, sendMessgeToChannelByBatch, set import { setApiIsClose } from '../../../services/chatService'; import { setServerGroup } from '../../../services/serverService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -103,9 +104,26 @@ export class ChatRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } @@ -182,4 +200,12 @@ export class ChatRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } diff --git a/game-server/app/servers/comBattle/remote/comBattleRemote.ts b/game-server/app/servers/comBattle/remote/comBattleRemote.ts index 06777bcbf..83b93becb 100644 --- a/game-server/app/servers/comBattle/remote/comBattleRemote.ts +++ b/game-server/app/servers/comBattle/remote/comBattleRemote.ts @@ -9,7 +9,8 @@ import { setApiIsClose } from '../../../services/chatService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; import { setKvToMemory } from '../../../services/pushService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -109,11 +110,36 @@ export class ComBattleRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/connector/remote/connectorRemote.ts b/game-server/app/servers/connector/remote/connectorRemote.ts index fdcaeec09..de78255e7 100644 --- a/game-server/app/servers/connector/remote/connectorRemote.ts +++ b/game-server/app/servers/connector/remote/connectorRemote.ts @@ -1,5 +1,5 @@ import { Application, HandlerService, } from 'pinus'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { UserGuildType } from '../../../db/UserGuild'; import { incServerNum, kickUser } from '../../../services/connectorService'; import { PVPConfigModel, PVPConfigType } from '../../../db/PvpConfig'; @@ -14,6 +14,7 @@ import { setPvpSeasonNum, setPvpSettleSeasonNum } from '../../../services/timeTa import { setKvToMemory } from '../../../services/pushService'; import { setServerGroup } from '../../../services/serverService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -75,9 +76,26 @@ export class ConnectorRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } @@ -211,4 +229,12 @@ export class ConnectorRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } diff --git a/game-server/app/servers/gm/remote/gmRemote.ts b/game-server/app/servers/gm/remote/gmRemote.ts index 5bededb45..7f7a80f5b 100644 --- a/game-server/app/servers/gm/remote/gmRemote.ts +++ b/game-server/app/servers/gm/remote/gmRemote.ts @@ -2,6 +2,8 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; import { setServerGroup } from '../../../services/serverService'; import { errlogger } from '../../../util/logger'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import { gameData, reloadResources } from '../../../pubUtils/data'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -44,5 +46,40 @@ export class GMRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } - + + /** + * 重载json资源 + */ + public async reloadResources(type?: string) { + try { + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/guild/remote/guildRemote.ts b/game-server/app/servers/guild/remote/guildRemote.ts index 54add1a2b..c0962797d 100644 --- a/game-server/app/servers/guild/remote/guildRemote.ts +++ b/game-server/app/servers/guild/remote/guildRemote.ts @@ -1,5 +1,5 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { taflush, treatGuildName } from '../../../services/sdkService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { errlogger } from '../../../util/logger'; @@ -13,6 +13,7 @@ import { updateLeagueNameMem, updateTeamRoleInfoMem } from '../../../services/gv import { resetPeriodTime, setPeriodTime } from '../../../services/gvg/gvgFightService'; import { setServerGroup } from '../../../services/serverService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -28,9 +29,26 @@ export class GuildRemote { /** * 重载json资源 */ - public async reloadResources() { + public reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } @@ -211,4 +229,12 @@ export class GuildRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/order/remote/orderRemote.ts b/game-server/app/servers/order/remote/orderRemote.ts index 4760e05a7..c82cd6e4f 100644 --- a/game-server/app/servers/order/remote/orderRemote.ts +++ b/game-server/app/servers/order/remote/orderRemote.ts @@ -1,5 +1,5 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { refundOrderFromRedisPub, settleOrderFromRedisPub } from '../../../services/orderService'; import { getServerMainten, setServerMainten, stopServerMainten } from '../../../services/gmService'; import { taflush } from '../../../services/sdkService'; @@ -7,6 +7,7 @@ import { errlogger } from '../../../util/logger'; import { setApiIsClose } from '../../../services/chatService'; import { setKvToMemory } from '../../../services/pushService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -25,14 +26,31 @@ export class OrderRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + public async settleOrderFromRedisPub(message: string) { try { await settleOrderFromRedisPub(message); @@ -104,4 +122,12 @@ export class OrderRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } \ No newline at end of file diff --git a/game-server/app/servers/role/remote/roleRemote.ts b/game-server/app/servers/role/remote/roleRemote.ts index 6d2613a6d..7389b0e8b 100644 --- a/game-server/app/servers/role/remote/roleRemote.ts +++ b/game-server/app/servers/role/remote/roleRemote.ts @@ -1,6 +1,6 @@ import { Application, ChannelService, HandlerService, } from 'pinus'; // import { sendRolesMails } from '../../../services/mailService'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { RankFirstModel, RankFirstType } from '../../../db/RankFirst'; import { PVPConfigModel, PVPConfigType } from '../../../db/PvpConfig'; import { treatRoleName, taflush, sendSurveyMail, sendGiftCodeMail } from '../../../services/sdkService'; @@ -14,6 +14,7 @@ import { DEBUG_MAGIC_WORD, MAIL_TYPE } from '../../../consts'; import { ActivityTimeLimitRankModel } from '../../../db/ActivityTimeLimitRank'; import { RoleModel } from '../../../db/Role'; import { sendMailToManyPlayerByContent } from '../../../services/mailService'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { new HandlerService(app, {}); @@ -67,14 +68,30 @@ export class RoleRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } public async setPvpSeasonNum(pvpConfig: PVPConfigType) { try { @@ -197,4 +214,12 @@ export class RoleRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } diff --git a/game-server/app/servers/systimer/remote/systimerRemote.ts b/game-server/app/servers/systimer/remote/systimerRemote.ts index 8e49cf72f..fba5b3555 100644 --- a/game-server/app/servers/systimer/remote/systimerRemote.ts +++ b/game-server/app/servers/systimer/remote/systimerRemote.ts @@ -2,7 +2,7 @@ import { Application, ChannelService } from 'pinus'; import { guildActivityStart, gateActivityEnd, cityActivityEnd, raceActivityEnd, guildActivitySchedule, auctionSchedule, initMaintenance, stopMaintenance, addMailsToSchedule, updateTimeLimitRank, setLadderCountDown, cancelLadderCountDown, initSumSchedule, setPvpSeasonSchedule, initGVGConfigSchedule, gvgBattleStartSchedule, gvgBattleEndSchedule } from '../../../services/timeTaskService'; import PvpDefenseType from '../../../db/PvpDefense'; import { DicGuildActivity } from '../../../pubUtils/dictionary/DicGuildActivity'; -import { reloadResources } from '../../../pubUtils/data'; +import { gameData, reloadResources } from '../../../pubUtils/data'; import { setMarquee, cancelMarquee } from '../../../services/gmService'; import { setDicAuctionTime, setDicGuildActivity } from '../../../services/guildActivity/guildActivityService'; import { setWeek } from '../../../pubUtils/timeUtil'; @@ -20,6 +20,7 @@ import { setApiIsClose } from '../../../services/chatService'; import { setKvToMemory } from '../../../services/pushService'; import { setServerGroup } from '../../../services/serverService'; import { setHiddenData } from '../../../services/memoryCache/hiddenData'; +import * as dicParam from '../../../pubUtils/dicParam'; export default function (app: Application) { return new SystimerRemote(app); @@ -68,9 +69,26 @@ export class SystimerRemote { /** * 重载json资源 */ - public async reloadResources() { + public async reloadResources(type?: string) { try { - reloadResources(); + reloadResources(type); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setDicParam(field1: string, field2: string, value: string|number) { + try { + if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value; + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } + + public async setGameDataToApp() { + try { + this.app.set('gameData', gameData); + this.app.set('dicParam', dicParam); } catch(e) { errlogger.error(`remote ${__filename} \n ${e.stack}`); } @@ -275,4 +293,12 @@ export class SystimerRemote { errlogger.error(`remote ${__filename} \n ${e.stack}`); } } + + public async fun() { + try { + console.log('预留一个函数,用于之后线上维护时需要使用'); + } catch(e) { + errlogger.error(`remote ${__filename} \n ${e.stack}`); + } + } } diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index a04481bb2..aaed8e726 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -57,7 +57,7 @@ import { dicCityActivityReward, loadCityActivityReward } from "./dictionary/DicC import { dicRaceActivity, dicRaceTypes, loadRaceActivity } from './dictionary/DicRaceActivity'; import { GUILDACTIVITY, RECRUIT } from "./dicParam"; import * as param from "./dicParam"; -import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, readTsFile, getRandSingleEelm, parseNumberList } from "./util"; +import { decodeIdCntArrayStr, parseGoodStr, decodeArrayListStr, getRandEelm, getRandSingleEelm, parseNumberList } from "./util"; import { RACE_EVENT_TYPE } from "../consts"; import { dicShopByType, dicShopItem, loadShop } from "./dictionary/DicShop"; import { dicShopType, loadShopType } from "./dictionary/DicShopType"; @@ -1278,26 +1278,47 @@ function initDatas() { } // 解析一部分dicParam的数据 -function parseDicParam() { - decodeRaceActivityEncounter(); - decodeRaceNormalItems(); - decodeRaceEventItems(); - getGachaHopePercent(); - getGachaTurntablePercent(); - getGachaPickHeroCnt(); - getHeroTransPiece(); - parseComBtlLvRange(); - getCeRatio(); - loadAuctionTime(); - decodeLadderBuyCost(); - parseComBattleRewardTime(); - parseGVGActive(); - parseGVGFieldAdd(); - parseGVGVestigeCnt(); - parseGVGDurabilityMinus(); - parseGVGTeamDurability(); - parseGVGReviveCoin(); - parseQuitGuildTime(); +function parseDicParam(type?: string) { + if(type == undefined || type == 'decodeRaceActivityEncounter') + decodeRaceActivityEncounter(); + if(type == undefined || type == 'decodeRaceNormalItems') + decodeRaceNormalItems(); + if(type == undefined || type == 'decodeRaceEventItems') + decodeRaceEventItems(); + if(type == undefined || type == 'getGachaHopePercent') + getGachaHopePercent(); + if(type == undefined || type == 'getGachaTurntablePercent') + getGachaTurntablePercent(); + if(type == undefined || type == 'getGachaPickHeroCnt') + getGachaPickHeroCnt(); + if(type == undefined || type == 'getHeroTransPiece') + getHeroTransPiece(); + if(type == undefined || type == 'parseComBtlLvRange') + parseComBtlLvRange(); + if(type == undefined || type == 'getCeRatio') + getCeRatio(); + if(type == undefined || type == 'loadAuctionTime') + loadAuctionTime(); + if(type == undefined || type == 'decodeLadderBuyCost') + decodeLadderBuyCost(); + if(type == undefined || type == 'parseComBattleRewardTime') + parseComBattleRewardTime(); + if(type == undefined || type == 'parseGVGActive') + parseGVGActive(); + if(type == undefined || type == 'parseGVGFieldAdd') + parseGVGFieldAdd(); + if(type == undefined || type == 'parseGVGVestigeCnt') + parseGVGVestigeCnt(); + if(type == undefined || type == 'parseGVGDurabilityMinus') + parseGVGDurabilityMinus(); + if(type == undefined || type == 'parseGVGTeamDurability') + parseGVGTeamDurability(); + if(type == undefined || type == 'parseGVGReviveCoin') + parseGVGReviveCoin(); + if(type == undefined || type == 'parseQuitGuildTime') + parseQuitGuildTime(); + + console.log('loadDicParam type: ', type||'all'); } /** @@ -1362,174 +1383,271 @@ function parseComBattleRewardTime() { } // 加载json -function loadDatas() { - loadHero(); - loadGoods(); - loadDaily(); - loadEvent(); - loadExpedition(); - loadExpeditionPoint(); - loadJob(); - loadKingExp(); - loadCharExp(); - loadQuestion(); - loadSe(); - loadTower(); - loadTowerTask(); - loadTowerGift(); - loadWar(); - loadWarJson(); - loadFashions(); - loadFriendShip(); - loadHeroQualityUp(); - loadHeroStar(); - loadHeroWake(); - loadRandomEffectPool(); - loadTitle(); - loadTeraph(); - loadSchool(); - loadSchoolRate(); - loadHeroScroll(); - loadPvpOpponent(); - loadPvpTeamLevel(); - loadPvpRefreshConsume(); - 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(); - loadShopType(); - loadRank(); - loadRankReward(); - loadTask(); - loadMainTaskStage(); - loadTaskBox(); - loadGacha(); - loadGachaPlan(); - loadGachaFloor(); - loadGiftPackage(); - loadGiftPackagePlan(); - loadGiftPackageFloor(); - loadRecruit(); - loadRMB(); - loadActivityType(); - loadTaskType(); - loadServerName(); - loadAp(); - loadApBuy(); - loadKingExpRatio(); - loadEquipAttributeRatio(); - loadHoliday(); - loadExpeditionSubAttr(); - loadAuctionReward(); - loadGuildTrainInfo(); - loadPvpDifficultRatio(); - loadWhiteIp(); - treatTaskGroup(); - loadGuildWishReward(); - loadApi(); - loadServerConst(); - loadEquip(); - loadEquipStrength(); - loadEquipQuality(); - loadEquipStar(); - loadEquipSuit(); - loadEquipQualityExtra(); - loadJewel(); - loadStone(); - loadJewelCondition(); - loadMainStarBox(); - loadHeroTalent(); - loadEquipStrengthAttr(); - loadTowerPvpSubAttr(); - loadSystemOpenTime(); - loadRandomEffectPoolPlan(); - loadMainWarReward(); - loadLadderMatch(); - loadLadderDifficultRatio(); - loadLadderRankReward(); - loadGeneralGoods(); - loadArtifact(); - loadArtifactLvPlan(); - loadArtifactQuality(); - loadArtifactQualityPlan(); - loadArtifactSeid(); - loadGVGPeriod(); - loadGVGTech(); - loadGVGItem(); - loadGVGLeagueLv(); - loadGVGResourceBase(); - loadGVGContributeBox(); - loadGVGArea(); - loadGVGCityAdd(); - loadGVGTask(); - loadGVGVestigeType(); - loadGVGVestige(); - loadGVGVestigeRange(); - loadGVGVestigeLeagueRank(); - loadGVGVestigePlayerRank(); - loadGVGAreaPoint(); - loadGVGBattleRankReward(); - loadPushMessage(); -} - -// 重载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]; - let key = s.slice(0, s.indexOf(':')).replace(/ /g, ''); - let value = s.slice(s.indexOf(':' + 1)).replace(/ /g, ''); - let isString = value.match(/(?<=')[^']*/); - if(!param[outer]) { - param[outer] = {} - } - if(isString) { - param[outer][key] = isString[0]; - } else { - param[outer][key] = parseFloat(value); - } - } - } - }); - parseDicParam(); - } +function loadDatas(type?: string) { + if(type == undefined || type == 'loadHero') + loadHero(); + if(type == undefined || type == 'loadGoods') + loadGoods(); + if(type == undefined || type == 'loadDaily') + loadDaily(); + if(type == undefined || type == 'loadEvent') + loadEvent(); + if(type == undefined || type == 'loadExpedition') + loadExpedition(); + if(type == undefined || type == 'loadExpeditionPoint') + loadExpeditionPoint(); + if(type == undefined || type == 'loadJob') + loadJob(); + if(type == undefined || type == 'loadKingExp') + loadKingExp(); + if(type == undefined || type == 'loadCharExp') + loadCharExp(); + if(type == undefined || type == 'loadQuestion') + loadQuestion(); + if(type == undefined || type == 'loadSe') + loadSe(); + if(type == undefined || type == 'loadTower') + loadTower(); + if(type == undefined || type == 'loadTowerTask') + loadTowerTask(); + if(type == undefined || type == 'loadTowerGift') + loadTowerGift(); + if(type == undefined || type == 'loadWar') + loadWar(); + if(type == undefined || type == 'loadWarJson') + loadWarJson(); + if(type == undefined || type == 'loadFashions') + loadFashions(); + if(type == undefined || type == 'loadFriendShip') + loadFriendShip(); + if(type == undefined || type == 'loadHeroQualityUp') + loadHeroQualityUp(); + if(type == undefined || type == 'loadHeroStar') + loadHeroStar(); + if(type == undefined || type == 'loadHeroWake') + loadHeroWake(); + if(type == undefined || type == 'loadRandomEffectPool') + loadRandomEffectPool(); + if(type == undefined || type == 'loadTitle') + loadTitle(); + if(type == undefined || type == 'loadTeraph') + loadTeraph(); + if(type == undefined || type == 'loadSchool') + loadSchool(); + if(type == undefined || type == 'loadSchoolRate') + loadSchoolRate(); + if(type == undefined || type == 'loadHeroScroll') + loadHeroScroll(); + if(type == undefined || type == 'loadPvpOpponent') + loadPvpOpponent(); + if(type == undefined || type == 'loadPvpTeamLevel') + loadPvpTeamLevel(); + if(type == undefined || type == 'loadPvpRefreshConsume') + loadPvpRefreshConsume(); + if(type == undefined || type == 'loadPvpHeroReward') + loadPvpHeroReward(); + if(type == undefined || type == 'loadPvpRankReward') + loadPvpRankReward(); + if(type == undefined || type == 'loadPvpBox') + loadPvpBox(); + if(type == undefined || type == 'loadGuildAuth') + loadGuildAuth(); + if(type == undefined || type == 'loadStructure') + loadStructure(); + if(type == undefined || type == 'loadGuildActiveDayReward') + loadGuildActiveDayReward(); + if(type == undefined || type == 'loadGuildActiveWeekReward') + loadGuildActiveWeekReward(); + if(type == undefined || type == 'loadGuildActiveWays') + loadGuildActiveWays(); + if(type == undefined || type == 'loadGuildPosition') + loadGuildPosition(); + if(type == undefined || type == 'loadMail') + loadMail(); + if(type == undefined || type == 'loadArmyTrainJuDian') + loadArmyTrainJuDian(); + if(type == undefined || type == 'loadTrainSoloReward') + loadTrainSoloReward(); + if(type == undefined || type == 'loadArmyDevelopConsume') + loadArmyDevelopConsume(); + if(type == undefined || type == 'loadArmyBossRank') + loadArmyBossRank(); + if(type == undefined || type == 'loadArmyDonate') + loadArmyDonate(); + if(type == undefined || type == 'loadRoleFriend') + loadRoleFriend(); + if(type == undefined || type == 'loadRoleFriendLv') + loadRoleFriendLv(); + if(type == undefined || type == 'loadGuildActivity') + loadGuildActivity(); + if(type == undefined || type == 'loadGateActivityPoint') + loadGateActivityPoint(); + if(type == undefined || type == 'loadGuildAuction') + loadGuildAuction(); + if(type == undefined || type == 'loadCityActivity') + loadCityActivity(); + if(type == undefined || type == 'loadChatAccuse') + loadChatAccuse(); + if(type == undefined || type == 'loadCityActivityReward') + loadCityActivityReward(); + if(type == undefined || type == 'loadRaceActivity') + loadRaceActivity(); + if(type == undefined || type == 'loadShop') + loadShop(); + if(type == undefined || type == 'loadShopType') + loadShopType(); + if(type == undefined || type == 'loadRank') + loadRank(); + if(type == undefined || type == 'loadRankReward') + loadRankReward(); + if(type == undefined || type == 'loadTask') + loadTask(); + if(type == undefined || type == 'loadMainTaskStage') + loadMainTaskStage(); + if(type == undefined || type == 'loadTaskBox') + loadTaskBox(); + if(type == undefined || type == 'loadGacha') + loadGacha(); + if(type == undefined || type == 'loadGachaPlan') + loadGachaPlan(); + if(type == undefined || type == 'loadGachaFloor') + loadGachaFloor(); + if(type == undefined || type == 'loadGiftPackage') + loadGiftPackage(); + if(type == undefined || type == 'loadGiftPackagePlan') + loadGiftPackagePlan(); + if(type == undefined || type == 'loadGiftPackageFloor') + loadGiftPackageFloor(); + if(type == undefined || type == 'loadRecruit') + loadRecruit(); + if(type == undefined || type == 'loadRMB') + loadRMB(); + if(type == undefined || type == 'loadActivityType') + loadActivityType(); + if(type == undefined || type == 'loadTaskType') + loadTaskType(); + if(type == undefined || type == 'loadServerName') + loadServerName(); + if(type == undefined || type == 'loadAp') + loadAp(); + if(type == undefined || type == 'loadApBuy') + loadApBuy(); + if(type == undefined || type == 'loadKingExpRatio') + loadKingExpRatio(); + if(type == undefined || type == 'loadEquipAttributeRatio') + loadEquipAttributeRatio(); + if(type == undefined || type == 'loadHoliday') + loadHoliday(); + if(type == undefined || type == 'loadExpeditionSubAttr') + loadExpeditionSubAttr(); + if(type == undefined || type == 'loadAuctionReward') + loadAuctionReward(); + if(type == undefined || type == 'loadGuildTrainInfo') + loadGuildTrainInfo(); + if(type == undefined || type == 'loadPvpDifficultRatio') + loadPvpDifficultRatio(); + if(type == undefined || type == 'loadWhiteIp') + loadWhiteIp(); + if(type == undefined || type == 'treatTaskGroup') + treatTaskGroup(); + if(type == undefined || type == 'loadGuildWishReward') + loadGuildWishReward(); + if(type == undefined || type == 'loadApi') + loadApi(); + if(type == undefined || type == 'loadServerConst') + loadServerConst(); + if(type == undefined || type == 'loadEquip') + loadEquip(); + if(type == undefined || type == 'loadEquipStrength') + loadEquipStrength(); + if(type == undefined || type == 'loadEquipQuality') + loadEquipQuality(); + if(type == undefined || type == 'loadEquipStar') + loadEquipStar(); + if(type == undefined || type == 'loadEquipSuit') + loadEquipSuit(); + if(type == undefined || type == 'loadEquipQualityExtra') + loadEquipQualityExtra(); + if(type == undefined || type == 'loadJewel') + loadJewel(); + if(type == undefined || type == 'loadStone') + loadStone(); + if(type == undefined || type == 'loadJewelCondition') + loadJewelCondition(); + if(type == undefined || type == 'loadMainStarBox') + loadMainStarBox(); + if(type == undefined || type == 'loadHeroTalent') + loadHeroTalent(); + if(type == undefined || type == 'loadEquipStrengthAttr') + loadEquipStrengthAttr(); + if(type == undefined || type == 'loadTowerPvpSubAttr') + loadTowerPvpSubAttr(); + if(type == undefined || type == 'loadSystemOpenTime') + loadSystemOpenTime(); + if(type == undefined || type == 'loadRandomEffectPoolPlan') + loadRandomEffectPoolPlan(); + if(type == undefined || type == 'loadMainWarReward') + loadMainWarReward(); + if(type == undefined || type == 'loadLadderMatch') + loadLadderMatch(); + if(type == undefined || type == 'loadLadderDifficultRatio') + loadLadderDifficultRatio(); + if(type == undefined || type == 'loadLadderRankReward') + loadLadderRankReward(); + if(type == undefined || type == 'loadGeneralGoods') + loadGeneralGoods(); + if(type == undefined || type == 'loadArtifact') + loadArtifact(); + if(type == undefined || type == 'loadArtifactLvPlan') + loadArtifactLvPlan(); + if(type == undefined || type == 'loadArtifactQuality') + loadArtifactQuality(); + if(type == undefined || type == 'loadArtifactQualityPlan') + loadArtifactQualityPlan(); + if(type == undefined || type == 'loadArtifactSeid') + loadArtifactSeid(); + if(type == undefined || type == 'loadGVGPeriod') + loadGVGPeriod(); + if(type == undefined || type == 'loadGVGTech') + loadGVGTech(); + if(type == undefined || type == 'loadGVGItem') + loadGVGItem(); + if(type == undefined || type == 'loadGVGLeagueLv') + loadGVGLeagueLv(); + if(type == undefined || type == 'loadGVGResourceBase') + loadGVGResourceBase(); + if(type == undefined || type == 'loadGVGContributeBox') + loadGVGContributeBox(); + if(type == undefined || type == 'loadGVGArea') + loadGVGArea(); + if(type == undefined || type == 'loadGVGCityAdd') + loadGVGCityAdd(); + if(type == undefined || type == 'loadGVGTask') + loadGVGTask(); + if(type == undefined || type == 'loadGVGVestigeType') + loadGVGVestigeType(); + if(type == undefined || type == 'loadGVGVestige') + loadGVGVestige(); + if(type == undefined || type == 'loadGVGVestigeRange') + loadGVGVestigeRange(); + if(type == undefined || type == 'loadGVGVestigeLeagueRank') + loadGVGVestigeLeagueRank(); + if(type == undefined || type == 'loadGVGVestigePlayerRank') + loadGVGVestigePlayerRank(); + if(type == undefined || type == 'loadGVGAreaPoint') + loadGVGAreaPoint(); + if(type == undefined || type == 'loadGVGBattleRankReward') + loadGVGBattleRankReward(); + if(type == undefined || type == 'loadPushMessage') + loadPushMessage(); + console.log('loadDatas type: ', type||'all'); } // 后台调用重载资源 -export function reloadResources() { - loadDatas(); - reloadDicParam(); +export function reloadResources(fileName: string) { + loadDatas(fileName); + parseDicParam(fileName); } initDatas();