|
|
@ -1,13 +1,11 @@ |
|
|
|
use libpso::packet::ship::*;
|
|
|
|
use libpso::packet::messages::*;
|
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
|
use crate::entity::item::ItemDetail;
|
|
|
|
use crate::entity::item::tool::ToolType;
|
|
|
|
use crate::entity::item::{ItemType};
|
|
|
|
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::map::{MapArea};
|
|
|
|
use crate::ship::items::{ItemManager, ClientItemId};
|
|
|
|
use crate::ship::packet::builder;
|
|
|
|
|
|
|
@ -275,7 +273,7 @@ pub async fn player_used_medical_center<EG>(id: ClientId, |
|
|
|
clients: &mut Clients)
|
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError>
|
|
|
|
where
|
|
|
|
EG: EntityGateway
|
|
|
|
EG: EntityGateway
|
|
|
|
{
|
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
if client.character.meseta >= 10 {
|
|
|
@ -332,7 +330,29 @@ where |
|
|
|
EG: EntityGateway
|
|
|
|
{
|
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
item_manager.player_unequips_item(entity_gateway, &client.character, ClientItemId(pkt.item_id)).await?;
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
}
|
|
|
|
let equipped_unit_ids: Vec<ClientItemId> = {
|
|
|
|
item_manager.player_unequips_item(entity_gateway, &client.character, ClientItemId(pkt.item_id)).await?;
|
|
|
|
let inventory = item_manager.get_character_inventory(&client.character).unwrap();
|
|
|
|
let ue_item = inventory.get_item_by_id(ClientItemId(pkt.item_id)).ok_or(ShipError::ItemError)?;
|
|
|
|
if let ItemType::Armor(_) = ue_item.item_type() {
|
|
|
|
inventory.items()
|
|
|
|
.iter()
|
|
|
|
.filter(|inv_item| {
|
|
|
|
if let ItemType::Unit(_) = inv_item.item_type() {
|
|
|
|
return inv_item.equipped()
|
|
|
|
}
|
|
|
|
false
|
|
|
|
})
|
|
|
|
.map(|u| u.item_id())
|
|
|
|
.collect()
|
|
|
|
} else {
|
|
|
|
Vec::new()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for unit_id in equipped_unit_ids {
|
|
|
|
item_manager.player_unequips_item(entity_gateway, &client.character, unit_id).await;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
}
|