Commit 5cf05cdad1cff8ce56a966e38ba8a229963f6244
1 parent
f6322b6d
fix: 解决小概率事件,当购买数量>10000的判断在消耗物品的前面。
避免把物品消耗掉,但是无法得到奖励的情况。
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
src/actions/StoreAction.lua
... | ... | @@ -399,7 +399,6 @@ function _M.shopBuyRpc(agent , data) |
399 | 399 | end |
400 | 400 | |
401 | 401 | if not role:checkItemEnough(cost) then return 4 end |
402 | - if not role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) then return 5 end | |
403 | 402 | |
404 | 403 | local buyRecord = role.storeData:getProperty("buyR") |
405 | 404 | if math.illegalNum(count, 1, (dataSet.limit == 0 and 10000 or dataSet.limit - (buyRecord[id] or 0))) then |
... | ... | @@ -407,6 +406,8 @@ function _M.shopBuyRpc(agent , data) |
407 | 406 | return 6 |
408 | 407 | end |
409 | 408 | |
409 | + if not role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) then return 5 end | |
410 | + | |
410 | 411 | local limitStr = "" |
411 | 412 | if dataSet.limit ~= 0 then |
412 | 413 | buyRecord[id] = (buyRecord[id] or 0) + count | ... | ... |