军团:试炼表修改
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 { UserGuildModel } from '../../../db/UserGuild';
|
||||
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 { handleCost, addItems } from '../../../services/rewardService';
|
||||
import { ARMY } from '../../../pubUtils/dicParam';
|
||||
@@ -21,6 +21,7 @@ import { pushGuildTrainSucMsg } from '../../../services/chatService';
|
||||
import { checkActivityTask, checkTask } from '../../../services/taskService';
|
||||
import { sendPopUpActivityData } from '../../../services/guildActivityService';
|
||||
import { guildInter } from '../../../pubUtils/interface';
|
||||
import { getGuildTrainGkInfo } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -99,7 +100,7 @@ export class GuildTrainHandler {
|
||||
const { guildCode: code } = userGuild;
|
||||
if (userGuild.trainCount <= 0)
|
||||
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)
|
||||
return resResult(STATUS.GUILD_TRAIN_LEVEL_IS_COMPLETE);
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId, 'trainId isComplete trainInstances');
|
||||
@@ -120,7 +121,7 @@ export class GuildTrainHandler {
|
||||
$set: {
|
||||
roleId, roleName, battleId,
|
||||
status: 0,
|
||||
record: { heroes: [], trainId, hid, guildCode: code, difficulty },
|
||||
record: { heroes: [], trainId, hid, guildCode: code, difficulty, trainLv },
|
||||
}
|
||||
}, true);
|
||||
return resResult(STATUS.SUCCESS, { battleCode });
|
||||
@@ -161,8 +162,8 @@ export class GuildTrainHandler {
|
||||
$set: { status: isSuccess ? 1 : 2 }
|
||||
}, true);//设置战斗状态
|
||||
|
||||
let trainId = battleRecord.record.trainId;
|
||||
let hid = battleRecord.record.hid;
|
||||
let { trainId, trainLv, hid, difficulty } = battleRecord.record;
|
||||
let maxTrainId = gameData.lastGuildTrainIdOfLv.get(trainLv);
|
||||
let res: any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
@@ -183,7 +184,7 @@ export class GuildTrainHandler {
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let trainSoloReward = getTrainSoloReward(battleRecord.record.difficulty);
|
||||
let trainSoloReward = getTrainSoloReward(difficulty);
|
||||
if (!trainSoloReward) {//获得个人奖励信息
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
@@ -200,7 +201,7 @@ export class GuildTrainHandler {
|
||||
// ranks.push({ score: addScore, roleId });//新增排名
|
||||
// }
|
||||
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);
|
||||
if (trainInstance.progress < 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);
|
||||
|
||||
//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);
|
||||
|
||||
if (needLockNext) {
|
||||
if (needLockNext && maxTrainId > trainId) {
|
||||
guildTrain = await unlockTrain(code, trainId + 1);
|
||||
}
|
||||
res.releaseCallback();//解锁
|
||||
@@ -279,8 +280,8 @@ export class GuildTrainHandler {
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
|
||||
let { shilianRewardRatio } = getTrainBaseByLv(trainLv);
|
||||
let { heroRewards, trainInstances } = getArmyTrainJuDian(trainId);
|
||||
let { trainInstances } = getArmyTrainJuDian(trainId);
|
||||
let trainInfo = getGuildTrainGkInfo(trainId, hid);
|
||||
let { progress } = findWhere(trainInstances, { hid });
|
||||
console.log('progress = ' + progress);
|
||||
let guildTrain = await GuildTrainModel.findTrainInstanceBoxByIndex(code, trainId, hid, progress);
|
||||
@@ -304,8 +305,7 @@ export class GuildTrainHandler {
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.GUILD_TRAIN_BOX_IS_GOT);
|
||||
}
|
||||
let good = getRandSingleEelm(heroRewards);
|
||||
good.count = Math.floor((100 + shilianRewardRatio) * good.count / 100);
|
||||
let good = getRandSingleEelm(trainInfo.heroRewards);
|
||||
let goods = await addItems(roleId, roleName, sid, [good]);
|
||||
|
||||
let resGuildTrain = await GuildTrainModel.receiveBoxByIndex(code, roleId, trainId, hid, index, good);
|
||||
|
||||
Reference in New Issue
Block a user