Commit 782ee57d82b4940d5a12ba7d25faa2b0442df800

Authored by liuzujun
1 parent 1a558f5e

多编队功能

src/ProtocolCode.lua
@@ -73,6 +73,7 @@ actionCodes = { @@ -73,6 +73,7 @@ actionCodes = {
73 Adv_quickHangRpc = 170, 73 Adv_quickHangRpc = 170,
74 Adv_refreshSupportRpc = 171, 74 Adv_refreshSupportRpc = 171,
75 Adv_selectTeamRpc = 172, 75 Adv_selectTeamRpc = 172,
  76 + Adv_roleFormatRpc = 173,
76 77
77 Hero_loadInfos = 201, 78 Hero_loadInfos = 201,
78 Hero_updateProperty = 202, 79 Hero_updateProperty = 202,
@@ -215,6 +216,10 @@ actionCodes = { @@ -215,6 +216,10 @@ actionCodes = {
215 Activity_actPaySignRewardNtf = 654, 216 Activity_actPaySignRewardNtf = 654,
216 Activity_actCalendaTaskRpc = 655, 217 Activity_actCalendaTaskRpc = 655,
217 Activity_actPaySignRpc = 656, 218 Activity_actPaySignRpc = 656,
  219 +
  220 + Radio_listRpc = 700, -- 获取电台讨伐任务列表
  221 + Radio_startQuestRpc = 701,
  222 + Radio_finishQuestRpc = 702,
218 } 223 }
219 224
220 rpcResponseBegin = 10000 225 rpcResponseBegin = 10000
src/actions/AdvAction.lua
@@ -980,15 +980,19 @@ function _M.roleFormatRpc(agent , data) @@ -980,15 +980,19 @@ function _M.roleFormatRpc(agent , data)
980 role:setAdvTeamFormat(index, team) 980 role:setAdvTeamFormat(index, team)
981 981
982 local advTeam = role:getProperty("advTeam") 982 local advTeam = role:getProperty("advTeam")
983 - table.clear(advTeam) 983 + local curIndex = advTeam.index
  984 + if curIndex == index then
  985 + table.clear(advTeam)
984 986
985 - advTeam.heros = {}  
986 - for slot, heroId in pairs(msg.heros) do  
987 - advTeam.heros[slot] = heroId 987 + advTeam.heros = {}
  988 + for slot, heroId in pairs(msg.heros) do
  989 + advTeam.heros[slot] = heroId
  990 + end
  991 + advTeam.leader = msg.leader
  992 + advTeam.leader2 = msg.leader2
  993 + advTeam.index = index
  994 + role:updateProperty({field = "advTeam", value = advTeam})
988 end 995 end
989 - advTeam.leader = msg.leader  
990 - advTeam.leader2 = msg.leader2  
991 - role:updateProperty({field = "advTeam", value = advTeam})  
992 996
993 SendPacket(actionCodes.Adv_roleFormatRpc, '') 997 SendPacket(actionCodes.Adv_roleFormatRpc, '')
994 return true 998 return true
@@ -1000,6 +1004,7 @@ function _M.selectTeamRpc(agent, data) @@ -1000,6 +1004,7 @@ function _M.selectTeamRpc(agent, data)
1000 local index = msg.index -- 阵容索引 1004 local index = msg.index -- 阵容索引
1001 local team = role:getAdvTeamFormat(index) 1005 local team = role:getAdvTeamFormat(index)
1002 if not next(team) then return end 1006 if not next(team) then return end
  1007 + team["index"] = index
1003 role:updateProperty({field = "advTeam", value = team}) 1008 role:updateProperty({field = "advTeam", value = team})
1004 1009
1005 SendPacket(actionCodes.Adv_selectTeamRpc, '') 1010 SendPacket(actionCodes.Adv_selectTeamRpc, '')
src/actions/HangAction.lua
@@ -315,7 +315,6 @@ function _M.roleFormatRpc(agent , data) @@ -315,7 +315,6 @@ function _M.roleFormatRpc(agent , data)
315 local msg = MsgPack.unpack(data) 315 local msg = MsgPack.unpack(data)
316 local index = msg.index -- 阵容索引 316 local index = msg.index -- 阵容索引
317 local title = msg.title -- 阵容名称 317 local title = msg.title -- 阵容名称
318 - local type = msg.type -- 系统类型  
319 local team = {} 318 local team = {}
320 for slot, heroId in pairs(msg.heros) do 319 for slot, heroId in pairs(msg.heros) do
321 if not role.heros[heroId] then 320 if not role.heros[heroId] then
@@ -349,13 +348,6 @@ function _M.roleFormatRpc(agent , data) @@ -349,13 +348,6 @@ function _M.roleFormatRpc(agent , data)
349 team.title = title 348 team.title = title
350 349
351 role:setTeamFormat(index, team) 350 role:setTeamFormat(index, team)
352 - if type == TeamSystemType.Hang then  
353 - role:finishGuide(5)  
354 - role:updateHangTeamInfo()  
355 - elseif type == TeamSystemType.BonusBattle then  
356 - elseif type == TeamSystemType.Tower then  
357 - elseif type == TeamSystemType.Dinner then  
358 - end  
359 351
360 SendPacket(actionCodes.Hang_roleFormatRpc, '') 352 SendPacket(actionCodes.Hang_roleFormatRpc, '')
361 return true 353 return true
@@ -710,6 +702,11 @@ function _M.selectTeamRpc(agent, data) @@ -710,6 +702,11 @@ function _M.selectTeamRpc(agent, data)
710 teamIndex[type] = index 702 teamIndex[type] = index
711 role:updateProperty({field = "teamIndex", value = teamIndex}) 703 role:updateProperty({field = "teamIndex", value = teamIndex})
712 704
  705 + if type == TeamSystemType.Hang then
  706 + role:finishGuide(5)
  707 + role:updateHangTeamInfo()
  708 + end
  709 +
713 SendPacket(actionCodes.Hang_selectTeamRpc, '') 710 SendPacket(actionCodes.Hang_selectTeamRpc, '')
714 return true 711 return true
715 end 712 end
src/actions/HeroAction.lua
@@ -633,6 +633,7 @@ end @@ -633,6 +633,7 @@ end
633 function _M.getResetRewardRpc(agent, data) 633 function _M.getResetRewardRpc(agent, data)
634 local role = agent.role 634 local role = agent.role
635 local msg = MsgPack.unpack(data) 635 local msg = MsgPack.unpack(data)
  636 + local pay = msg.pay
636 637
637 local hero = role.heros[msg.id] 638 local hero = role.heros[msg.id]
638 if not hero then return end 639 if not hero then return end
@@ -641,8 +642,17 @@ function _M.getResetRewardRpc(agent, data) @@ -641,8 +642,17 @@ function _M.getResetRewardRpc(agent, data)
641 local breakL = hero:getProperty("breakL") 642 local breakL = hero:getProperty("breakL")
642 local talent = hero:getProperty("talent") 643 local talent = hero:getProperty("talent")
643 644
  645 + local tmpLevel = level
644 if level <= 1 and talent == "" then return end 646 if level <= 1 and talent == "" then return end
645 647
  648 + if level <= 60 then
  649 + pay = false
  650 + end
  651 +
  652 + if pay and not role:costDiamond({count = globalCsv.unit_heroBack_cost or 200, log = {desc = "resetHero", int1 = msg.id}}) then
  653 + return 1
  654 + end
  655 +
646 local reward = {} 656 local reward = {}
647 while level > 1 do 657 while level > 1 do
648 local curData = csvdb["unit_expCsv"][level - 1] 658 local curData = csvdb["unit_expCsv"][level - 1]
@@ -708,9 +718,11 @@ function _M.getResetRewardRpc(agent, data) @@ -708,9 +718,11 @@ function _M.getResetRewardRpc(agent, data)
708 rune = "", 718 rune = "",
709 }) 719 })
710 hero:mylog({desc = "resetHero"}) 720 hero:mylog({desc = "resetHero"})
711 - 721 +
  722 + local coef = globalCsv.unit_back_discount
  723 + coef = (pay or tmpLevel <= 60) and 1 or coef
