|
|
@ -6,7 +6,7 @@ use crate::common::serverstate::ClientId; |
|
|
|
use crate::common::leveltable::CharacterLevelTable;
|
|
|
|
use crate::ship::ship::{SendShipPacket, ShipError, Rooms, Clients, ItemDropLocation};
|
|
|
|
use crate::ship::location::{ClientLocation, ClientLocationError};
|
|
|
|
use crate::ship::items::{ItemManager, ClientItemId};
|
|
|
|
use crate::ship::items::{ItemManager, ClientItemId, InventoryItem};
|
|
|
|
use crate::ship::packet::builder;
|
|
|
|
|
|
|
|
pub async fn request_exp<EG: EntityGateway>(id: ClientId,
|
|
|
@ -356,3 +356,21 @@ where |
|
|
|
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub async fn player_sorts_items<EG>(id: ClientId,
|
|
|
|
pkt: &SortItems,
|
|
|
|
entity_gateway: &mut EG,
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
clients: &Clients,
|
|
|
|
item_manager: &mut ItemManager)
|
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError>
|
|
|
|
where
|
|
|
|
EG: EntityGateway
|
|
|
|
{
|
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
let room_id = client_location.get_room(id).map_err(|err| -> ClientLocationError { err.into() })?;
|
|
|
|
let clients_in_area = client_location.get_clients_in_room(room_id).map_err(|err| -> ClientLocationError { err.into() })?;
|
|
|
|
item_manager.player_sorts_items(entity_gateway, &client.character, pkt.item_ids).await?;
|
|
|
|
let sort_packet = pkt.clone();
|
|
|
|
Ok(Box::new(None.into_iter())) // Do clients care about the order of other clients items?
|
|
|
|
}
|