Commit f603a60f151bcc11f3ed64f16d0b26cc4552bb68
1 parent
18323af7
支援技实装
Showing
6 changed files
with
50 additions
and
2 deletions
Show diff stats
src/ProtocolCode.lua
src/actions/FriendAction.lua
... | ... | @@ -642,5 +642,15 @@ function _M.randomRpc(agent, data) |
642 | 642 | return true |
643 | 643 | end |
644 | 644 | |
645 | +function _M.battleInfoRpc(agent, data) | |
646 | + local role = agent.role | |
647 | + local roleId = role:getProperty("id") | |
648 | + local msg = MsgPack.unpack(data) | |
649 | + local objId = msg.roleId | |
650 | + local online, matchInfo = rpcRole(objId, "friendBattleInfo") | |
651 | + SendPacket(actionCodes.Friend_battleInfoRpc, MsgPack.pack({matchInfo = matchInfo})) | |
652 | + return true | |
653 | +end | |
654 | + | |
645 | 655 | |
646 | 656 | return _M |
647 | 657 | \ No newline at end of file | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -202,12 +202,22 @@ function _M.roleFormatRpc(agent , data) |
202 | 202 | return |
203 | 203 | end |
204 | 204 | end |
205 | + | |
206 | + local supports = {} | |
207 | + for slot, support in pairs(msg.supports or {}) do | |
208 | + if slot ~= 1 and slot ~= 2 then return end | |
209 | + local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | |
210 | + if level <= 0 then return end | |
211 | + supports[slot] = support | |
212 | + end | |
213 | + | |
205 | 214 | table.clear(hangTeam) |
206 | 215 | hangTeam.heros = {} |
207 | 216 | for slot, heroId in pairs(msg.heros) do |
208 | 217 | hangTeam.heros[slot] = heroId |
209 | 218 | end |
210 | 219 | hangTeam.leader = msg.leader |
220 | + hangTeam.supports = supports | |
211 | 221 | role:saveHangTeam(hangTeam) |
212 | 222 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
213 | 223 | return true |
... | ... | @@ -351,12 +361,21 @@ function _M.bonusFormatRpc(agent , data) |
351 | 361 | return |
352 | 362 | end |
353 | 363 | end |
364 | + local supports = {} | |
365 | + for slot, support in pairs(msg.supports) do | |
366 | + if slot ~= 1 and slot ~= 2 then return end | |
367 | + local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | |
368 | + if level <= 0 then return end | |
369 | + supports[slot] = support | |
370 | + end | |
371 | + | |
354 | 372 | table.clear(bTeam) |
355 | 373 | bTeam.heros = {} |
356 | 374 | for slot, heroId in pairs(msg.heros) do |
357 | 375 | bTeam.heros[slot] = heroId |
358 | 376 | end |
359 | 377 | bTeam.leader = msg.leader |
378 | + bTeam.supports = supports | |
360 | 379 | |
361 | 380 | role:updateProperty({field = "bTeam", value = bTeam}) |
362 | 381 | SendPacket(actionCodes.Hang_bonusFormatRpc, '') | ... | ... |
src/actions/PvpAction.lua
... | ... | @@ -29,6 +29,13 @@ function _M.formatCommonRpc(agent , data) |
29 | 29 | if not msg.heros or not next(msg.heros) then |
30 | 30 | return |
31 | 31 | end |
32 | + local supports = {} | |
33 | + for slot, support in pairs(msg.supports) do | |
34 | + if slot ~= 1 and slot ~= 2 then return end | |
35 | + local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | |
36 | + if level <= 0 then return end | |
37 | + supports[slot] = support | |
38 | + end | |
32 | 39 | |
33 | 40 | table.clear(pvpTC) |
34 | 41 | pvpTC.heros = {} |
... | ... | @@ -36,6 +43,7 @@ function _M.formatCommonRpc(agent , data) |
36 | 43 | pvpTC.heros[slot] = heroId |
37 | 44 | end |
38 | 45 | pvpTC.leader = msg.leader |
46 | + pvpTC.supports = supports | |
39 | 47 | |
40 | 48 | role:savePvpCTeam(pvpTC) |
41 | 49 | SendPacket(actionCodes.Pvp_formatCommonRpc, '') | ... | ... |
src/actions/TowerAction.lua
... | ... | @@ -17,12 +17,20 @@ function _M.roleFormatRpc(agent , data) |
17 | 17 | return |
18 | 18 | end |
19 | 19 | end |
20 | + local supports = {} | |
21 | + for slot, support in pairs(msg.supports) do | |
22 | + if slot ~= 1 and slot ~= 2 then return end | |
23 | + local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | |
24 | + if level <= 0 then return end | |
25 | + supports[slot] = support | |
26 | + end | |
20 | 27 | table.clear(towerTeam) |
21 | 28 | towerTeam.heros = {} |
22 | 29 | for slot, heroId in pairs(msg.heros) do |
23 | 30 | towerTeam.heros[slot] = heroId |
24 | 31 | end |
25 | 32 | towerTeam.leader = msg.leader |
33 | + towerTeam.supports = supports | |
26 | 34 | |
27 | 35 | role:updateProperty({field = "towerF", value = towerTeam}) |
28 | 36 | SendPacket(actionCodes.Tower_roleFormatRpc, '') | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -821,7 +821,7 @@ function RolePlugin.bind(Role) |
821 | 821 | end |
822 | 822 | |
823 | 823 | function Role:getTeamBattleInfo(team) |
824 | - local teamInfo = {heros = {}} | |
824 | + local teamInfo = {heros = {}, supports = {}} | |
825 | 825 | local activeRelation = self:getHeroActiveRelation(team.heros) |
826 | 826 | |
827 | 827 | for slot, id in pairs(team.heros or {}) do |
... | ... | @@ -840,7 +840,9 @@ function RolePlugin.bind(Role) |
840 | 840 | info.specialLevel = hero:getSkillLevel(1) |
841 | 841 | teamInfo.heros[slot] = info |
842 | 842 | end |
843 | - -- todo 支援技能 | |
843 | + for slot, id in pairs(team.supports or {}) do | |
844 | + teamInfo.supports[slot] = {id, self.dinerData:getProperty("dishTree"):getv(id, 0)} | |
845 | + end | |
844 | 846 | return teamInfo |
845 | 847 | end |
846 | 848 | ... | ... |