From e82fe779fc81e5a2e3462d88853e37d42ddf576c Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 15 Aug 2021 04:56:19 +0000 Subject: [PATCH] don't actually need this stuff --- src/entity/item/mod.rs | 23 ----------------------- src/ship/items/manager.rs | 4 ---- 2 files changed, 27 deletions(-) diff --git a/src/entity/item/mod.rs b/src/entity/item/mod.rs index 26bbd60..a03f27f 100644 --- a/src/entity/item/mod.rs +++ b/src/entity/item/mod.rs @@ -210,29 +210,6 @@ pub struct ItemEntity { pub item: ItemDetail, } -impl ItemEntity { - pub fn increase_kill_counter(&mut self) { - match &self.item { - ItemDetail::Weapon(w) => { - if let Some(kills) = w.kills { - self.item = ItemDetail::Weapon(weapon::Weapon { - kills: Some(kills + 1), - ..*w - }) - } - }, - // ItemDetail::Unit(u) => { - // if let Some(kills) = u.kills { - // kills += 1; - // u.kills = Some(kills); - // } - // } - _ => {}, - } - } -} - - #[derive(Clone, Debug, Serialize, Deserialize)] pub enum InventoryItemEntity { Individual(ItemEntity), diff --git a/src/ship/items/manager.rs b/src/ship/items/manager.rs index 8b83b22..5f4e432 100644 --- a/src/ship/items/manager.rs +++ b/src/ship/items/manager.rs @@ -1383,7 +1383,6 @@ impl ItemAction for TradeMeseta { equipped_items: &EquippedEntity) -> Result<(), anyhow::Error> { let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?; - // 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 mut weapon_handle = inventory.get_item_handle_by_id(weapon_id).ok_or(ItemManagerError::NoSuchItemId(weapon_id))?; @@ -1396,9 +1395,7 @@ impl ItemAction for TradeMeseta { .ok_or(ItemManagerError::WrongItemType(weapon_id))?; weapon.increment_kill_counter(); - entity_gateway.increment_kill_counter(&weapon_entity).await?; } - // limiter for units in equipped_items.unit { 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(); @@ -1412,7 +1409,6 @@ impl ItemAction for TradeMeseta { .ok_or(ItemManagerError::WrongItemType(unit_id))?; 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?;