75 lines
1.8 KiB
Plaintext
75 lines
1.8 KiB
Plaintext
LuaDistributesRetDraw = {}
|
|
|
|
LuaDistributesRetDraw.sysID = 3
|
|
LuaDistributesRetDraw.cmdID = 17
|
|
|
|
function LuaDistributesRetDraw.ExtraPacket(memStream)
|
|
-- print('ExtraPacket:'..memStream.Length)
|
|
|
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
|
local sysID = binaryReader:ReadByte()
|
|
local cmdID = binaryReader:ReadByte()
|
|
packet = LuaDistributesRetDraw.ReadPacket(binaryReader)
|
|
|
|
return packet
|
|
end
|
|
|
|
function LuaDistributesRetDraw.SendPacket(packet)
|
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesRetDraw.sysID, LuaDistributesRetDraw.cmdID)
|
|
if(packet['actID'] == nil) then
|
|
packet['actID'] = 0
|
|
end
|
|
message:WriteInt(packet['actID'])
|
|
|
|
if(result == nil) then
|
|
result = {}
|
|
end
|
|
message:WriteInt(#packet['result'])
|
|
for k,v in ipairs(packet['result']) do
|
|
require "LuaDistributesMarketingDrawItem"
|
|
LuaDistributesMarketingDrawItem.WritePacket(v, binaryWriter)
|
|
|
|
end
|
|
|
|
if(descList == nil) then
|
|
descList = {}
|
|
end
|
|
message:WriteInt(#packet['descList'])
|
|
for k,v in ipairs(packet['descList']) do
|
|
if(v == nil) then
|
|
v = ""
|
|
end
|
|
message:WriteString(v)
|
|
end
|
|
|
|
if(packet['appointGroup'] == nil) then
|
|
packet['appointGroup'] = 0
|
|
end
|
|
message:WriteInt(packet['appointGroup'])
|
|
|
|
|
|
message:Send()
|
|
end
|
|
|
|
function LuaDistributesRetDraw.ReadPacket(binaryReader)
|
|
|
|
local packet = {}
|
|
packet['actID'] = binaryReader:ReadInt32()
|
|
|
|
packet['result'] = {}
|
|
local resultCnt = binaryReader:ReadInt32()
|
|
for i=1,resultCnt,1 do
|
|
require "LuaDistributesMarketingDrawItem"
|
|
packet['result'][i] = LuaDistributesMarketingDrawItem.ReadPacket(binaryReader)
|
|
|
|
end
|
|
packet['descList'] = {}
|
|
local descListCnt = binaryReader:ReadInt32()
|
|
for i=1,descListCnt,1 do
|
|
packet['descList'][i] = CS.BinaryMessageHandle.ReadString(binaryReader)
|
|
end
|
|
packet['appointGroup'] = binaryReader:ReadInt32()
|
|
|
|
|
|
return packet
|
|
end |