Commit 0ce1cab5994fb3533ca5e836b9f62ec69fba4c89
1 parent
cab7184b
好友赠送能量活动bug修复
Showing
1 changed file
with
17 additions
and
12 deletions
Show diff stats
src/actions/ActivityAction.lua
@@ -899,7 +899,7 @@ function _M.friendHelpRpc(agent, data) | @@ -899,7 +899,7 @@ function _M.friendHelpRpc(agent, data) | ||
899 | 899 | ||
900 | local actid = 37 | 900 | local actid = 37 |
901 | if not role.activity:isOpenById(actid, "FriendEnergy") then return 1 end | 901 | if not role.activity:isOpenById(actid, "FriendEnergy") then return 1 end |
902 | - if oper < 1 or oper > 3 then return 2 end | 902 | + if oper < 1 or oper > 4 then return 2 end |
903 | 903 | ||
904 | local actCsv = csvdb["activity_ctrlCsv"][actid] | 904 | local actCsv = csvdb["activity_ctrlCsv"][actid] |
905 | local getLimit = actCsv.condition | 905 | local getLimit = actCsv.condition |
@@ -1025,17 +1025,17 @@ function _M.friendHelpRpc(agent, data) | @@ -1025,17 +1025,17 @@ function _M.friendHelpRpc(agent, data) | ||
1025 | if not role:checkItemEnough(cost) then return 7 end | 1025 | if not role:checkItemEnough(cost) then return 7 end |
1026 | role:costItems(cost, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) | 1026 | role:costItems(cost, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) |
1027 | 1027 | ||
1028 | - if rewardCsv.reward ~= "" then | 1028 | + if rewardData.reward ~= "" then |
1029 | result = 1 | 1029 | result = 1 |
1030 | - award = rewardCsv.reward:toNumMap() | 1030 | + award = rewardData.reward:toNumMap() |
1031 | end | 1031 | end |
1032 | - if rewardCsv.reward_random ~= "" then | 1032 | + if rewardData.reward_random ~= "" then |
1033 | result = 1 | 1033 | result = 1 |
1034 | local pool = {} | 1034 | local pool = {} |
1035 | - for _, temp in pairs(rewardCsv.reward_random:toArray()) do | 1035 | + for _, temp in pairs(rewardData.reward_random:toArray()) do |
1036 | table.insert(pool, temp:toArray(true, "=")) | 1036 | table.insert(pool, temp:toArray(true, "=")) |
1037 | end | 1037 | end |
1038 | - local gift = pool(math.randWeight(pool, 3)) | 1038 | + local gift = pool[math.randWeight(pool, 3)] |
1039 | award[gift[1]] = (award[gift[1]] or 0) + gift[2] | 1039 | award[gift[1]] = (award[gift[1]] or 0) + gift[2] |
1040 | end | 1040 | end |
1041 | rewards[level] = 1 | 1041 | rewards[level] = 1 |
@@ -1046,14 +1046,19 @@ function _M.friendHelpRpc(agent, data) | @@ -1046,14 +1046,19 @@ function _M.friendHelpRpc(agent, data) | ||
1046 | end | 1046 | end |
1047 | 1047 | ||
1048 | local ids = {} | 1048 | local ids = {} |
1049 | + local members = {} | ||
1049 | local friendIds = getIds() | 1050 | local friendIds = getIds() |
1050 | - redisproxy:pipelining(function(red) | ||
1051 | - for id, _ in pairs(friendIds) do | ||
1052 | - if red:sismember(FRIEND_ENERGY:format(roleId), id) then | ||
1053 | - ids[id] = 1 | ||
1054 | - end | 1051 | + local temp = redisproxy:smembers(FRIEND_ENERGY:format(roleId)) |
1052 | + for _, id in pairs(temp) do | ||
1053 | + members[tonumber(id)] = 1 | ||
1054 | + end | ||
1055 | + | ||
1056 | + for id, _ in pairs(friendIds) do | ||
1057 | + if members[id] then | ||
1058 | + ids[id] = 1 | ||
1055 | end | 1059 | end |
1056 | - end) | 1060 | + end |
1061 | + | ||
1057 | actData.new = ids | 1062 | actData.new = ids |
1058 | 1063 | ||
1059 | local reward, change | 1064 | local reward, change |