Ejemplo n.º 1
0
	REQUEST_GET_SALT:      new(requestGetSaltCodec),
	REQUEST_GET_WHOAMI:    new(requestGetWhoamiCodec),
	REQUEST_MESSAGE:       new(requestMessageCodec),
	REQUEST_REDIRECT:      new(requestRedirectCodec),
	REQUEST_GET_PLAYERS:   new(requestGetPlayersCodec),
	REQUEST_NOTIFY_PLAYER: new(requestNotifyPlayerCodec),
	REQUEST_GET_DETAILS:   new(requestGetDetailsCodec),
}

var resultCodecs = []ResultCodec{
	REQUEST_AUTHENTICATE:  new(resultAuthenticateCodec),
	REQUEST_AS_SERVER:     new(resultAsServerCodec),
	REQUEST_AS_PROXY:      new(resultAsProxyCodec),
	REQUEST_GET_SALT:      new(resultGetSaltCodec),
	REQUEST_GET_WHOAMI:    new(resultGetWhoamiCodec),
	REQUEST_MESSAGE:       new(resultMessageCodec),
	REQUEST_REDIRECT:      new(resultRedirectCodec),
	REQUEST_GET_PLAYERS:   new(resultGetPlayersCodec),
	REQUEST_NOTIFY_PLAYER: new(resultNotifyPlayerCodec),
	REQUEST_GET_DETAILS:   new(resultGetDetailsCodec),
}

var PacketCodec = packet.NewPacketCodecRegistry([]packet.PacketCodec{
	PACKET_KEEPALIVE:      new(packetKeepaliveCodec),
	PACKET_REQUEST:        new(packetRequestCodec),
	PACKET_RESULT:         new(packetResultCodec),
	PACKET_MESSAGE_EVENT:  new(packetMessageEventCodec),
	PACKET_REDIRECT_EVENT: new(packetRedirectEventCodec),
	PACKET_SERVER_EVENT:   new(packetServerEventCodec),
})
Ejemplo n.º 2
0
	PACKET_SERVER_PLUGIN_MESSAGE                = 0x17

	PACKET_CLIENT_STATUS_RESPONSE = 0x00
	PACKET_CLIENT_STATUS_PING     = 0x01
	PACKET_SERVER_STATUS_REQUEST  = 0x00
	PACKET_SERVER_STATUS_PING     = 0x01

	PACKET_CLIENT_LOGIN_DISCONNECT       = 0x00
	PACKET_CLIENT_LOGIN_ENCRYPT_REQUEST  = 0x01
	PACKET_CLIENT_LOGIN_SUCCESS          = 0x02
	PACKET_SERVER_LOGIN_START            = 0x00
	PACKET_SERVER_LOGIN_ENCRYPT_RESPONSE = 0x01
)

var HandshakePacketClientCodecs = []packet.PacketCodec{}
var HandshakePacketClientCodec = packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(HandshakePacketClientCodecs))

var HandshakePacketServerCodecs = []packet.PacketCodec{
	PACKET_SERVER_HANDSHAKE: &PacketServerHandshakeCodec{},
}
var HandshakePacketServerCodec = packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(HandshakePacketServerCodecs))

var PlayPacketClientCodecs = []packet.PacketCodec{
	PACKET_CLIENT_KEEPALIVE:                     &PacketGenericCodec{PACKET_CLIENT_KEEPALIVE},
	PACKET_CLIENT_JOIN_GAME:                     &PacketClientJoinGameCodec{},
	PACKET_CLIENT_CHAT:                          &PacketGenericCodec{PACKET_CLIENT_CHAT},
	PACKET_CLIENT_TIME_UPDATE:                   &PacketGenericCodec{PACKET_CLIENT_TIME_UPDATE},
	PACKET_CLIENT_ENTITY_EQUIPMENT:              &PacketGenericCodec{PACKET_CLIENT_ENTITY_EQUIPMENT},
	PACKET_CLIENT_SPAWN_POSITION:                &PacketGenericCodec{PACKET_CLIENT_SPAWN_POSITION},
	PACKET_CLIENT_UPDATE_HEALTH:                 &PacketGenericCodec{PACKET_CLIENT_UPDATE_HEALTH},
	PACKET_CLIENT_RESPAWN:                       &PacketClientRespawnCodec{},
Ejemplo n.º 3
0
	REQUEST_GET_WHOAMI:    &RequestGetWhoamiCodec{},
	REQUEST_MESSAGE:       &RequestMessageCodec{},
	REQUEST_REDIRECT:      &RequestRedirectCodec{},
	REQUEST_GET_PLAYERS:   &RequestGetPlayersCodec{},
	REQUEST_NOTIFY_PLAYER: &RequestNotifyPlayerCodec{},
	REQUEST_GET_DETAILS:   &RequestGetDetailsCodec{},
}

var resultCodecs = []ResultCodec{
	REQUEST_AUTHENTICATE:  &ResultAuthenticateCodec{},
	REQUEST_AS_SERVER:     &ResultAsServerCodec{},
	REQUEST_AS_PROXY:      &ResultAsProxyCodec{},
	REQUEST_GET_SALT:      &ResultGetSaltCodec{},
	REQUEST_GET_WHOAMI:    &ResultGetWhoamiCodec{},
	REQUEST_MESSAGE:       &ResultMessageCodec{},
	REQUEST_REDIRECT:      &ResultRedirectCodec{},
	REQUEST_GET_PLAYERS:   &ResultGetPlayersCodec{},
	REQUEST_NOTIFY_PLAYER: &ResultNotifyPlayerCodec{},
	REQUEST_GET_DETAILS:   &ResultGetDetailsCodec{},
}

var PacketCodecs = []packet.PacketCodec{
	PACKET_KEEPALIVE:      &PacketKeepaliveCodec{},
	PACKET_REQUEST:        &PacketRequestCodec{},
	PACKET_RESULT:         &PacketResultCodec{nil},
	PACKET_MESSAGE_EVENT:  &PacketMessageEventCodec{},
	PACKET_REDIRECT_EVENT: &PacketRedirectEventCodec{},
	PACKET_SERVER_EVENT:   &PacketServerEventCodec{},
}
var PacketCodec = packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(PacketCodecs))
Ejemplo n.º 4
0
func NewCodec(connectClient Connect) packet.PacketCodec {
	packetCodecs := make([]packet.PacketCodec, len(connect.PacketCodecs))
	copy(packetCodecs, connect.PacketCodecs)
	packetCodecs[connect.PACKET_RESULT] = connect.NewPacketResultCodec(connectClient)
	return packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(packetCodecs))
}