712 for itemId, count in pairs(reward) do 724 for itemId, count in pairs(reward) do
713 - reward[itemId] = math.floor(count * globalCsv.unit_back_discount) 725 + reward[itemId] = math.floor(count * coef)
714 end 726 end
715 local change 727 local change
716 reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) 728 reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
src/actions/RadioAction.lua 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +local _M = {}
  2 +
  3 +function _M.listRpc(agent, data)
  4 + local role = agent.role
  5 + local roleId = role:getProperty("id")
  6 + local now = skynet.timex()
  7 + local result = {}
  8 +
  9 +
  10 + SendPacket(actionCodes.Email_listRpc, MsgPack.pack({list = result}))
  11 + return true
  12 +end
  13 +
  14 +-- 获取英雄大成功率
  15 +local function getHeroCoef()
  16 + return 0
  17 +end
  18 +
  19 +function _M.startQuestRpc(agent, data)
  20 + local role = agent.role
  21 + local msg = MsgPack.unpack(data)
  22 + local id = msg.id
  23 + local heros = msg.heros
  24 + local result = {}
  25 + -- check id
  26 + -- check hero
  27 + -- start quest, set finish time
  28 +
  29 + SendPacket(actionCodes.Email_listRpc, MsgPack.pack({list = result}))
  30 + return true
  31 +end
  32 +
  33 +function _M.finishQuestRpc(agent, data)
  34 + local role = agent.role
  35 + local msg = MsgPack.unpack(data)
  36 + local id = msg.id
  37 + local result = {}
  38 + -- check finish time
  39 + -- check id
  40 + -- get heros
  41 + -- send award
  42 +
  43 + SendPacket(actionCodes.Email_listRpc, MsgPack.pack({list = result}))
  44 + return true
  45 +end
  46 +
  47 +return _M
0 \ No newline at end of file 48 \ No newline at end of file
src/models/Role.lua
@@ -363,6 +363,7 @@ function Role:data() @@ -363,6 +363,7 @@ function Role:data()
363 bTeam = self:getProperty("bTeam"), 363 bTeam = self:getProperty("bTeam"),
364 hangTeams = self:getProperty("hangTeams"), 364 hangTeams = self:getProperty("hangTeams"),
365 teamIndex = self:getProperty("teamIndex"), 365 teamIndex = self:getProperty("teamIndex"),
  366 + advTeams = self:getProperty("advTeams"),
366 367
367 newerGuide = self:getProperty("newerGuide"), 368 newerGuide = self:getProperty("newerGuide"),
368 funcGuide = self:getProperty("funcGuide"), 369 funcGuide = self:getProperty("funcGuide"),