feat(军团): 练兵场添加扫荡

This commit is contained in:
luying
2023-06-17 16:57:12 +08:00
parent 5e28f4447d
commit be09636e85
7 changed files with 158 additions and 25 deletions

View File

@@ -138,6 +138,7 @@ export const GUILD_ROUTE_OPERATE = [
{ route: 'guild.guildTrainHandler.getTrainBoxs', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.trainBattleStart', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.trainBattleEnd', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.trainBattleSweep', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.getTrainInstanceBox', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.getTrainLvUpRewards', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },
{ route: 'guild.guildTrainHandler.purchaseTrainCount', operate: GUILD_OPERATE.TRAIN, type: GUILD_AUTH_CHECK_TYPE.CHECK_SELF },

View File

@@ -262,6 +262,7 @@ export const STATUS = {
GUILD_SCRIPT_ENCOURGE_NOT_ENOUGH: { code: 20974, simStr: '鼓舞次数达到上限' },
GUILD_CANNOT_INVITE: { code: 20975, simStr: '该玩家已经加入军团或该玩家不同服' },
GUILD_REFINE_CNT_MAX: { code: 20976, simStr: '兑换此图纸品质达到上限' },
GUILD_TRAIN_CANNOT_SWEEP: { code: 20977, simStr: '练兵场未通过无法扫荡' },
GUILD_LOT_NOT_FOUND: { code: 21001, simStr: '拍品未找到' },
LOT_OFFER_SERIAL: { code: 21002, simStr: '不能连续出价' },

View File

@@ -111,6 +111,11 @@ export default class BattleRecord extends BaseModel {
let result: BattleRecordType[] = await BattleRecordModel.find({ roleId, warType, status, createdAt: { $gte: beginTime, $lt: endTime } }).lean();
return result;
}
public static async findByBattleIds(roleId: string, battleIds: number[], status: number) {
let result: BattleRecordType[] = await BattleRecordModel.find({ roleId, battleId: { $in: battleIds }, status }).lean();
return result;
}
}
export const BattleRecordModel = getModelForClass(BattleRecord);

View File

@@ -1,4 +1,4 @@
import { readFileAndParse, parseGoodStr } from '../util'
import { readFileAndParse, parseGoodStr, parseNumberList } from '../util'
import { FILENAME } from '../../consts'
type KeysEnum<T> = { [P in keyof Required<T>]: true };
import { RewardInter } from '../interface';
@@ -12,7 +12,7 @@ export interface DicGuildTrainInfo {
readonly trainLv: number; // 试炼场等级
readonly heroId: number;
readonly heroRewards: RewardInter[]; // 翻牌子的奖励,随机其中一个
readonly difficulty: number[]; // 难度
}
const DicGuildTrainInfoKeys: KeysEnum<DicGuildTrainInfo> = {
@@ -20,7 +20,8 @@ const DicGuildTrainInfoKeys: KeysEnum<DicGuildTrainInfo> = {
trainId: true,
trainLv: true,
heroId: true,
heroRewards: true
heroRewards: true,
difficulty: true,
};
export const dicGuildTrainInfo = new Map<string, DicGuildTrainInfo>();
@@ -31,7 +32,8 @@ export function loadGuildTrainInfo() {
arr.forEach(o => {
o.heroId = o.heroid;
o.heroRewards = parseGoodStr(o.shilianReward); // TODO 这个改到
o.heroRewards = parseGoodStr(o.shilianReward);
o.difficulty = parseNumberList(o.war_id);
dicGuildTrainInfo.set(`${o.trainId}_${o.heroId}`,_.pick(o, Object.keys(DicGuildTrainInfoKeys)));
});