Commit 7474dd1267a95ee9b5b1c8803cbd65b4c4621228

Authored by zhouhaihai
1 parent 1d45a501

资助抽奖bug

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
src/actions/AdvAction.lua
@@ -636,10 +636,10 @@ function _M.wheelSurfRpc(agent, data) @@ -636,10 +636,10 @@ function _M.wheelSurfRpc(agent, data)
636 local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] 636 local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)]
637 if not drawData then return 4 end 637 if not drawData then return 4 end
638 638
639 - local costs = drawData.cost:toNumMap()  
640 - for id, count_ in pairs(costs) do  
641 - costs[id] = count_ * count  
642 - end 639 + local cost = drawData.cost:toArray(true, "=")
  640 + local costs = {[ItemId.OldCoin] = cost[ctype]}
  641 + if not next(costs) then return 6 end
  642 +
643 643
644 if not role:checkItemEnough(costs) then return 5 end 644 if not role:checkItemEnough(costs) then return 5 end
645 role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) 645 role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}})
@@ -648,10 +648,10 @@ function _M.wheelSurfRpc(agent, data) @@ -648,10 +648,10 @@ function _M.wheelSurfRpc(agent, data)
648 advDrawB[ptype] = (advDrawB[ptype] or 0) + count 648 advDrawB[ptype] = (advDrawB[ptype] or 0) + count
649 role:updateProperty({field = "advDrawB", value = advDrawB}) 649 role:updateProperty({field = "advDrawB", value = advDrawB})
650 -- 随机池子 650 -- 随机池子
651 - local pool = drawData.weight:randWeight()  
652 local reward = {} 651 local reward = {}
653 local backReward = {} 652 local backReward = {}
654 for i = 1, count do 653 for i = 1, count do
  654 + local pool = drawData.weight:randWeight()
655 local gift = drawData["pool" .. pool]:randWeight(true) 655 local gift = drawData["pool" .. pool]:randWeight(true)
656 reward[gift[1]] = (reward[gift[1]] or 0) + gift[2] 656 reward[gift[1]] = (reward[gift[1]] or 0) + gift[2]
657 table.insert(backReward, gift) 657 table.insert(backReward, gift)