Commit c5fe43c2b0b215e641f80517398530177872dd92

Authored by zhangqijia
1 parent d1944a2b

fix: 活动派遣不占用正常讨伐电台派遣队伍数量

Showing 1 changed file with 22 additions and 6 deletions   Show diff stats
src/actions/RadioAction.lua
... ... @@ -113,14 +113,29 @@ function _M.startQuestRpc(agent, data)
113 113 local msg = MsgPack.unpack(data)
114 114 local id = msg.id
115 115 local heros = msg.heros
116   - local result = {}
117   - local radioTask = role:getProperty("radioTask")
118   - if table.numbers(radioTask) >= getQuestMax(role) then
119   - return 1
120   - end
  116 +
121 117 -- check id
122 118 local config = csvdb["crusadeCsv"][id]
123   - if not config then return 2 end
  119 + if not config then return 1 end
  120 +
  121 + local radioTask = role:getProperty("radioTask")
  122 +
  123 + local getTaskNum = function ()
  124 + local num = 0
  125 + for _, v in pairs(radioTask or {}) do
  126 + if (v.actid or 0) == 0 then
  127 + num = num + 1
  128 + end
  129 + end
  130 + return num
  131 + end
  132 +
  133 + if config.activity_ctrl_id == 0 then
  134 + if getTaskNum() >= getQuestMax(role) then
  135 + return 2
  136 + end
  137 + end
  138 +
124 139 if not role:checkHangPass(config.unlock) then return 3 end
125 140 if radioTask[id] then return 4 end
126 141 -- check hero
... ... @@ -172,6 +187,7 @@ function _M.startQuestRpc(agent, data)
172 187 local taskData = {}
173 188 taskData["time"] = skynet.timex() + config.time + timeSub
174 189 taskData["heros"] = heros
  190 + taskData["actid"] = config.activity_ctrl_id
175 191 radioTask[id] = taskData
176 192 role:updateProperty({field="radioTask", value=radioTask, notNotify=true})
177 193  
... ...