|
@ -1383,7 +1383,6 @@ impl<EG: EntityGateway> ItemAction<EG> for TradeMeseta { |
|
|
equipped_items: &EquippedEntity)
|
|
|
equipped_items: &EquippedEntity)
|
|
|
-> Result<(), anyhow::Error> {
|
|
|
-> Result<(), anyhow::Error> {
|
|
|
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))?;
|
|
|
// weapon
|
|
|
|
|
|
if let Some(weapon_entity) = equipped_items.weapon {
|
|
|
if let Some(weapon_entity) = equipped_items.weapon {
|
|
|
let weapon_id = inventory.get_item_by_entity_id(weapon_entity).ok_or(ItemManagerError::EntityIdNotInInventory(weapon_entity))?.item_id();
|
|
|
let weapon_id = inventory.get_item_by_entity_id(weapon_entity).ok_or(ItemManagerError::EntityIdNotInInventory(weapon_entity))?.item_id();
|
|
|
let mut weapon_handle = inventory.get_item_handle_by_id(weapon_id).ok_or(ItemManagerError::NoSuchItemId(weapon_id))?;
|
|
|
let mut weapon_handle = inventory.get_item_handle_by_id(weapon_id).ok_or(ItemManagerError::NoSuchItemId(weapon_id))?;
|
|
@ -1396,9 +1395,7 @@ impl<EG: EntityGateway> ItemAction<EG> for TradeMeseta { |
|
|
.ok_or(ItemManagerError::WrongItemType(weapon_id))?;
|
|
|
.ok_or(ItemManagerError::WrongItemType(weapon_id))?;
|
|
|
|
|
|
|
|
|
weapon.increment_kill_counter();
|
|
|
weapon.increment_kill_counter();
|
|
|
entity_gateway.increment_kill_counter(&weapon_entity).await?;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
// limiter
|
|
|
|
|
|
for units in equipped_items.unit {
|
|
|
for units in equipped_items.unit {
|
|
|
if let Some(unit_entity) = units {
|
|
|
if let Some(unit_entity) = units {
|
|
|
let unit_id = inventory.get_item_by_entity_id(unit_entity).ok_or(ItemManagerError::EntityIdNotInInventory(unit_entity))?.item_id();
|
|
|
let unit_id = inventory.get_item_by_entity_id(unit_entity).ok_or(ItemManagerError::EntityIdNotInInventory(unit_entity))?.item_id();
|
|
@ -1412,7 +1409,6 @@ impl<EG: EntityGateway> ItemAction<EG> for TradeMeseta { |
|
|
.ok_or(ItemManagerError::WrongItemType(unit_id))?;
|
|
|
.ok_or(ItemManagerError::WrongItemType(unit_id))?;
|
|
|
|
|
|
|
|
|
unit.increment_kill_counter();
|
|
|
unit.increment_kill_counter();
|
|
|
entity_gateway.increment_kill_counter(&unit_entity).await?;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
entity_gateway.set_character_inventory(&character.id, &inventory.as_inventory_entity(&character.id)).await?;
|
|
|
entity_gateway.set_character_inventory(&character.id, &inventory.as_inventory_entity(&character.id)).await?;
|
|
|