56 lines
1.3 KiB
Plaintext
56 lines
1.3 KiB
Plaintext
LuaDistributesValhallaAvatar = {}
|
|
|
|
LuaDistributesValhallaAvatar.sysID = 0
|
|
LuaDistributesValhallaAvatar.cmdID = 0
|
|
|
|
function LuaDistributesValhallaAvatar.ExtraPacket(memStream)
|
|
-- print('ExtraPacket:'..memStream.Length)
|
|
|
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
|
local sysID = binaryReader:ReadByte()
|
|
local cmdID = binaryReader:ReadByte()
|
|
packet = LuaDistributesValhallaAvatar.ReadPacket(binaryReader)
|
|
|
|
return packet
|
|
end
|
|
|
|
function LuaDistributesValhallaAvatar.SendPacket(packet)
|
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesValhallaAvatar.sysID, LuaDistributesValhallaAvatar.cmdID)
|
|
if(packet['id'] == nil) then
|
|
packet['id'] = 0
|
|
end
|
|
message:WriteInt(packet['id'])
|
|
|
|
if(packet['untilMax'] == nil) then
|
|
packet['untilMax'] = 0
|
|
end
|
|
message:WriteByte(packet['untilMax'])
|
|
|
|
if(packet['autoBuy'] == nil) then
|
|
packet['autoBuy'] = 0
|
|
end
|
|
message:WriteByte(packet['autoBuy'])
|
|
|
|
if(packet['untilOrange'] == nil) then
|
|
packet['untilOrange'] = 0
|
|
end
|
|
message:WriteByte(packet['untilOrange'])
|
|
|
|
|
|
message:Send()
|
|
end
|
|
|
|
function LuaDistributesValhallaAvatar.ReadPacket(binaryReader)
|
|
|
|
local packet = {}
|
|
packet['id'] = binaryReader:ReadInt32()
|
|
|
|
packet['untilMax'] = binaryReader:ReadByte()
|
|
|
|
packet['autoBuy'] = binaryReader:ReadByte()
|
|
|
|
packet['untilOrange'] = binaryReader:ReadByte()
|
|
|
|
|
|
return packet
|
|
end |