Commit 782ee57d82b4940d5a12ba7d25faa2b0442df800
1 parent
1a558f5e
多编队功能
Showing
6 changed files
with
84 additions
and
17 deletions
Show diff stats
src/ProtocolCode.lua
... | ... | @@ -73,6 +73,7 @@ actionCodes = { |
73 | 73 | Adv_quickHangRpc = 170, |
74 | 74 | Adv_refreshSupportRpc = 171, |
75 | 75 | Adv_selectTeamRpc = 172, |
76 | + Adv_roleFormatRpc = 173, | |
76 | 77 | |
77 | 78 | Hero_loadInfos = 201, |
78 | 79 | Hero_updateProperty = 202, |
... | ... | @@ -215,6 +216,10 @@ actionCodes = { |
215 | 216 | Activity_actPaySignRewardNtf = 654, |
216 | 217 | Activity_actCalendaTaskRpc = 655, |
217 | 218 | Activity_actPaySignRpc = 656, |
219 | + | |
220 | + Radio_listRpc = 700, -- 获取电台讨伐任务列表 | |
221 | + Radio_startQuestRpc = 701, | |
222 | + Radio_finishQuestRpc = 702, | |
218 | 223 | } |
219 | 224 | |
220 | 225 | rpcResponseBegin = 10000 | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -980,15 +980,19 @@ function _M.roleFormatRpc(agent , data) |
980 | 980 | role:setAdvTeamFormat(index, team) |
981 | 981 | |
982 | 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 | 995 | end |
989 | - advTeam.leader = msg.leader | |
990 | - advTeam.leader2 = msg.leader2 | |
991 | - role:updateProperty({field = "advTeam", value = advTeam}) | |
992 | 996 | |
993 | 997 | SendPacket(actionCodes.Adv_roleFormatRpc, '') |
994 | 998 | return true |
... | ... | @@ -1000,6 +1004,7 @@ function _M.selectTeamRpc(agent, data) |
1000 | 1004 | local index = msg.index -- 阵容索引 |
1001 | 1005 | local team = role:getAdvTeamFormat(index) |
1002 | 1006 | if not next(team) then return end |
1007 | + team["index"] = index | |
1003 | 1008 | role:updateProperty({field = "advTeam", value = team}) |
1004 | 1009 | |
1005 | 1010 | SendPacket(actionCodes.Adv_selectTeamRpc, '') | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -315,7 +315,6 @@ function _M.roleFormatRpc(agent , data) |
315 | 315 | local msg = MsgPack.unpack(data) |
316 | 316 | local index = msg.index -- 阵容索引 |
317 | 317 | local title = msg.title -- 阵容名称 |
318 | - local type = msg.type -- 系统类型 | |
319 | 318 | local team = {} |
320 | 319 | for slot, heroId in pairs(msg.heros) do |
321 | 320 | if not role.heros[heroId] then |
... | ... | @@ -349,13 +348,6 @@ function _M.roleFormatRpc(agent , data) |
349 | 348 | team.title = title |
350 | 349 | |
351 | 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 | 352 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
361 | 353 | return true |
... | ... | @@ -710,6 +702,11 @@ function _M.selectTeamRpc(agent, data) |
710 | 702 | teamIndex[type] = index |
711 | 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 | 710 | SendPacket(actionCodes.Hang_selectTeamRpc, '') |
714 | 711 | return true |
715 | 712 | end | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -633,6 +633,7 @@ end |
633 | 633 | function _M.getResetRewardRpc(agent, data) |
634 | 634 | local role = agent.role |
635 | 635 | local msg = MsgPack.unpack(data) |
636 | + local pay = msg.pay | |
636 | 637 | |
637 | 638 | local hero = role.heros[msg.id] |
638 | 639 | if not hero then return end |
... | ... | @@ -641,8 +642,17 @@ function _M.getResetRewardRpc(agent, data) |
641 | 642 | local breakL = hero:getProperty("breakL") |
642 | 643 | local talent = hero:getProperty("talent") |
643 | 644 | |
645 | + local tmpLevel = level | |
644 | 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 | 656 | local reward = {} |
647 | 657 | while level > 1 do |
648 | 658 | local curData = csvdb["unit_expCsv"][level - 1] |
... | ... | @@ -708,9 +718,11 @@ function _M.getResetRewardRpc(agent, data) |
708 | 718 | rune = "", |
709 | 719 | }) |
710 | 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 | 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 | 726 | end |
715 | 727 | local change |
716 | 728 | reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}}) | ... | ... |
... | ... | @@ -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 | 48 | \ No newline at end of file | ... | ... |
src/models/Role.lua
... | ... | @@ -363,6 +363,7 @@ function Role:data() |
363 | 363 | bTeam = self:getProperty("bTeam"), |
364 | 364 | hangTeams = self:getProperty("hangTeams"), |
365 | 365 | teamIndex = self:getProperty("teamIndex"), |
366 | + advTeams = self:getProperty("advTeams"), | |
366 | 367 | |
367 | 368 | newerGuide = self:getProperty("newerGuide"), |
368 | 369 | funcGuide = self:getProperty("funcGuide"), | ... | ... |