diff --git a/src/ship/chatcommand.rs b/src/ship/chatcommand.rs new file mode 100644 index 0000000..0e8bab2 --- /dev/null +++ b/src/ship/chatcommand.rs @@ -0,0 +1,19 @@ + +use libpso::packet::ship::PlayerChat; +use crate::entity::gateway::EntityGateway; + +use crate::common::serverstate::ClientId; +use crate::ship::ship::{ShipServerState, SendShipPacket}; + + + +pub async fn handle_chat_command(id: ClientId, + message: PlayerChat, + state: &mut ShipServerState) + -> Option, anyhow::Error>> +where + EG: EntityGateway + Clone + 'static, +{ + + None +} diff --git a/src/ship/mod.rs b/src/ship/mod.rs index 3bc573b..c58edb6 100644 --- a/src/ship/mod.rs +++ b/src/ship/mod.rs @@ -13,3 +13,4 @@ pub mod packet; pub mod quests; pub mod shops; pub mod trade; +pub mod chatcommand; diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 4bbed5e..9464407 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -28,6 +28,7 @@ use crate::ship::map::{Maps, MapsError, MapAreaError, generate_free_roam_maps}; use crate::ship::packet::handler; use crate::ship::shops::{WeaponShop, ToolShop, ArmorShop}; use crate::ship::trade::TradeState; +use crate::ship::chatcommand; // TODO: remove once stuff settles down pub use crate::ship::client::*; @@ -733,8 +734,15 @@ impl ServerState for ShipServerState { self.direct_message(id, msg).await? }, RecvShipPacket::PlayerChat(msg) => { - let block = self.blocks.get_from_client(id, &self.clients).await?; - handler::communication::player_chat(id, msg, &block.client_location, &self.clients).await? + match chatcommand::handle_chat_command(id, msg.clone(), &mut self).await { + Some(ccmd) => { + ccmd? + }, + None => { + let block = self.blocks.get_from_client(id, &self.clients).await?; + handler::communication::player_chat(id, msg, &block.client_location, &self.clients).await? + } + } }, RecvShipPacket::CreateRoom(create_room) => { let block = self.blocks.get_from_client(id, &self.clients).await?;