From 538e9773445d285746f5905b4443809d90a8e3fe Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Fri, 13 Mar 2020 11:25:42 +0800 Subject: [PATCH] 上宝石 --- src/actions/RoleAction.lua | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index b954d54..c5c34e0 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -457,16 +457,7 @@ function _M.openTimeBoxRpc(agent, data) if boxL[slot] then return end role:costItems({[itemId] = 1}) boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} - - -- 上宝石 - local gemId = msg.gem or 0 - -- local num = randomData[gemId .. "_gem_num"] - -- if num then - -- if not role:checkItemEnough({[gemId] = 1}) then return end - -- role:costItems({[gemId] = 1}) - -- end - - boxL[slot].gem = gemId + elseif oper == 2 then -- 领取 local quick = msg.quick if not boxL[slot] then return end @@ -482,27 +473,15 @@ function _M.openTimeBoxRpc(agent, data) local randomData = csvdb["item_randomCsv"][itemData.id] reward = randomData.gift:toNumMap() -- 固定奖励 -- 随机奖励 - local gemId = boxL[slot].gem local reward = {} for i = 1, 10 do local num = randomData["num" .. i] local gift = randomData["gift" .. i] if num and gift and num > 0 and gift ~= "" then local pool = {} - local selectGift = {} for _, temp in ipairs(gift:toArray()) do local set = temp:toArray(true, "=") - if gemId == set[1] then - table.insert(selectGift, set) - else - table.insert(pool, set) - end - end - - if gemId ~= 0 and next(selectGift) then - num = num - 1 - local idx = math.randWeight(selectGift, 3) - reward[selectGift[idx][1]] = (reward[selectGift[idx][1]] or 0) + selectGift[idx][2] + table.insert(pool, set) end local needCount = math.min(#pool, num) -- libgit2 0.21.2