|
@ -903,11 +903,12 @@ impl ItemManager { |
|
|
-> Result<(), ItemManagerError> {
|
|
|
-> Result<(), ItemManagerError> {
|
|
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
|
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
|
|
let mut inventory_item_handle = inventory.get_item_handle_by_id(item_id).ok_or(ItemManagerError::NoSuchItemId(item_id))?;
|
|
|
let mut inventory_item_handle = inventory.get_item_handle_by_id(item_id).ok_or(ItemManagerError::NoSuchItemId(item_id))?;
|
|
|
|
|
|
let slot = inventory_item_handle.get_slot();
|
|
|
let inventory_item = inventory_item_handle.item_mut().ok_or(ItemManagerError::CannotGetMutItem)?.individual().ok_or(ItemManagerError::CannotGetIndividualItem)?;
|
|
|
let inventory_item = inventory_item_handle.item_mut().ok_or(ItemManagerError::CannotGetMutItem)?.individual().ok_or(ItemManagerError::CannotGetIndividualItem)?;
|
|
|
inventory_item.equipped = true;
|
|
|
inventory_item.equipped = true;
|
|
|
entity_gateway.change_item_location(&inventory_item.entity_id, ItemLocation::Inventory{
|
|
|
entity_gateway.change_item_location(&inventory_item.entity_id, ItemLocation::Inventory{
|
|
|
character_id: character.id,
|
|
|
character_id: character.id,
|
|
|
slot: character.slot as usize,
|
|
|
|
|
|
|
|
|
slot: slot,
|
|
|
equipped: true,
|
|
|
equipped: true,
|
|
|
}).await;
|
|
|
}).await;
|
|
|
|
|
|
|
|
@ -922,11 +923,12 @@ impl ItemManager { |
|
|
-> Result<(), ItemManagerError> {
|
|
|
-> Result<(), ItemManagerError> {
|
|
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
|
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
|
|
let mut inventory_item_handle = inventory.get_item_handle_by_id(item_id).ok_or(ItemManagerError::NoSuchItemId(item_id))?;
|
|
|
let mut inventory_item_handle = inventory.get_item_handle_by_id(item_id).ok_or(ItemManagerError::NoSuchItemId(item_id))?;
|
|
|
|
|
|
let slot = inventory_item_handle.get_slot();
|
|
|
let inventory_item = inventory_item_handle.item_mut().ok_or(ItemManagerError::CannotGetMutItem)?.individual().ok_or(ItemManagerError::CannotGetIndividualItem)?;
|
|
|
let inventory_item = inventory_item_handle.item_mut().ok_or(ItemManagerError::CannotGetMutItem)?.individual().ok_or(ItemManagerError::CannotGetIndividualItem)?;
|
|
|
inventory_item.equipped = false;
|
|
|
inventory_item.equipped = false;
|
|
|
entity_gateway.change_item_location(&inventory_item.entity_id, ItemLocation::Inventory{
|
|
|
entity_gateway.change_item_location(&inventory_item.entity_id, ItemLocation::Inventory{
|
|
|
character_id: character.id,
|
|
|
character_id: character.id,
|
|
|
slot: character.slot as usize,
|
|
|
|
|
|
|
|
|
slot: slot,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}).await;
|
|
|
}).await;
|
|
|
|
|
|
|
|
|