fix 镇念塔挂机奖励无法获取
This commit is contained in:
@@ -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})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user