军团:试炼表修改
This commit is contained in:
@@ -10,7 +10,7 @@ import { lockData } from '../../../services/redLockService';
|
|||||||
import { GUILD_REPORT_NUM, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
import { GUILD_REPORT_NUM, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||||
import { UserGuildModel } from '../../../db/UserGuild';
|
import { UserGuildModel } from '../../../db/UserGuild';
|
||||||
import { GuildModel } from '../../../db/Guild';
|
import { GuildModel } from '../../../db/Guild';
|
||||||
import { getArmyTrainJuDian, getTrainSoloReward, getTrainBaseByLv } from '../../../pubUtils/data';
|
import { getArmyTrainJuDian, getTrainSoloReward, getTrainBaseByLv, gameData } from '../../../pubUtils/data';
|
||||||
import { CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../../../consts/constModules/itemConst';
|
import { CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../../../consts/constModules/itemConst';
|
||||||
import { handleCost, addItems } from '../../../services/rewardService';
|
import { handleCost, addItems } from '../../../services/rewardService';
|
||||||
import { ARMY } from '../../../pubUtils/dicParam';
|
import { ARMY } from '../../../pubUtils/dicParam';
|
||||||
@@ -21,6 +21,7 @@ import { pushGuildTrainSucMsg } from '../../../services/chatService';
|
|||||||
import { checkActivityTask, checkTask } from '../../../services/taskService';
|
import { checkActivityTask, checkTask } from '../../../services/taskService';
|
||||||
import { sendPopUpActivityData } from '../../../services/guildActivityService';
|
import { sendPopUpActivityData } from '../../../services/guildActivityService';
|
||||||
import { guildInter } from '../../../pubUtils/interface';
|
import { guildInter } from '../../../pubUtils/interface';
|
||||||
|
import { getGuildTrainGkInfo } from '../../../pubUtils/data';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
new HandlerService(app, {});
|
new HandlerService(app, {});
|
||||||
@@ -99,7 +100,7 @@ export class GuildTrainHandler {
|
|||||||
const { guildCode: code } = userGuild;
|
const { guildCode: code } = userGuild;
|
||||||
if (userGuild.trainCount <= 0)
|
if (userGuild.trainCount <= 0)
|
||||||
return resResult(STATUS.GUILD_TRAIN_BATTLE_COUNT_NOT_ENOUGH);
|
return resResult(STATUS.GUILD_TRAIN_BATTLE_COUNT_NOT_ENOUGH);
|
||||||
let { trainId: curTeainId } = await GuildModel.findGuild(code, serverId, 'trainId');
|
let { trainId: curTeainId, trainLv } = await GuildModel.findGuild(code, serverId, 'trainId');
|
||||||
if (curTeainId !== trainId)
|
if (curTeainId !== trainId)
|
||||||
return resResult(STATUS.GUILD_TRAIN_LEVEL_IS_COMPLETE);
|
return resResult(STATUS.GUILD_TRAIN_LEVEL_IS_COMPLETE);
|
||||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId, 'trainId isComplete trainInstances');
|
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId, 'trainId isComplete trainInstances');
|
||||||
@@ -120,7 +121,7 @@ export class GuildTrainHandler {
|
|||||||
$set: {
|
$set: {
|
||||||
roleId, roleName, battleId,
|
roleId, roleName, battleId,
|
||||||
status: 0,
|
status: 0,
|
||||||
record: { heroes: [], trainId, hid, guildCode: code, difficulty },
|
record: { heroes: [], trainId, hid, guildCode: code, difficulty, trainLv },
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
return resResult(STATUS.SUCCESS, { battleCode });
|
return resResult(STATUS.SUCCESS, { battleCode });
|
||||||
@@ -161,8 +162,8 @@ export class GuildTrainHandler {
|
|||||||
$set: { status: isSuccess ? 1 : 2 }
|
$set: { status: isSuccess ? 1 : 2 }
|
||||||
}, true);//设置战斗状态
|
}, true);//设置战斗状态
|
||||||
|
|
||||||
let trainId = battleRecord.record.trainId;
|
let { trainId, trainLv, hid, difficulty } = battleRecord.record;
|
||||||
let hid = battleRecord.record.hid;
|
let maxTrainId = gameData.lastGuildTrainIdOfLv.get(trainLv);
|
||||||
let res: any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
|
let res: any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
|
||||||
if (!!res.err)
|
if (!!res.err)
|
||||||
return resResult(STATUS.REDLOCK_ERR);
|
return resResult(STATUS.REDLOCK_ERR);
|
||||||
@@ -183,7 +184,7 @@ export class GuildTrainHandler {
|
|||||||
res.releaseCallback();//解锁
|
res.releaseCallback();//解锁
|
||||||
return resResult(STATUS.WRONG_PARMS);
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
}
|
}
|
||||||
let trainSoloReward = getTrainSoloReward(battleRecord.record.difficulty);
|
let trainSoloReward = getTrainSoloReward(difficulty);
|
||||||
if (!trainSoloReward) {//获得个人奖励信息
|
if (!trainSoloReward) {//获得个人奖励信息
|
||||||
res.releaseCallback();//解锁
|
res.releaseCallback();//解锁
|
||||||
return resResult(STATUS.WRONG_PARMS);
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
@@ -200,7 +201,7 @@ export class GuildTrainHandler {
|
|||||||
// ranks.push({ score: addScore, roleId });//新增排名
|
// ranks.push({ score: addScore, roleId });//新增排名
|
||||||
// }
|
// }
|
||||||
let needLockNext = false;
|
let needLockNext = false;
|
||||||
let report = { roleName, trainId, hid, score: addScore, time: nowSeconds(), type: isSuccess ? 2 : 1, difficulty: battleRecord.record.difficulty };//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
let report = { roleName, trainId, hid, score: addScore, time: nowSeconds(), type: isSuccess ? 2 : 1, difficulty };//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||||
reports.push(report);
|
reports.push(report);
|
||||||
if (trainInstance.progress < instance.progress) {
|
if (trainInstance.progress < instance.progress) {
|
||||||
if (trainInstance.progress + addScore >= instance.progress) {
|
if (trainInstance.progress + addScore >= instance.progress) {
|
||||||
@@ -220,10 +221,10 @@ export class GuildTrainHandler {
|
|||||||
guildTrain = await GuildTrainModel.updateGuildTrainProgress(code, trainId, hid, progress, ranks, isComplete);
|
guildTrain = await GuildTrainModel.updateGuildTrainProgress(code, trainId, hid, progress, ranks, isComplete);
|
||||||
|
|
||||||
//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||||
reports.push({ type: 3, time: nowSeconds(), score: addScore, roleName, trainId, hid, difficulty: battleRecord.record.difficulty });
|
reports.push({ type: 3, time: nowSeconds(), score: addScore, roleName, trainId, hid, difficulty });
|
||||||
pushGuildTrainSucMsg(roleId, roleName, code, hid);
|
pushGuildTrainSucMsg(roleId, roleName, code, hid);
|
||||||
|
|
||||||
if (needLockNext) {
|
if (needLockNext && maxTrainId > trainId) {
|
||||||
guildTrain = await unlockTrain(code, trainId + 1);
|
guildTrain = await unlockTrain(code, trainId + 1);
|
||||||
}
|
}
|
||||||
res.releaseCallback();//解锁
|
res.releaseCallback();//解锁
|
||||||
@@ -279,8 +280,8 @@ export class GuildTrainHandler {
|
|||||||
if (!!res.err)
|
if (!!res.err)
|
||||||
return resResult(STATUS.REDLOCK_ERR);
|
return resResult(STATUS.REDLOCK_ERR);
|
||||||
|
|
||||||
let { shilianRewardRatio } = getTrainBaseByLv(trainLv);
|
let { trainInstances } = getArmyTrainJuDian(trainId);
|
||||||
let { heroRewards, trainInstances } = getArmyTrainJuDian(trainId);
|
let trainInfo = getGuildTrainGkInfo(trainId, hid);
|
||||||
let { progress } = findWhere(trainInstances, { hid });
|
let { progress } = findWhere(trainInstances, { hid });
|
||||||
console.log('progress = ' + progress);
|
console.log('progress = ' + progress);
|
||||||
let guildTrain = await GuildTrainModel.findTrainInstanceBoxByIndex(code, trainId, hid, progress);
|
let guildTrain = await GuildTrainModel.findTrainInstanceBoxByIndex(code, trainId, hid, progress);
|
||||||
@@ -304,8 +305,7 @@ export class GuildTrainHandler {
|
|||||||
res.releaseCallback();//解锁
|
res.releaseCallback();//解锁
|
||||||
return resResult(STATUS.GUILD_TRAIN_BOX_IS_GOT);
|
return resResult(STATUS.GUILD_TRAIN_BOX_IS_GOT);
|
||||||
}
|
}
|
||||||
let good = getRandSingleEelm(heroRewards);
|
let good = getRandSingleEelm(trainInfo.heroRewards);
|
||||||
good.count = Math.floor((100 + shilianRewardRatio) * good.count / 100);
|
|
||||||
let goods = await addItems(roleId, roleName, sid, [good]);
|
let goods = await addItems(roleId, roleName, sid, [good]);
|
||||||
|
|
||||||
let resGuildTrain = await GuildTrainModel.receiveBoxByIndex(code, roleId, trainId, hid, index, good);
|
let resGuildTrain = await GuildTrainModel.receiveBoxByIndex(code, roleId, trainId, hid, index, good);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
||||||
import { getArmyTrainJuDian, getTrainBaseByLv } from '../pubUtils/data';
|
import { getArmyTrainJuDian, getGuildTrainGkInfo, getTrainBaseByLv } from '../pubUtils/data';
|
||||||
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
||||||
import { GUILD_STRUCTURE } from '../consts';
|
import { GUILD_STRUCTURE } from '../consts';
|
||||||
import { GuildTrainType, GuildTrainModel, TrainInstance } from '../db/GuildTrain';
|
import { GuildTrainType, GuildTrainModel, TrainInstance } from '../db/GuildTrain';
|
||||||
@@ -150,19 +150,15 @@ export async function resetTrain(code: string, serverId: number) {
|
|||||||
const userGuildList = await UserGuildModel.getListByGuild(code, 'trainRewards', {});
|
const userGuildList = await UserGuildModel.getListByGuild(code, 'trainRewards', {});
|
||||||
const guildTrains = await GuildTrainModel.getGuildTrainBoxs(code);
|
const guildTrains = await GuildTrainModel.getGuildTrainBoxs(code);
|
||||||
|
|
||||||
let { shilianRewardRatio } = getTrainBaseByLv(GUILD_STRUCTURE.TRAIN);
|
|
||||||
//结算未领取的宝箱奖励发送到邮件中
|
//结算未领取的宝箱奖励发送到邮件中
|
||||||
userGuildList.forEach(async function ({roleId, trainRewards}) {
|
userGuildList.forEach(async function ({roleId, trainRewards}) {
|
||||||
let goods: { id: number, count: number }[] = [];
|
let goods: { id: number, count: number }[] = [];
|
||||||
guildTrains.forEach(guildTrain=>{
|
guildTrains.forEach(guildTrain=>{
|
||||||
guildTrain.trainInstances.forEach(({ trainBoxs })=>{
|
guildTrain.trainInstances.forEach(({ trainBoxs, hid })=>{
|
||||||
if (!findWhere(trainBoxs, {roleId})) {
|
if (!findWhere(trainBoxs, {roleId})) {
|
||||||
let { heroRewards } = getArmyTrainJuDian(guildTrain.trainId);
|
let { heroRewards } = getGuildTrainGkInfo(guildTrain.trainId, hid);
|
||||||
let good = getRandSingleEelm(heroRewards);
|
let good = getRandSingleEelm(heroRewards);
|
||||||
goods.push({
|
goods.push(good);
|
||||||
id: good.id,
|
|
||||||
count: Math.floor((100 + shilianRewardRatio) * good.count/100)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -378,6 +378,7 @@ export const FILENAME = {
|
|||||||
DIC_GK_MAIN_ELITE: 'dic_zyz_gk_mainElite',
|
DIC_GK_MAIN_ELITE: 'dic_zyz_gk_mainElite',
|
||||||
DIC_GK_TOWER: 'dic_zyz_gk_tower',
|
DIC_GK_TOWER: 'dic_zyz_gk_tower',
|
||||||
DIC_GK_TREASURE: 'dic_zyz_gk_Treasure',
|
DIC_GK_TREASURE: 'dic_zyz_gk_Treasure',
|
||||||
|
DIC_GK_ARMY_TRAIN: 'dic_zyz_gk_armytrain',
|
||||||
DIC_HERO: 'dic_zyz_hero',
|
DIC_HERO: 'dic_zyz_hero',
|
||||||
DIC_HERO_QUALITY_UP: 'dic_zyz_hero_quality_up',
|
DIC_HERO_QUALITY_UP: 'dic_zyz_hero_quality_up',
|
||||||
DIC_HERO_STAR: 'dic_zyz_hero_star',
|
DIC_HERO_STAR: 'dic_zyz_hero_star',
|
||||||
@@ -422,6 +423,7 @@ export const FILENAME = {
|
|||||||
DIC_MAIL: 'dic_email_content',
|
DIC_MAIL: 'dic_email_content',
|
||||||
DIC_ARMY_TRAIN_JU_DIAN: 'dic_army_trainJuDian',
|
DIC_ARMY_TRAIN_JU_DIAN: 'dic_army_trainJuDian',
|
||||||
DIC_ARMY_TRAIN_SOLO_REWARD: 'dic_army_trainSoloReward',
|
DIC_ARMY_TRAIN_SOLO_REWARD: 'dic_army_trainSoloReward',
|
||||||
|
DIC_ARMY_TRAIN_INFO: 'dic_army_trainGk_info',
|
||||||
DIC_ARMY_ACTIVE_POINT_WAYS: 'dic_army_activePointWays',
|
DIC_ARMY_ACTIVE_POINT_WAYS: 'dic_army_activePointWays',
|
||||||
DIC_ARMY_DEVELOPMENTCONSUME: 'dic_army_developmentConsume',
|
DIC_ARMY_DEVELOPMENTCONSUME: 'dic_army_developmentConsume',
|
||||||
DIC_ARMY_BOSS_RANK_REWARD: 'dic_army_bossrankReward',
|
DIC_ARMY_BOSS_RANK_REWARD: 'dic_army_bossrankReward',
|
||||||
@@ -487,7 +489,8 @@ export const WAR_RELATE_TABLES = [
|
|||||||
FILENAME.DIC_GK_MJSD,
|
FILENAME.DIC_GK_MJSD,
|
||||||
FILENAME.DIC_GK_FES,
|
FILENAME.DIC_GK_FES,
|
||||||
FILENAME.DIC_GK_NEWHERO,
|
FILENAME.DIC_GK_NEWHERO,
|
||||||
FILENAME.DIC_GK_PROBATION
|
FILENAME.DIC_GK_PROBATION,
|
||||||
|
FILENAME.DIC_GK_ARMY_TRAIN
|
||||||
]
|
]
|
||||||
|
|
||||||
// 装备栏强化类型
|
// 装备栏强化类型
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import { LineupParam } from '../domain/rank';
|
|||||||
|
|
||||||
class Record {
|
class Record {
|
||||||
@prop({ required: true, type: Number })
|
@prop({ required: true, type: Number })
|
||||||
heroes: Array<number>; // 武将id
|
heroes?: Array<number>; // 武将id
|
||||||
@prop({ required: true, type: Number })
|
@prop({ required: true, type: Number })
|
||||||
seqIds: Array<number>; // 武将seqid
|
seqIds?: Array<number>; // 武将seqid
|
||||||
@prop({ required: true, type: () => LineupParam, _id: false })
|
@prop({ required: true, type: () => LineupParam, _id: false })
|
||||||
lineup: Array<LineupParam>; // 武将详细信息
|
lineup?: Array<LineupParam>; // 武将详细信息
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
oppRoleId?: string; // pvp对手
|
oppRoleId?: string; // pvp对手
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
@@ -26,11 +26,13 @@ class Record {
|
|||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
trainId?:number;
|
trainId?:number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
|
trainLv?:number;
|
||||||
|
@prop({ required: false })
|
||||||
hid?:number;
|
hid?:number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
guildCode?: string;
|
guildCode?: string;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
difficulty: number;
|
difficulty?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class BattleRecord extends BaseModel {
|
export default class BattleRecord extends BaseModel {
|
||||||
@@ -70,7 +72,7 @@ export default class BattleRecord extends BaseModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async updateBattleRecordByCode(battleCode: string, params: object, lean = true) {
|
public static async updateBattleRecordByCode(battleCode: string, params: { $set: BattleRecordParam }, lean = true) {
|
||||||
const result: BattleRecordType = await BattleRecordModel.findOneAndUpdate({ battleCode }, params, { new: true, upsert: true }).lean(lean);
|
const result: BattleRecordType = await BattleRecordModel.findOneAndUpdate({ battleCode }, params, { new: true, upsert: true }).lean(lean);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -83,4 +85,5 @@ export default class BattleRecord extends BaseModel {
|
|||||||
|
|
||||||
export const BattleRecordModel = getModelForClass(BattleRecord);
|
export const BattleRecordModel = getModelForClass(BattleRecord);
|
||||||
|
|
||||||
export interface BattleRecordType extends Pick<DocumentType<BattleRecord>, keyof BattleRecord> { }
|
export interface BattleRecordType extends Pick<DocumentType<BattleRecord>, keyof BattleRecord> { }
|
||||||
|
export type BattleRecordParam = Partial<BattleRecordType>; // 将所有字段变成可选项
|
||||||
+3
-1
@@ -5,6 +5,7 @@ import { genCode } from '../pubUtils/util';
|
|||||||
import { GUILD_STRUCTURE, GUILD_STATUS, GUILD_PER_PAGE, GUILD_SELECT, REDIS_KEY, SHOP_REFRESH_TYPE } from '../consts';
|
import { GUILD_STRUCTURE, GUILD_STATUS, GUILD_PER_PAGE, GUILD_SELECT, REDIS_KEY, SHOP_REFRESH_TYPE } from '../consts';
|
||||||
import { getZeroPoint, nowSeconds } from '../pubUtils/timeUtil';
|
import { getZeroPoint, nowSeconds } from '../pubUtils/timeUtil';
|
||||||
import { reduceCe } from '../pubUtils/util';
|
import { reduceCe } from '../pubUtils/util';
|
||||||
|
import { gameData } from '../pubUtils/data';
|
||||||
|
|
||||||
class Structure {
|
class Structure {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
@@ -237,7 +238,8 @@ export default class Guild extends BaseModel {
|
|||||||
*/
|
*/
|
||||||
public static async resetGuildTrain(code: string, serverId: number, trainLv: number, lean = true) {
|
public static async resetGuildTrain(code: string, serverId: number, trainLv: number, lean = true) {
|
||||||
const time = getZeroPoint(SHOP_REFRESH_TYPE.WEEKLY);//每周一,5点刷新
|
const time = getZeroPoint(SHOP_REFRESH_TYPE.WEEKLY);//每周一,5点刷新
|
||||||
const result = await GuildModel.findOneAndUpdate({ code, status: GUILD_STATUS.RUNNING, serverId, resetTrainTime:{$ne:time}},{$set: {trainId: 1, resetTrainTime: time, trainLv}}, {new: true}).lean(lean);
|
const newTrainId = gameData.firstGuildTrainIdOfLv.get(trainLv);
|
||||||
|
const result = await GuildModel.findOneAndUpdate({ code, status: GUILD_STATUS.RUNNING, serverId, resetTrainTime:{$ne:time}},{$set: {trainId: newTrainId, resetTrainTime: time, trainLv}}, {new: true}).lean(lean);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -49,7 +49,7 @@ import { dicGuildActiveWeekReward, loadGuildActiveWeekReward } from './dictionar
|
|||||||
import { dicGuildActiveWays, loadGuildActiveWays } from './dictionary/DicGuildActiveWays';
|
import { dicGuildActiveWays, loadGuildActiveWays } from './dictionary/DicGuildActiveWays';
|
||||||
import { dicGuildPosition, loadGuildPosition } from "./dictionary/DicGuildPosition";
|
import { dicGuildPosition, loadGuildPosition } from "./dictionary/DicGuildPosition";
|
||||||
import { dicMail, loadMail } from "./dictionary/DicMail";
|
import { dicMail, loadMail } from "./dictionary/DicMail";
|
||||||
import { dicArmyTrainJuDian, loadArmyTrainJuDian } from './dictionary/DicArmyTrainJuDian';
|
import { dicArmyTrainJuDian, loadArmyTrainJuDian, dicLastGuildTrainIdOfLv, dicFirstGuildTrainIdOfLv } from './dictionary/DicArmyTrainJuDian';
|
||||||
import { dicTrainSoloReward, loadTrainSoloReward } from './dictionary/DicTrainSoloReward';
|
import { dicTrainSoloReward, loadTrainSoloReward } from './dictionary/DicTrainSoloReward';
|
||||||
import { RewardInter } from "./interface";
|
import { RewardInter } from "./interface";
|
||||||
import { dicArmyDevelopConsume, loadArmyDevelopConsume } from './dictionary/DicArmyDevelopConsume';
|
import { dicArmyDevelopConsume, loadArmyDevelopConsume } from './dictionary/DicArmyDevelopConsume';
|
||||||
@@ -93,6 +93,7 @@ import { dicQuenchConsume, loadQuenchConsume } from './dictionary/DicQuenchConsu
|
|||||||
import { dicHoliday, loadHoliday } from './dictionary/DicHoliday';
|
import { dicHoliday, loadHoliday } from './dictionary/DicHoliday';
|
||||||
import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExpeditionSubAttr';
|
import { dicExpeditionSubAttr, loadExpeditionSubAttr } from './dictionary/DicExpeditionSubAttr';
|
||||||
import { dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward';
|
import { dicAuctionPool, loadAuctionReward } from './dictionary/DicAuctionReward';
|
||||||
|
import { dicGuildTrainInfo, loadGuildTrainInfo } from './dictionary/DicGuildTrainInfo';
|
||||||
import { pick } from "underscore";
|
import { pick } from "underscore";
|
||||||
|
|
||||||
export const gameData = {
|
export const gameData = {
|
||||||
@@ -166,11 +167,14 @@ export const gameData = {
|
|||||||
donateBase: dicDonateBase,
|
donateBase: dicDonateBase,
|
||||||
armyWishPool: dicWishPoolBase,
|
armyWishPool: dicWishPoolBase,
|
||||||
storeBase: dicStoreBase,
|
storeBase: dicStoreBase,
|
||||||
|
guildTrainInfo: dicGuildTrainInfo,
|
||||||
structureConsume: dicStructureConsume,
|
structureConsume: dicStructureConsume,
|
||||||
guildActiveDayReward: dicGuildActiveDayReward,
|
guildActiveDayReward: dicGuildActiveDayReward,
|
||||||
guildActiveWeekReward: dicGuildActiveWeekReward,
|
guildActiveWeekReward: dicGuildActiveWeekReward,
|
||||||
guildPosition: dicGuildPosition,
|
guildPosition: dicGuildPosition,
|
||||||
armyTrainJuDian: dicArmyTrainJuDian,
|
armyTrainJuDian: dicArmyTrainJuDian,
|
||||||
|
lastGuildTrainIdOfLv: dicLastGuildTrainIdOfLv,
|
||||||
|
firstGuildTrainIdOfLv: dicFirstGuildTrainIdOfLv,
|
||||||
trainSoloReward: dicTrainSoloReward,
|
trainSoloReward: dicTrainSoloReward,
|
||||||
mail: dicMail,
|
mail: dicMail,
|
||||||
guildActiveWays: dicGuildActiveWays,
|
guildActiveWays: dicGuildActiveWays,
|
||||||
@@ -779,6 +783,15 @@ export function getQuenchConsume(lvLimited: number, quality: number) {
|
|||||||
return gameData.quenchConsume.get(`${lvLimited}_${quality}`);
|
return gameData.quenchConsume.get(`${lvLimited}_${quality}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据TrainJuDian的id和武将id,获得信息(包括多个难度)
|
||||||
|
* @param trainId 据点id
|
||||||
|
* @param heroId 武将id
|
||||||
|
*/
|
||||||
|
export function getGuildTrainGkInfo(trainId: number, heroId: number) {
|
||||||
|
return gameData.guildTrainInfo.get(`${trainId}_${heroId}`);
|
||||||
|
}
|
||||||
|
|
||||||
function loadEquipAttributeRatio() {
|
function loadEquipAttributeRatio() {
|
||||||
let arr = decodeArrayListStr(param.ATTRIBUTE.ATTRIBUTE_EQUIP_RATIO);
|
let arr = decodeArrayListStr(param.ATTRIBUTE.ATTRIBUTE_EQUIP_RATIO);
|
||||||
for(let [id, ratio] of arr) {
|
for(let [id, ratio] of arr) {
|
||||||
@@ -894,6 +907,7 @@ function loadDatas() {
|
|||||||
loadHoliday();
|
loadHoliday();
|
||||||
loadExpeditionSubAttr();
|
loadExpeditionSubAttr();
|
||||||
loadAuctionReward();
|
loadAuctionReward();
|
||||||
|
loadGuildTrainInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重载dicParam
|
// 重载dicParam
|
||||||
|
|||||||
@@ -4,40 +4,58 @@ type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
|||||||
import { RewardInter } from '../interface';
|
import { RewardInter } from '../interface';
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
|
|
||||||
export interface DicArmyTrainJuDian {
|
export interface DicArmyTrainJuDian {
|
||||||
|
|
||||||
readonly id: number;
|
readonly id: number;
|
||||||
// 目标品质
|
readonly trainLv: number;
|
||||||
readonly trainInstances: Array<{hid: number, warId: number, progress: number}>;
|
// 训练场多个难度组成的gk,每个难度一个warId,而这个gkId指trainGk_info这张表的id
|
||||||
readonly heroRewards: Array<{id: number, count: number}>;
|
readonly trainInstances: Array<{hid: number, gkId: number, progress: number}>;
|
||||||
// 进阶奖励
|
// 进阶奖励
|
||||||
readonly jinjieReward: RewardInter[];
|
readonly jinjieReward: RewardInter[];
|
||||||
readonly soloRewardRatio: number;
|
readonly soloRewardRatio: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DicArmyTrainJuDianKeys: KeysEnum<DicArmyTrainJuDian> = {
|
const DicArmyTrainJuDianKeys: KeysEnum<DicArmyTrainJuDian> = {
|
||||||
id: true,
|
id: true,
|
||||||
|
trainLv: true,
|
||||||
trainInstances: true,
|
trainInstances: true,
|
||||||
heroRewards: true,
|
|
||||||
jinjieReward: true,
|
jinjieReward: true,
|
||||||
soloRewardRatio: true
|
soloRewardRatio: true
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dicArmyTrainJuDian = new Map<number, DicArmyTrainJuDian>();
|
export const dicArmyTrainJuDian = new Map<number, DicArmyTrainJuDian>();
|
||||||
|
export const dicLastGuildTrainIdOfLv = new Map<number, number>(); // 每级试炼场等级的最后据点id
|
||||||
|
export const dicFirstGuildTrainIdOfLv = new Map<number, number>(); // 每级试炼场等级的最先据点id
|
||||||
export function loadArmyTrainJuDian() {
|
export function loadArmyTrainJuDian() {
|
||||||
|
dicLastGuildTrainIdOfLv.clear();
|
||||||
|
dicFirstGuildTrainIdOfLv.clear();
|
||||||
|
|
||||||
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_JU_DIAN);
|
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_JU_DIAN);
|
||||||
|
|
||||||
arr.forEach(o => {
|
arr.forEach(o => {
|
||||||
|
|
||||||
o.trainInstances = o.gkid.split('|').map(element => {
|
o.trainInstances = o.gkid.split('|').map(element => {
|
||||||
let arr = element.split('&');
|
let arr = element.split('&');
|
||||||
return {hid: parseInt(arr[0]), warId: parseInt(arr[1]), progress: parseInt(arr[2])};
|
return {hid: parseInt(arr[0]), gkId: parseInt(arr[1]), progress: parseInt(arr[2])};
|
||||||
});
|
});
|
||||||
o.jinjieReward = parseGoodStr(o.jinjieReward);
|
o.jinjieReward = parseGoodStr(o.jinjieReward);
|
||||||
|
|
||||||
o.heroRewards = parseGoodStr(o.shilianReward);
|
|
||||||
|
|
||||||
dicArmyTrainJuDian.set(o.id,_.pick(o, Object.keys(DicArmyTrainJuDianKeys)));
|
dicArmyTrainJuDian.set(o.id,_.pick(o, Object.keys(DicArmyTrainJuDianKeys)));
|
||||||
|
|
||||||
|
if(!dicLastGuildTrainIdOfLv.has(o.trainLv)) {
|
||||||
|
dicLastGuildTrainIdOfLv.set(o.trainLv, o.id);
|
||||||
|
} else {
|
||||||
|
if(dicLastGuildTrainIdOfLv.get(o.trainLv) < o.id) {
|
||||||
|
dicLastGuildTrainIdOfLv.set(o.trainLv, o.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!dicFirstGuildTrainIdOfLv.has(o.trainLv)) {
|
||||||
|
dicFirstGuildTrainIdOfLv.set(o.trainLv, o.id);
|
||||||
|
} else {
|
||||||
|
if(dicFirstGuildTrainIdOfLv.get(o.trainLv) > o.id) {
|
||||||
|
dicLastGuildTrainIdOfLv.set(o.trainLv, o.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
arr = undefined;
|
arr = undefined;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { readFileAndParse, 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 DicGuildTrainInfo {
|
||||||
|
|
||||||
|
readonly id: number;
|
||||||
|
readonly trainId: number;
|
||||||
|
readonly trainLv: number; // 试炼场等级
|
||||||
|
readonly heroId: number;
|
||||||
|
readonly heroRewards: RewardInter[]; // 翻牌子的奖励,随机其中一个
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const DicGuildTrainInfoKeys: KeysEnum<DicGuildTrainInfo> = {
|
||||||
|
id: true,
|
||||||
|
trainId: true,
|
||||||
|
trainLv: true,
|
||||||
|
heroId: true,
|
||||||
|
heroRewards: true
|
||||||
|
};
|
||||||
|
|
||||||
|
export const dicGuildTrainInfo = new Map<string, DicGuildTrainInfo>();
|
||||||
|
export function loadGuildTrainInfo() {
|
||||||
|
|
||||||
|
let arr = readFileAndParse(FILENAME.DIC_ARMY_TRAIN_INFO);
|
||||||
|
|
||||||
|
arr.forEach(o => {
|
||||||
|
o.heroId = o.heroid;
|
||||||
|
o.heroRewards = parseGoodStr(o.shilianReward); // TODO 这个改到
|
||||||
|
|
||||||
|
dicGuildTrainInfo.set(`${o.trainId}_${o.heroId}`,_.pick(o, Object.keys(DicGuildTrainInfoKeys)));
|
||||||
|
});
|
||||||
|
arr = undefined;
|
||||||
|
}
|
||||||
@@ -83,8 +83,6 @@ export interface DicTrainBase {
|
|||||||
readonly difficultyRatio: number;
|
readonly difficultyRatio: number;
|
||||||
// 据点奖励增长系数
|
// 据点奖励增长系数
|
||||||
readonly judianRewardRatio: number;
|
readonly judianRewardRatio: number;
|
||||||
|
|
||||||
readonly shilianRewardRatio: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
||||||
@@ -92,8 +90,7 @@ const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
|||||||
level: true,
|
level: true,
|
||||||
trainLevel: true,
|
trainLevel: true,
|
||||||
difficultyRatio: true,
|
difficultyRatio: true,
|
||||||
judianRewardRatio: true,
|
judianRewardRatio: true
|
||||||
shilianRewardRatio: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 捐献所
|
// 捐献所
|
||||||
|
|||||||
Executable → Regular
+20
-10
@@ -9,7 +9,8 @@
|
|||||||
"shilianRewardRatio": 0,
|
"shilianRewardRatio": 0,
|
||||||
"consume": 5000,
|
"consume": 5000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "1&2&3&4&5&6&7&8&9&10"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@@ -21,7 +22,8 @@
|
|||||||
"shilianRewardRatio": 10,
|
"shilianRewardRatio": 10,
|
||||||
"consume": 6000,
|
"consume": 6000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "11&12&13&14&15&16&17&18&19&20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
@@ -33,7 +35,8 @@
|
|||||||
"shilianRewardRatio": 20,
|
"shilianRewardRatio": 20,
|
||||||
"consume": 7000,
|
"consume": 7000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "21&22&23&24&25&26&27&28&29&30"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
@@ -45,7 +48,8 @@
|
|||||||
"shilianRewardRatio": 30,
|
"shilianRewardRatio": 30,
|
||||||
"consume": 8000,
|
"consume": 8000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "31&32&33&34&35&36&37&38&39&40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
@@ -57,7 +61,8 @@
|
|||||||
"shilianRewardRatio": 40,
|
"shilianRewardRatio": 40,
|
||||||
"consume": 9000,
|
"consume": 9000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "41&42&43&44&45&46&47&48&49&50"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
@@ -69,7 +74,8 @@
|
|||||||
"shilianRewardRatio": 50,
|
"shilianRewardRatio": 50,
|
||||||
"consume": 10000,
|
"consume": 10000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "51&52&53&54&55&56&57&58&59&60"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
@@ -81,7 +87,8 @@
|
|||||||
"shilianRewardRatio": 60,
|
"shilianRewardRatio": 60,
|
||||||
"consume": 11000,
|
"consume": 11000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "61&62&63&64&65&66&67&68&69&70"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
@@ -93,7 +100,8 @@
|
|||||||
"shilianRewardRatio": 70,
|
"shilianRewardRatio": 70,
|
||||||
"consume": 12000,
|
"consume": 12000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "71&72&73&74&75&76&77&78&79&80"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
@@ -105,7 +113,8 @@
|
|||||||
"shilianRewardRatio": 80,
|
"shilianRewardRatio": 80,
|
||||||
"consume": 13000,
|
"consume": 13000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "81&82&83&84&85&86&87&88&89&90"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 10,
|
"id": 10,
|
||||||
@@ -117,6 +126,7 @@
|
|||||||
"shilianRewardRatio": 100,
|
"shilianRewardRatio": 100,
|
||||||
"consume": 15000,
|
"consume": 15000,
|
||||||
"buildWords": "&",
|
"buildWords": "&",
|
||||||
"imageID": "jttubiao_4"
|
"imageID": "jttubiao_4",
|
||||||
|
"shilianId": "91&92&93&94&95&96&97&98&99&100"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user