예제 #1
0
func NewInitPacket() []byte {
	buffer := new(packets.Buffer)
	buffer.WriteByte(0x00)                       // Packet type: Init
	buffer.Write([]byte{0x9c, 0x77, 0xed, 0x03}) // Session id?
	buffer.Write([]byte{0x5a, 0x78, 0x00, 0x00}) // Protocol version : 785a

	return buffer.Bytes()
}
예제 #2
0
func NewLoginOkPacket(sessionID []byte) []byte {
	buffer := new(packets.Buffer)
	buffer.WriteByte(0x03)       // Packet type: LoginOk
	buffer.Write(sessionID[:4])  // Session id 1/2
	buffer.Write(sessionID[4:8]) // Session id 2/2
	buffer.WriteUInt32(0x00)
	buffer.WriteUInt32(0x00)
	buffer.WriteUInt32(0x000003ea)
	buffer.WriteUInt32(0x00)
	buffer.WriteUInt32(0x00)
	buffer.WriteUInt32(0x02)

	return buffer.Bytes()
}