战场:扫荡奖励
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { BattleDropModel } from '../db/BattleDrop';
|
||||
import { getRandEelmWithWeight, getRandSingleEelm } from '../pubUtils/util';
|
||||
import { BATTLE_REWARD_TYPE, BLUEPRT_CONST } from '../consts';
|
||||
import { addItems } from './rewardService';
|
||||
import { addItems, combineItemAndEquips } from './rewardService';
|
||||
import { BattleBlueprtDropModel } from '../db/BattleBlueprtDrop'
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
@@ -22,7 +22,7 @@ export class WarReward {
|
||||
private condition: Map<number, boolean>;
|
||||
private warInfo: DicWar;
|
||||
private isSuccess: boolean;
|
||||
private rewards: Array<{type: number, id: number, count: number, times: number}>;
|
||||
private rewards: Array<{type?: number, id: number, count: number, times?: number}>;
|
||||
private fixReward: Array<{id: number, count: number}>;
|
||||
private conditionReward: Array<{id: number, count: number, condition: number}>;
|
||||
private randomReward: Array<{id: number, count: number, frequency: number}>;
|
||||
@@ -169,7 +169,7 @@ export class WarReward {
|
||||
}
|
||||
}
|
||||
|
||||
public async saveReward(num: number) {
|
||||
public async saveReward(num: number, combine: boolean = false) {
|
||||
this.rewards = new Array();
|
||||
// let warType = this.warInfo.warType;
|
||||
|
||||
@@ -179,10 +179,13 @@ export class WarReward {
|
||||
if(this.conditionReward) this.handleConditionReward(num, this.conditionReward);
|
||||
if(this.randomReward) await this.handleRandomReward(num, this.randomReward);
|
||||
|
||||
if(this.costAp > 0) await this.handlerBlueprtReward(num);
|
||||
// if(this.costAp > 0) await this.handlerBlueprtReward(num);
|
||||
}
|
||||
|
||||
let rewards = this.rewards.sort((a, b) => a.times - b.times)
|
||||
let rewards = this.rewards;
|
||||
if(combine) {
|
||||
rewards = combineItemAndEquips(rewards);
|
||||
}
|
||||
await addItems(this.roleId, this.roleName, this.sid, rewards);
|
||||
return rewards;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user