后台:设置军团练兵场关卡
This commit is contained in:
@@ -27,6 +27,7 @@ import { DicWar } from '../../../pubUtils/dictionary/DicWar';
|
|||||||
import { SchoolModel } from '../../../db/School';
|
import { SchoolModel } from '../../../db/School';
|
||||||
import { JewelModel } from '../../../db/Jewel';
|
import { JewelModel } from '../../../db/Jewel';
|
||||||
import { RoleCeModel } from '../../../db/RoleCe';
|
import { RoleCeModel } from '../../../db/RoleCe';
|
||||||
|
import { setTrainLv } from '../../../services/gmService';
|
||||||
|
|
||||||
let timer: NodeJS.Timer;
|
let timer: NodeJS.Timer;
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
@@ -187,6 +188,11 @@ export class GmRoleHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
guild = await GuildModel.updateInfo(params.code, updateParams);
|
guild = await GuildModel.updateInfo(params.code, updateParams);
|
||||||
|
|
||||||
|
if(params.trainLv) {
|
||||||
|
await setTrainLv(params.code, params.trainLv);
|
||||||
|
}
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
async dismissGuild(msg: { code: string }, session: BackendSession) {
|
async dismissGuild(msg: { code: string }, session: BackendSession) {
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ import { getPopUpShopData } from "./activity/popUpShopService";
|
|||||||
import { TaskPassData } from "../domain/activityField/taskPassField";
|
import { TaskPassData } from "../domain/activityField/taskPassField";
|
||||||
import { ActivityGroupModel } from "../db/ActivityGroup";
|
import { ActivityGroupModel } from "../db/ActivityGroup";
|
||||||
import { redisClient } from "./redisService";
|
import { redisClient } from "./redisService";
|
||||||
|
import { gameData } from "../pubUtils/data";
|
||||||
|
import { GuildModel } from "../db/Guild";
|
||||||
|
import { GuildTrainModel } from "../db/GuildTrain";
|
||||||
|
import { unlockTrain } from "./guildTrainService";
|
||||||
|
|
||||||
// —————————————— 跑马灯 —————————————— //
|
// —————————————— 跑马灯 —————————————— //
|
||||||
// 初始
|
// 初始
|
||||||
@@ -364,4 +368,19 @@ export async function getSurvey(roleId: string, lv: number) {
|
|||||||
let index = recs.findIndex(rec => rec.surveyId == survey.surveyId);
|
let index = recs.findIndex(rec => rec.surveyId == survey.surveyId);
|
||||||
return index == -1
|
return index == -1
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function setTrainLv(guildCode: string, trainLv: string) {
|
||||||
|
let [_lv, _id] = trainLv.split('-');
|
||||||
|
let lv = parseInt(_lv), id = parseInt(_id);
|
||||||
|
if(!isNaN(lv) && !isNaN(id)) {
|
||||||
|
let structure = gameData.trainBase.get(lv);
|
||||||
|
let trainIds = structure?.trainIds||[];
|
||||||
|
let trainId = trainIds[id - 1];
|
||||||
|
if(trainId) {
|
||||||
|
await GuildModel.updateInfo(guildCode, { trainId, trainLv: lv });
|
||||||
|
await GuildTrainModel.resetGuildTrain(guildCode);
|
||||||
|
await unlockTrain(guildCode, trainId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -295,6 +295,7 @@ export class GuildFormParam {
|
|||||||
wishPool: number;
|
wishPool: number;
|
||||||
store: number;
|
store: number;
|
||||||
donate: number;
|
donate: number;
|
||||||
|
trainLv: string;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if(obj) {
|
if(obj) {
|
||||||
@@ -316,6 +317,8 @@ export class GuildFormParam {
|
|||||||
if(this.wishPool && !isNumber(this.wishPool)) return false;
|
if(this.wishPool && !isNumber(this.wishPool)) return false;
|
||||||
if(this.store && !isNumber(this.store)) return false;
|
if(this.store && !isNumber(this.store)) return false;
|
||||||
if(this.donate && !isNumber(this.donate)) return false;
|
if(this.donate && !isNumber(this.donate)) return false;
|
||||||
|
if(this.trainLv && !isString(this.trainLv)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// 军团建筑物
|
// 军团建筑物
|
||||||
import {readFileAndParse, parseGoodStr, decodeArrayListStr} from '../util'
|
import {readFileAndParse, parseGoodStr, decodeArrayListStr, parseNumberList} from '../util'
|
||||||
import { FILENAME } from '../../consts'
|
import { FILENAME } from '../../consts'
|
||||||
import { RewardInter } from '../interface';
|
import { RewardInter } from '../interface';
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
@@ -104,6 +104,8 @@ export interface DicTrainBase {
|
|||||||
readonly difficultyRatio: number;
|
readonly difficultyRatio: number;
|
||||||
// 据点奖励增长系数
|
// 据点奖励增长系数
|
||||||
readonly judianRewardRatio: number;
|
readonly judianRewardRatio: number;
|
||||||
|
// 试炼id
|
||||||
|
readonly trainIds: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
||||||
@@ -111,7 +113,8 @@ const DicTrainKeys: KeysEnum<DicTrainBase> = {
|
|||||||
level: true,
|
level: true,
|
||||||
trainLevel: true,
|
trainLevel: true,
|
||||||
difficultyRatio: true,
|
difficultyRatio: true,
|
||||||
judianRewardRatio: true
|
judianRewardRatio: true,
|
||||||
|
trainIds: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// 捐献所
|
// 捐献所
|
||||||
@@ -192,6 +195,7 @@ export function loadStructure() {
|
|||||||
let arrTrain = readFileAndParse(FILENAME.DIC_GUILD_TRAIN_BASE);
|
let arrTrain = readFileAndParse(FILENAME.DIC_GUILD_TRAIN_BASE);
|
||||||
arrTrain.forEach(o => {
|
arrTrain.forEach(o => {
|
||||||
setStructureConsume(o);
|
setStructureConsume(o);
|
||||||
|
o.trainIds = parseNumberList(o.shilianId);
|
||||||
dicTrainBase.set(o.level, _.pick(o, Object.keys(DicTrainKeys)));
|
dicTrainBase.set(o.level, _.pick(o, Object.keys(DicTrainKeys)));
|
||||||
});
|
});
|
||||||
arrTrain = undefined;
|
arrTrain = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user