87 lines
2.1 KiB
Plaintext
87 lines
2.1 KiB
Plaintext
|
LuaDistributesValhallaRaidTarget = {}
|
||
|
|
||
|
LuaDistributesValhallaRaidTarget.sysID = 0
|
||
|
LuaDistributesValhallaRaidTarget.cmdID = 0
|
||
|
|
||
|
function LuaDistributesValhallaRaidTarget.ExtraPacket(memStream)
|
||
|
-- print('ExtraPacket:'..memStream.Length)
|
||
|
|
||
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
||
|
local sysID = binaryReader:ReadByte()
|
||
|
local cmdID = binaryReader:ReadByte()
|
||
|
packet = LuaDistributesValhallaRaidTarget.ReadPacket(binaryReader)
|
||
|
|
||
|
return packet
|
||
|
end
|
||
|
|
||
|
function LuaDistributesValhallaRaidTarget.SendPacket(packet)
|
||
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesValhallaRaidTarget.sysID, LuaDistributesValhallaRaidTarget.cmdID)
|
||
|
if(packet['serverId'] == nil) then
|
||
|
packet['serverId'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['serverId'])
|
||
|
|
||
|
if(packet['guid'] == nil) then
|
||
|
packet['guid'] = 0
|
||
|
end
|
||
|
message:WriteLong(packet['guid'])
|
||
|
|
||
|
if(packet['name'] == nil) then
|
||
|
packet['name'] = ""
|
||
|
end
|
||
|
message:WriteString(packet['name'])
|
||
|
|
||
|
if(packet['profession'] == nil) then
|
||
|
packet['profession'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['profession'])
|
||
|
|
||
|
if(packet['valhallaLevel'] == nil) then
|
||
|
packet['valhallaLevel'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['valhallaLevel'])
|
||
|
|
||
|
if(packet['power'] == nil) then
|
||
|
packet['power'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['power'])
|
||
|
|
||
|
if(spoils == nil) then
|
||
|
spoils = {}
|
||
|
end
|
||
|
message:WriteInt(#packet['spoils'])
|
||
|
for k,v in ipairs(packet['spoils']) do
|
||
|
require "LuaDistributesMarketingActAwardItem"
|
||
|
LuaDistributesMarketingActAwardItem.WritePacket(v, binaryWriter)
|
||
|
|
||
|
end
|
||
|
|
||
|
|
||
|
message:Send()
|
||
|
end
|
||
|
|
||
|
function LuaDistributesValhallaRaidTarget.ReadPacket(binaryReader)
|
||
|
|
||
|
local packet = {}
|
||
|
packet['serverId'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['guid'] = binaryReader:ReadInt64()
|
||
|
|
||
|
packet['name'] = CS.BinaryMessageHandle.ReadString(binaryReader)
|
||
|
|
||
|
packet['profession'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['valhallaLevel'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['power'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['spoils'] = {}
|
||
|
local spoilsCnt = binaryReader:ReadInt32()
|
||
|
for i=1,spoilsCnt,1 do
|
||
|
require "LuaDistributesMarketingActAwardItem"
|
||
|
packet['spoils'][i] = LuaDistributesMarketingActAwardItem.ReadPacket(binaryReader)
|
||
|
|
||
|
end
|
||
|
|
||
|
return packet
|
||
|
end
|