diff --git a/game-server/app/servers/battle/handler/towerBattleHandler.ts b/game-server/app/servers/battle/handler/towerBattleHandler.ts index a27f7fa93..28e6b630f 100644 --- a/game-server/app/servers/battle/handler/towerBattleHandler.ts +++ b/game-server/app/servers/battle/handler/towerBattleHandler.ts @@ -91,7 +91,7 @@ export class TowerBattleHandler { let num = HANG_UP_CONSTS.MAX_SPD_UP_CNT - hangUpSpdUpCnt + 1; let nextCostGold = calculateNum(GOLD_COST_RATIO.TOWER_HANG_SPDUP, {num}, 50); - return resResult(STATUS.SUCCESS, {startTime, hangUpPassTime: Math.floor(deltaTime/1000), hangUpSpdUpCnt, nextCostGold, rewards: timeReward.map(cur => {return {id: cur.gid, count: cur.count}})}); + return resResult(STATUS.SUCCESS, {startTime, hangUpPassTime: Math.floor(deltaTime/1000), hangUpSpdUpCnt, nextCostGold, rewards: timeReward}); } async recHangUpRewards(msg: {}, session: BackendSession) { diff --git a/game-server/app/services/battleService.ts b/game-server/app/services/battleService.ts index a36686a3b..bc78c85bf 100644 --- a/game-server/app/services/battleService.ts +++ b/game-server/app/services/battleService.ts @@ -150,16 +150,16 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp let notReceivedGoods = notReceivedGoodsList.find(cur => cur.cnt == cnt ); goods = notReceivedGoods?notReceivedGoods.goods:[]; } - for(let {gid, count} of baseReward) { + for(let {id, count} of baseReward) { let newCount = cal.mul(count, multi); - let oldGoods = goods.find(cur => cur.gid == gid); + let oldGoods = goods.find(cur => cur.gid == id); if(oldGoods) newCount = cal.add(newCount, oldGoods.count); let roundCount = Math.floor(newCount); if(newCount > roundCount) { - needReceiveGoods.push({gid, count: cal.sub(newCount, roundCount)}); + needReceiveGoods.push({gid: id, count: cal.sub(newCount, roundCount)}); } if(roundCount > 0) { - timeReward.push({gid, count: roundCount}) + timeReward.push({id, count: roundCount}) } } } @@ -170,16 +170,16 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp let multi = Math.floor(deltaTime / HANG_UP_CONSTS.UNIT_TIME); // 结算奖励的倍数,受最大时间限制 // console.log(deltaTime, multi, baseReward); - for(let {gid, count} of baseReward) { + for(let {id, count} of baseReward) { let newCount = cal.mul(count, multi); - let oldGoods = notReceivedGoods.find(cur => cur.gid == gid); + let oldGoods = notReceivedGoods.find(cur => cur.gid == id); if(oldGoods) newCount = cal.add(newCount, oldGoods.count); let roundCount = Math.floor(newCount); if(newCount > roundCount) { - needReceiveGoods.push({gid, count: cal.sub(newCount, roundCount)}); + needReceiveGoods.push({gid: id, count: cal.sub(newCount, roundCount)}); } if(roundCount > 0) { - timeReward.push({gid, count: roundCount}) + timeReward.push({id, count: roundCount}) } } }