- fix: formatting for packet routing
This commit is contained in:
@@ -73,6 +73,7 @@ impl PacketRouter {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub async fn route_packet(
|
pub async fn route_packet(
|
||||||
&self,
|
&self,
|
||||||
stream: &mut TcpStream,
|
stream: &mut TcpStream,
|
||||||
@@ -82,122 +83,24 @@ impl PacketRouter {
|
|||||||
debug!("Routing packet: {:?}", packet);
|
debug!("Routing packet: {:?}", packet);
|
||||||
match packet.packet_type {
|
match packet.packet_type {
|
||||||
// Generic Server Packets
|
// Generic Server Packets
|
||||||
PacketType::PakcsAlive => {
|
PacketType::PakcsAlive => auth::handle_alive_req(stream, packet, self.auth_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
auth::handle_alive_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.auth_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsAcceptReq => auth::handle_accept_req(stream, packet).await,
|
PacketType::PakcsAcceptReq => auth::handle_accept_req(stream, packet).await,
|
||||||
PacketType::PakcsJoinServerTokenReq => {
|
PacketType::PakcsJoinServerTokenReq => auth::handle_join_server_req(stream, packet, self.auth_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
auth::handle_join_server_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.auth_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
// Login Packets
|
// Login Packets
|
||||||
PacketType::PakcsLoginTokenReq => {
|
PacketType::PakcsLoginTokenReq => auth::handle_login_req(stream, packet, self.auth_client.clone(), self.connection_service.clone(), connection_id, stream.peer_addr()?).await,
|
||||||
auth::handle_login_req(
|
PacketType::PakcsLogoutReq => auth::handle_logout_req(stream, packet, self.auth_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
stream,
|
PacketType::PakcsSrvSelectReq => auth::handle_server_select_req(stream, packet, self.connection_service.clone(), connection_id).await,
|
||||||
packet,
|
|
||||||
self.auth_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
stream.peer_addr()?,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsLogoutReq => {
|
|
||||||
auth::handle_logout_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.auth_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsSrvSelectReq => {
|
|
||||||
auth::handle_server_select_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsChannelListReq => auth::handle_channel_list_req(stream, packet).await,
|
PacketType::PakcsChannelListReq => auth::handle_channel_list_req(stream, packet).await,
|
||||||
|
|
||||||
// Character Packets
|
// Character Packets
|
||||||
PacketType::PakcsCharListReq => {
|
PacketType::PakcsCharListReq => character::handle_char_list_req(stream, packet, self.character_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
character::handle_char_list_req(
|
PacketType::PakcsCreateCharReq => character::handle_create_char_req(stream, packet, self.character_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
stream,
|
PacketType::PakcsDeleteCharReq => character::handle_delete_char_req(stream, packet, self.character_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
packet,
|
PacketType::PakcsSelectCharReq => character::handle_select_char_req(stream, packet, self.character_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
self.character_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsCreateCharReq => {
|
|
||||||
character::handle_create_char_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.character_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsDeleteCharReq => {
|
|
||||||
character::handle_delete_char_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.character_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsSelectCharReq => {
|
|
||||||
character::handle_select_char_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.character_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
|
|
||||||
// World Packets
|
// World Packets
|
||||||
PacketType::PakcsChangeMapReq => {
|
PacketType::PakcsChangeMapReq => world::handle_change_map_req(stream, packet, self.character_client.clone(), self.connection_service.clone(), connection_id).await,
|
||||||
world::handle_change_map_req(
|
PacketType::PakcsMouseCmd => world::handle_mouse_cmd_req(stream, packet, self.connection_service.clone(), connection_id).await,
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.character_client.clone(),
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
PacketType::PakcsMouseCmd => {
|
|
||||||
world::handle_mouse_cmd_req(
|
|
||||||
stream,
|
|
||||||
packet,
|
|
||||||
self.connection_service.clone(),
|
|
||||||
connection_id,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1 => chat::handle_chat(packet).await?,
|
// 1 => chat::handle_chat(packet).await?,
|
||||||
// 2 => movement::handle_movement(packet).await?,
|
// 2 => movement::handle_movement(packet).await?,
|
||||||
|
|||||||
Reference in New Issue
Block a user