Commit cc87434b1cfe63349590b2b4e55c6307bee2f89c
1 parent
e0ba98e4
时钟箱拆解
Showing
1 changed file
with
3 additions
and
4 deletions
Show diff stats
src/actions/RoleAction.lua
| @@ -443,7 +443,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -443,7 +443,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 443 | if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot)) then return end | 443 | if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot)) then return end |
| 444 | 444 | ||
| 445 | local boxL = role:getProperty("boxL") | 445 | local boxL = role:getProperty("boxL") |
| 446 | - local reward | 446 | + local reward = {} |
| 447 | if oper == 1 then -- 打开 | 447 | if oper == 1 then -- 打开 |
| 448 | local itemId = msg.itemId | 448 | local itemId = msg.itemId |
| 449 | if role:getItemCount(itemId) < 1 then return end | 449 | if role:getItemCount(itemId) < 1 then return end |
| @@ -497,8 +497,8 @@ function _M.openTimeBoxRpc(agent, data) | @@ -497,8 +497,8 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 497 | 497 | ||
| 498 | if gemId ~= 0 and next(selectGift) then | 498 | if gemId ~= 0 and next(selectGift) then |
| 499 | randomNum = randomNum - 1 | 499 | randomNum = randomNum - 1 |
| 500 | - local idx = math.randWeight(pool, 3) | ||
| 501 | - reward[pool[idx][1]] = (reward[pool[idx][1]] or 0) + pool[idx][2] | 500 | + local idx = math.randWeight(selectGift, 3) |
| 501 | + reward[selectGift[idx][1]] = (reward[selectGift[idx][1]] or 0) + selectGift[idx][2] | ||
| 502 | end | 502 | end |
| 503 | 503 | ||
| 504 | local needCount = math.min(#pool, randomNum) | 504 | local needCount = math.min(#pool, randomNum) |
| @@ -509,7 +509,6 @@ function _M.openTimeBoxRpc(agent, data) | @@ -509,7 +509,6 @@ function _M.openTimeBoxRpc(agent, data) | ||
| 509 | end | 509 | end |
| 510 | end | 510 | end |
| 511 | 511 | ||
| 512 | - | ||
| 513 | boxL[slot] = nil | 512 | boxL[slot] = nil |
| 514 | reward = role:award(reward) | 513 | reward = role:award(reward) |
| 515 | role:checkTaskEnter("OpenBox") | 514 | role:checkTaskEnter("OpenBox") |