Commit 21c09fa267684a5e1b46046b9e2f4be4584a89e0

Authored by zhangqijia
1 parent 963598f6

fix: 活动派遣 同时只能有一个存在

Showing 1 changed file with 13 additions and 7 deletions   Show diff stats
src/actions/RadioAction.lua
@@ -120,20 +120,26 @@ function _M.startQuestRpc(agent, data) @@ -120,20 +120,26 @@ function _M.startQuestRpc(agent, data)
120 120
121 local radioTask = role:getProperty("radioTask") 121 local radioTask = role:getProperty("radioTask")
122 122
123 - local getTaskNum = function ()  
124 - local num = 0 123 + local getActIDs = function ()
  124 + local actids = {}
125 for _, v in pairs(radioTask or {}) do 125 for _, v in pairs(radioTask or {}) do
126 - if (v.actid or 0) == 0 then  
127 - num = num + 1  
128 - end 126 + actids[v.actid] = (actids[v.actid] or 0) + 1
129 end 127 end
130 - return num 128 + return actids
131 end 129 end
132 130
  131 + local actids = getActIDs()
133 if config.activity_ctrl_id == 0 then 132 if config.activity_ctrl_id == 0 then
134 - if getTaskNum() >= getQuestMax(role) then 133 + --非活动 判断数量
  134 + if (actids[config.activity_ctrl_id] or 0) >= getQuestMax(role) then
135 return 2 135 return 2
136 end 136 end
  137 +
  138 + else
  139 + --活动 同时只能有一个存在
  140 + if actids[config.activity_ctrl_id] >= 1 then
  141 + return 5
  142 + end
137 end 143 end
138 144
139 if not role:checkHangPass(config.unlock) then return 3 end 145 if not role:checkHangPass(config.unlock) then return 3 end