Commit 7efe52757435c83b3d894bc2fb0daf94c133d97f

Authored by zhouhaihai
1 parent 43716efb

检查leader

Showing 1 changed file with 10 additions and 1 deletions   Show diff stats
src/actions/HangAction.lua
... ... @@ -202,6 +202,13 @@ function _M.endBattleRpc(agent, data)
202 202 return true
203 203 end
204 204  
  205 +local function checkLeader(heros, leader)
  206 + if not leader then return end
  207 + for slot, heroId in pairs(heros) do
  208 + if heroId == leader then return true end
  209 + end
  210 +end
  211 +
205 212 function _M.roleFormatRpc(agent , data)
206 213 local role = agent.role
207 214 local msg = MsgPack.unpack(data)
... ... @@ -219,6 +226,7 @@ function _M.roleFormatRpc(agent , data)
219 226 if level <= 0 then return end
220 227 supports[slot] = support
221 228 end
  229 + if not checkLeader(hangTeam.heros, hangTeam.leader) then return end
222 230  
223 231 table.clear(hangTeam)
224 232 hangTeam.heros = {}
... ... @@ -377,7 +385,8 @@ function _M.bonusFormatRpc(agent , data)
377 385 if level <= 0 then return end
378 386 supports[slot] = support
379 387 end
380   -
  388 + if not checkLeader(msg.heros, msg.leader) then return end
  389 +
381 390 table.clear(bTeam)
382 391 bTeam.heros = {}
383 392 for slot, heroId in pairs(msg.heros) do
... ...