addItem goodType修改

This commit is contained in:
luying
2020-12-18 17:13:49 +08:00
parent f2c124a6e4
commit 623e760005
13 changed files with 187 additions and 242 deletions
+7 -4
View File
@@ -7,13 +7,14 @@ import { BattleDropModel } from '../db/BattleDrop';
import { getWarById, getBluePrtByQuality, getGamedata } from '../pubUtils/gamedata';
import { decodeStr, getRefTime, getRandomWithWeight, getRandomByLen } from '../pubUtils/util';
import { BATTLE_REWARD_TYPE, BLUEPRT_CONST } from '../consts';
import { handleReward } from './rewardService';
import { addItems } from './rewardService';
import { BattleBlueprtDropModel } from '../db/BattleBlueprtDrop'
import { RoleModel } from '../db/Role';
export class WarReward {
private roleId: string;
private roleName: string;
private sid: string;
private battleId: number;
private condition: Map<number, boolean>;
private warInfo: any;
@@ -24,9 +25,10 @@ export class WarReward {
private randomReward: string;
private costAp: number;
constructor(roleId: string, roleName: string, battleId: number, isSuccess: boolean) {
constructor(roleId: string, roleName: string, sid: string, battleId: number, isSuccess: boolean) {
this.roleId = roleId;
this.roleName = roleName;
this.sid = sid;
this.battleId = battleId;
this.condition = new Map();
this.warInfo = getWarById(battleId);
@@ -196,8 +198,9 @@ export class WarReward {
if(this.costAp > 0) await this.handlerBlueprtReward(num);
}
let returnGoods = await handleReward(this.roleId, this.roleName, this.rewards);
return returnGoods;
let rewards = this.rewards.sort((a, b) => a.times - b.times)
await addItems(this.roleId, this.roleName, this.sid, rewards);
return rewards;
}
}