|
|
@ -0,0 +1,20 @@ |
|
|
|
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::character::{CharacterBytesBuilder, FullCharacterBytesBuilder};
|
|
|
|
use crate::ship::location::{ClientLocation, LobbyId, RoomId, RoomLobby, MAX_ROOMS};
|
|
|
|
use libpso::character::character;
|
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
|
|
|
|
|
pub fn update_config<EG: EntityGateway>(id: ClientId,
|
|
|
|
update_config: &UpdateConfig,
|
|
|
|
clients: &mut HashMap<ClientId, ClientState>,
|
|
|
|
entity_gateway: &mut EG)
|
|
|
|
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id)).unwrap();
|
|
|
|
client.character.config.update(update_config);
|
|
|
|
entity_gateway.save_character(&client.character);
|
|
|
|
Box::new(None.into_iter())
|
|
|
|
}
|