|
|
@ -2,7 +2,7 @@ use std::collections::HashMap; |
|
|
|
use libpso::packet::ship::*;
|
|
|
|
use crate::common::serverstate::ClientId;
|
|
|
|
use crate::common::leveltable::CharacterLevelTable;
|
|
|
|
use crate::ship::ship::{SendShipPacket, ShipError, ClientState};
|
|
|
|
use crate::ship::ship::{SendShipPacket, ShipError, ClientState, Clients};
|
|
|
|
use crate::ship::character::{CharacterBytesBuilder, FullCharacterBytesBuilder};
|
|
|
|
use crate::ship::location::{ClientLocation, LobbyId, RoomId, RoomLobby, MAX_ROOMS};
|
|
|
|
use libpso::character::character;
|
|
|
@ -11,7 +11,7 @@ use crate::entity::gateway::EntityGateway; |
|
|
|
pub fn player_chat(id: ClientId,
|
|
|
|
msg: &PlayerChat,
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
clients: &HashMap<ClientId, ClientState>) -> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError> {
|
|
|
|
clients: &Clients) -> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError> {
|
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
let cmsg = PlayerChat::new(client.user.id.0, msg.message.clone());
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ pub fn player_chat(id: ClientId, |
|
|
|
pub fn request_infoboard(id: ClientId,
|
|
|
|
request_infoboard: &ViewInfoboardRequest,
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
clients: &HashMap<ClientId, ClientState>)
|
|
|
|
clients: &Clients)
|
|
|
|
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
|
let area_clients = client_location.get_client_neighbors(id).unwrap();
|
|
|
|
let r = area_clients.iter()
|
|
|
@ -42,7 +42,7 @@ pub fn request_infoboard(id: ClientId, |
|
|
|
|
|
|
|
pub fn write_infoboard<EG: EntityGateway>(id: ClientId,
|
|
|
|
new_infoboard: &WriteInfoboard,
|
|
|
|
clients: &mut HashMap<ClientId, ClientState>,
|
|
|
|
clients: &mut Clients,
|
|
|
|
entity_gateway: &mut EG)
|
|
|
|
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id)).unwrap();
|
|
|
|