镇念塔:重复发放奖励
This commit is contained in:
@@ -214,6 +214,9 @@ export class NormalBattleHandler {
|
||||
return towerEndResult.resResult;
|
||||
}
|
||||
towerStatus = towerEndResult.data.towerStatus;
|
||||
|
||||
console.log('##### towerReward', JSON.stringify(towerEndResult.data.towerReward));
|
||||
|
||||
if (towerEndResult.data.towerReward)
|
||||
warReward.setFixReward(towerEndResult.data.towerReward)
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ export async function towerBattleEnd(sid: string, roleId: string, serverId: numb
|
||||
inc = wars.length == dicTower.warArray.length? 1: 0;
|
||||
}
|
||||
let newRec = await TowerRecordModel.updateRecord(roleId, towerLv, battleCode, battleId, heroes, inc);
|
||||
let towerReward: RewardInter[] = null;
|
||||
let towerReward: RewardInter[] = [];
|
||||
if (inc === 1) {
|
||||
let role = await RoleModel.towerLvUp(roleId);
|
||||
// 更新redis
|
||||
@@ -242,7 +242,7 @@ export async function towerBattleEnd(sid: string, roleId: string, serverId: numb
|
||||
|
||||
await createNewTowerRecord(roleId, role.towerLv);
|
||||
const { reward } = gameData.tower.get(role.towerLv - 1);
|
||||
if (reward) towerReward = reward;
|
||||
if (reward) towerReward = [...reward];
|
||||
await checkAndStartHungUp(roleId, roleName, role.towerLv);
|
||||
// 任务
|
||||
await checkTask(serverId, roleId, sid, TASK_TYPE.BATTLE_TOWER_LV, { towerLv: role.towerLv - 1 });
|
||||
|
||||
@@ -37,9 +37,9 @@ export class WarReward {
|
||||
this.battleId = battleId;
|
||||
this.warInfo = gameData.war.get(battleId);
|
||||
let { fixReward, conditionReward, randomReward } = this.warInfo;
|
||||
this.fixReward = fixReward;
|
||||
this.conditionReward = conditionReward;
|
||||
this.randomReward = randomReward;
|
||||
this.setFixReward(fixReward);
|
||||
this.setConditionReward(conditionReward);
|
||||
this.setRandomReward(randomReward);
|
||||
}
|
||||
this.condition = new Map();
|
||||
|
||||
@@ -53,6 +53,7 @@ export class WarReward {
|
||||
|
||||
public setFixReward(reward: RewardInter[]) {
|
||||
for(let r of reward) {
|
||||
console.log('#####setFixReward', JSON.stringify(r));
|
||||
this.fixReward.push(r);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +84,7 @@ export class WarReward {
|
||||
if(!this.fixReward) return
|
||||
for(let i = 0; i < num; i++) {
|
||||
for(let obj of this.fixReward) {
|
||||
console.log('##### handleFixReward', JSON.stringify(obj));
|
||||
this.rewards.push({type: BATTLE_REWARD_TYPE.FIX_REWARD, times: i +1, ...obj, count: obj.count });
|
||||
}
|
||||
}
|
||||
@@ -156,6 +158,7 @@ export class WarReward {
|
||||
if(combine) {
|
||||
rewards = combineItems(rewards);
|
||||
}
|
||||
console.log('##### saveReward', JSON.stringify(rewards))
|
||||
await addItems(this.roleId, this.roleName, this.sid, rewards, getReasonByWarType(this.warInfo.warType));
|
||||
return rewards;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user