PvpAction.lua
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
local ipairs = ipairs
local table = table
local math = math
local redisproxy = redisproxy
local MsgPack = MsgPack
local _M = {}
function _M.formatCommonRpc(agent , data)
local role = agent.role
local roleId = role:getProperty("id")
local msg = MsgPack.unpack(data)
local pvpTC = role:getProperty("pvpTC")
for slot, heroId in pairs(msg.heros) do
if not role.heros[heroId] then
return
end
end
if not next(msg.heros) then
return
end
table.clear(pvpTC)
pvpTC.heros = {}
for slot, heroId in pairs(msg.heros) do
pvpTC.heros[slot] = heroId
end
pvpTC.leader = msg.leader
role:savePvpCTeam(pvpTC)
SendPacket(actionCodes.Pvp_formatCommonRpc, '')
return true
end
function _M.formatHighRpc(agent , data)
local role = agent.role
local msg = MsgPack.unpack(data)
local pvpTH = role.pvpData:getProperty("pvpTH")
role.pvpData:updateProperty({field = "pvpTH", value = pvpTH})
SendPacket(actionCodes.Pvp_formatHighRpc, '')
return true
end
function _M.refreshMatchRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
local pvpData = role.pvpData
pvpData:refreshMatchC()
SendPacket(actionCodes.Pvp_refreshMatchRpc, '')
return true
end
function _M.buyCountRpc(agent, data)
local role = agent.role
local msg = MsgPack.unpack(data)
SendPacket(actionCodes.Pvp_buyCountRpc, '')
return true
end
function _M.startBattleRpc(agent, data)
end
function _M.endBattleRpc(agent, data)
end
function _M.matchListRpc(agent, data)
end
return _M