Commit f603a60f151bcc11f3ed64f16d0b26cc4552bb68
1 parent
18323af7
支援技实装
Showing
6 changed files
with
50 additions
and
2 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -127,6 +127,7 @@ actionCodes = { | @@ -127,6 +127,7 @@ actionCodes = { | ||
| 127 | Friend_pointRpc = 459, | 127 | Friend_pointRpc = 459, |
| 128 | Friend_updateProperty = 460, | 128 | Friend_updateProperty = 460, |
| 129 | Friend_randomRpc = 461, | 129 | Friend_randomRpc = 461, |
| 130 | + Friend_battleInfoRpc = 462, | ||
| 130 | 131 | ||
| 131 | 132 | ||
| 132 | Pvp_formatCommonRpc = 500, | 133 | Pvp_formatCommonRpc = 500, |
src/actions/FriendAction.lua
| @@ -642,5 +642,15 @@ function _M.randomRpc(agent, data) | @@ -642,5 +642,15 @@ function _M.randomRpc(agent, data) | ||
| 642 | return true | 642 | return true |
| 643 | end | 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 | return _M | 656 | return _M |
| 647 | \ No newline at end of file | 657 | \ No newline at end of file |
src/actions/HangAction.lua
| @@ -202,12 +202,22 @@ function _M.roleFormatRpc(agent , data) | @@ -202,12 +202,22 @@ function _M.roleFormatRpc(agent , data) | ||
| 202 | return | 202 | return |
| 203 | end | 203 | end |
| 204 | end | 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 | table.clear(hangTeam) | 214 | table.clear(hangTeam) |
| 206 | hangTeam.heros = {} | 215 | hangTeam.heros = {} |
| 207 | for slot, heroId in pairs(msg.heros) do | 216 | for slot, heroId in pairs(msg.heros) do |
| 208 | hangTeam.heros[slot] = heroId | 217 | hangTeam.heros[slot] = heroId |
| 209 | end | 218 | end |
| 210 | hangTeam.leader = msg.leader | 219 | hangTeam.leader = msg.leader |
| 220 | + hangTeam.supports = supports | ||
| 211 | role:saveHangTeam(hangTeam) | 221 | role:saveHangTeam(hangTeam) |
| 212 | SendPacket(actionCodes.Hang_roleFormatRpc, '') | 222 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
| 213 | return true | 223 | return true |
| @@ -351,12 +361,21 @@ function _M.bonusFormatRpc(agent , data) | @@ -351,12 +361,21 @@ function _M.bonusFormatRpc(agent , data) | ||
| 351 | return | 361 | return |
| 352 | end | 362 | end |
| 353 | end | 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 | table.clear(bTeam) | 372 | table.clear(bTeam) |
| 355 | bTeam.heros = {} | 373 | bTeam.heros = {} |
| 356 | for slot, heroId in pairs(msg.heros) do | 374 | for slot, heroId in pairs(msg.heros) do |
| 357 | bTeam.heros[slot] = heroId | 375 | bTeam.heros[slot] = heroId |
| 358 | end | 376 | end |
| 359 | bTeam.leader = msg.leader | 377 | bTeam.leader = msg.leader |
| 378 | + bTeam.supports = supports | ||
| 360 | 379 | ||
| 361 | role:updateProperty({field = "bTeam", value = bTeam}) | 380 | role:updateProperty({field = "bTeam", value = bTeam}) |
| 362 | SendPacket(actionCodes.Hang_bonusFormatRpc, '') | 381 | SendPacket(actionCodes.Hang_bonusFormatRpc, '') |
src/actions/PvpAction.lua
| @@ -29,6 +29,13 @@ function _M.formatCommonRpc(agent , data) | @@ -29,6 +29,13 @@ function _M.formatCommonRpc(agent , data) | ||
| 29 | if not msg.heros or not next(msg.heros) then | 29 | if not msg.heros or not next(msg.heros) then |
| 30 | return | 30 | return |
| 31 | end | 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 | table.clear(pvpTC) | 40 | table.clear(pvpTC) |
| 34 | pvpTC.heros = {} | 41 | pvpTC.heros = {} |
| @@ -36,6 +43,7 @@ function _M.formatCommonRpc(agent , data) | @@ -36,6 +43,7 @@ function _M.formatCommonRpc(agent , data) | ||
| 36 | pvpTC.heros[slot] = heroId | 43 | pvpTC.heros[slot] = heroId |
| 37 | end | 44 | end |
| 38 | pvpTC.leader = msg.leader | 45 | pvpTC.leader = msg.leader |
| 46 | + pvpTC.supports = supports | ||
| 39 | 47 | ||
| 40 | role:savePvpCTeam(pvpTC) | 48 | role:savePvpCTeam(pvpTC) |
| 41 | SendPacket(actionCodes.Pvp_formatCommonRpc, '') | 49 | SendPacket(actionCodes.Pvp_formatCommonRpc, '') |
src/actions/TowerAction.lua
| @@ -17,12 +17,20 @@ function _M.roleFormatRpc(agent , data) | @@ -17,12 +17,20 @@ function _M.roleFormatRpc(agent , data) | ||
| 17 | return | 17 | return |
| 18 | end | 18 | end |
| 19 | end | 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 | table.clear(towerTeam) | 27 | table.clear(towerTeam) |
| 21 | towerTeam.heros = {} | 28 | towerTeam.heros = {} |
| 22 | for slot, heroId in pairs(msg.heros) do | 29 | for slot, heroId in pairs(msg.heros) do |
| 23 | towerTeam.heros[slot] = heroId | 30 | towerTeam.heros[slot] = heroId |
| 24 | end | 31 | end |
| 25 | towerTeam.leader = msg.leader | 32 | towerTeam.leader = msg.leader |
| 33 | + towerTeam.supports = supports | ||
| 26 | 34 | ||
| 27 | role:updateProperty({field = "towerF", value = towerTeam}) | 35 | role:updateProperty({field = "towerF", value = towerTeam}) |
| 28 | SendPacket(actionCodes.Tower_roleFormatRpc, '') | 36 | SendPacket(actionCodes.Tower_roleFormatRpc, '') |
src/models/RolePlugin.lua
| @@ -821,7 +821,7 @@ function RolePlugin.bind(Role) | @@ -821,7 +821,7 @@ function RolePlugin.bind(Role) | ||
| 821 | end | 821 | end |
| 822 | 822 | ||
| 823 | function Role:getTeamBattleInfo(team) | 823 | function Role:getTeamBattleInfo(team) |
| 824 | - local teamInfo = {heros = {}} | 824 | + local teamInfo = {heros = {}, supports = {}} |
| 825 | local activeRelation = self:getHeroActiveRelation(team.heros) | 825 | local activeRelation = self:getHeroActiveRelation(team.heros) |
| 826 | 826 | ||
| 827 | for slot, id in pairs(team.heros or {}) do | 827 | for slot, id in pairs(team.heros or {}) do |
| @@ -840,7 +840,9 @@ function RolePlugin.bind(Role) | @@ -840,7 +840,9 @@ function RolePlugin.bind(Role) | ||
| 840 | info.specialLevel = hero:getSkillLevel(1) | 840 | info.specialLevel = hero:getSkillLevel(1) |
| 841 | teamInfo.heros[slot] = info | 841 | teamInfo.heros[slot] = info |
| 842 | end | 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 | return teamInfo | 846 | return teamInfo |
| 845 | end | 847 | end |
| 846 | 848 |