From 7ac68d13bba5373e7c91648a2cd4bb2afe088479 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Jun 2022 23:24:38 +0000 Subject: [PATCH] actually add and use AddKill modifier and remove dead code --- src/entity/gateway/entitygateway.rs | 11 ----------- src/entity/gateway/inmemory.rs | 2 ++ src/entity/item/weapon.rs | 6 ------ src/ship/packet/handler/message.rs | 2 +- tests/test_unseal_items.rs | 3 --- 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/entity/gateway/entitygateway.rs b/src/entity/gateway/entitygateway.rs index 5c3c43b..36bc0a1 100644 --- a/src/entity/gateway/entitygateway.rs +++ b/src/entity/gateway/entitygateway.rs @@ -157,17 +157,6 @@ pub trait EntityGateway: Send + Sync { async fn create_trade(&mut self, _char_id1: &CharacterEntityId, _char_id2: &CharacterEntityId) -> Result { unimplemented!(); } - async fn increment_kill_counter(&mut self, _item_entity_id: &ItemEntityId) -> Result<(), GatewayError> { - unimplemented!(); - } - - async fn get_kill_counter() { - unimplemented!(); - } - - async fn set_kill_counter() { - unimplemented!(); - } } diff --git a/src/entity/gateway/inmemory.rs b/src/entity/gateway/inmemory.rs index 7ebee44..866e36e 100644 --- a/src/entity/gateway/inmemory.rs +++ b/src/entity/gateway/inmemory.rs @@ -78,6 +78,7 @@ pub struct InMemoryGateway { weapon_modifiers: Arc>>>, unit_modifiers: Arc>>>, trades: Arc>>, + unit_modifiers: Arc>>>, } impl Default for InMemoryGateway { @@ -96,6 +97,7 @@ impl Default for InMemoryGateway { weapon_modifiers: Arc::new(Mutex::new(BTreeMap::new())), unit_modifiers: Arc::new(Mutex::new(BTreeMap::new())), trades: Arc::new(Mutex::new(Vec::new())), + unit_modifiers: Arc::new(Mutex::new(BTreeMap::new())), } } } diff --git a/src/entity/item/weapon.rs b/src/entity/item/weapon.rs index 20c6049..7243836 100644 --- a/src/entity/item/weapon.rs +++ b/src/entity/item/weapon.rs @@ -1684,10 +1684,4 @@ impl Weapon { | WeaponType::Scepter ) } - - pub fn increment_kill_counter(&mut self) { - if let Some(kills) = self.kills { - self.kills = Some(kills + 1); - } - } } diff --git a/src/ship/packet/handler/message.rs b/src/ship/packet/handler/message.rs index 146ecaf..af79d03 100644 --- a/src/ship/packet/handler/message.rs +++ b/src/ship/packet/handler/message.rs @@ -411,7 +411,7 @@ where } pub async fn player_killed_monster( id: ClientId, - _pkt: &KillMonster, // use this later for turbo logging? + pkt: &KillMonster, entity_gateway: &mut EG, client_location: &ClientLocation, clients: &Clients, diff --git a/tests/test_unseal_items.rs b/tests/test_unseal_items.rs index 33bde4b..279e914 100644 --- a/tests/test_unseal_items.rs +++ b/tests/test_unseal_items.rs @@ -1,7 +1,4 @@ /* TODO: -1. test to check if sjs/lame/limiter drop with Some() kill counter enabled -2. test to make sure other items drop with None kill counter -3. test kill counters get incremented per kill 4. test unsealing item: - client item id does not change - unsealed item no longer has kill counter