feat(线上维护): json线上更新方案

This commit is contained in:
luying
2023-05-19 17:53:46 +08:00
parent 6b02059075
commit d06acfecee
11 changed files with 600 additions and 213 deletions

View File

@@ -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();