fix 镇念塔挂机奖励无法获取

This commit is contained in:
luying
2020-12-30 14:35:45 +08:00
parent 76d3b30886
commit f6bf60b384
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -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})
}
}
}