shared banks #130
19
src/ship/chatcommand.rs
Normal file
19
src/ship/chatcommand.rs
Normal file
@ -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<EG>(id: ClientId,
|
||||
message: PlayerChat,
|
||||
state: &mut ShipServerState<EG>)
|
||||
-> Option<Result<Vec<(ClientId, SendShipPacket)>, anyhow::Error>>
|
||||
where
|
||||
EG: EntityGateway + Clone + 'static,
|
||||
{
|
||||
|
||||
None
|
||||
}
|
@ -13,3 +13,4 @@ pub mod packet;
|
||||
pub mod quests;
|
||||
pub mod shops;
|
||||
pub mod trade;
|
||||
pub mod chatcommand;
|
||||
|
@ -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<EG: EntityGateway + Clone> ServerState for ShipServerState<EG> {
|
||||
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?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user