boss返回状态改变
This commit is contained in:
@@ -15,6 +15,7 @@ import { CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../../../consts/constModules/it
|
||||
import { handleCost, addItems } from '../../../services/rewardService';
|
||||
import { ARMY } from '../../../pubUtils/dicParam';
|
||||
import { addActive } from '../../../services/guildService';
|
||||
import { GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
|
||||
export default function (app: Application) {
|
||||
return new GuildTrainHandler(app);
|
||||
}
|
||||
@@ -131,14 +132,14 @@ export class GuildTrainHandler {
|
||||
if (!trainInstance)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let { trainInstances } = getArmyTrainJuDian(trainId);
|
||||
let { trainInstances, soloRewardRatio } = getArmyTrainJuDian(trainId);
|
||||
let instance = findWhere(trainInstances, { hid });
|
||||
if (!instance)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
let trainSoloReward = getTrainSoloReward(battleRecord.record.difficulty);
|
||||
if (!trainSoloReward)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
let addScore = isSuccess?trainSoloReward.winScore:trainSoloReward.failScore;
|
||||
let addScore = Math.floor((isSuccess?trainSoloReward.winScore:trainSoloReward.failScore) * (soloRewardRatio + 100 ) / 100);
|
||||
let goods = await addItems(roleId, roleName, sid, [{id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.HONOUR), count: isSuccess?trainSoloReward.failHonour:trainSoloReward.failHonour}]);
|
||||
let guildTrains = [];
|
||||
let trainIds = [];
|
||||
@@ -210,9 +211,13 @@ export class GuildTrainHandler {
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
|
||||
let stru = findWhere(structure, {id: 4});
|
||||
let res:any = await lockData(serverId, GUILD_DATA_NAME.TRAIN_BOX, code + '_' + trainId);//加锁
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
|
||||
let { shilianRewardRatio } = getTrainBaseByLv(GUILD_STRUCTURE.TRAIN);
|
||||
let { heroRewards, trainInstances } = getArmyTrainJuDian(trainId);
|
||||
let { progress } = findWhere(trainInstances, {hid});
|
||||
let guildTrain = await GuildTrainModel.findTrainInstanceBoxByIndex(code, roleId, trainId, hid, index, progress, nowSeconds());
|
||||
@@ -222,6 +227,7 @@ export class GuildTrainHandler {
|
||||
}
|
||||
|
||||
let good = getRandomByLen(heroRewards);
|
||||
good.count = Math.floor((100 + shilianRewardRatio) * good.count/100);
|
||||
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