|
@ -8,7 +8,7 @@ use crate::ship::location::{ClientLocation, ClientLocationError}; |
|
|
use crate::ship::items::{ItemManager, ClientItemId};
|
|
|
use crate::ship::items::{ItemManager, ClientItemId};
|
|
|
use crate::ship::packet::builder;
|
|
|
use crate::ship::packet::builder;
|
|
|
use crate::ship::items::state::ItemState;
|
|
|
use crate::ship::items::state::ItemState;
|
|
|
use crate::ship::items::actions::{drop_item, drop_partial_item, drop_meseta, equip_item, unequip_item};
|
|
|
|
|
|
|
|
|
use crate::ship::items::actions::{drop_item, drop_partial_item, drop_meseta, equip_item, unequip_item, sort_inventory};
|
|
|
|
|
|
|
|
|
pub async fn request_exp<EG: EntityGateway>(id: ClientId,
|
|
|
pub async fn request_exp<EG: EntityGateway>(id: ClientId,
|
|
|
request_exp: &RequestExp,
|
|
|
request_exp: &RequestExp,
|
|
@ -375,13 +375,24 @@ pub async fn player_sorts_items<EG>(id: ClientId, |
|
|
pkt: &SortItems,
|
|
|
pkt: &SortItems,
|
|
|
entity_gateway: &mut EG,
|
|
|
entity_gateway: &mut EG,
|
|
|
clients: &Clients,
|
|
|
clients: &Clients,
|
|
|
item_manager: &mut ItemManager)
|
|
|
|
|
|
|
|
|
item_state: &mut ItemState)
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, anyhow::Error>
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, anyhow::Error>
|
|
|
where
|
|
|
where
|
|
|
EG: EntityGateway
|
|
|
EG: EntityGateway
|
|
|
{
|
|
|
{
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
item_manager.player_sorts_items(entity_gateway, &client.character, pkt.item_ids).await?;
|
|
|
|
|
|
|
|
|
let item_ids = pkt.item_ids
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.filter_map(|item_id| {
|
|
|
|
|
|
if *item_id != 0 {
|
|
|
|
|
|
Some(ClientItemId(*item_id))
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
None
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
sort_inventory(item_state, entity_gateway, &client.character, item_ids).await?;
|
|
|
Ok(Box::new(None.into_iter())) // TODO: clients probably care about each others item orders
|
|
|
Ok(Box::new(None.into_iter())) // TODO: clients probably care about each others item orders
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|