From cf866c8ec629b256378a06ac8daf90c215bef65d Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Thu, 12 Jun 2025 01:35:41 -0500 Subject: [PATCH] Change --- zone/mob.h | 1 + zone/mob_appearance.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/zone/mob.h b/zone/mob.h index ab3f77025..6c7f410d1 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -208,6 +208,7 @@ public: Timer m_see_close_mobs_timer; Timer m_mob_check_moving_timer; + uint16 m_last_wearchange_race_id = 0; std::unordered_map m_last_seen_wearchange; // Bot attack flag diff --git a/zone/mob_appearance.cpp b/zone/mob_appearance.cpp index e8cd2678a..32feeedb6 100644 --- a/zone/mob_appearance.cpp +++ b/zone/mob_appearance.cpp @@ -395,6 +395,11 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client) w->wear_slot_id = material_slot; + if (GetRace() != m_last_wearchange_race_id) { + m_last_seen_wearchange.clear(); + m_last_wearchange_race_id = GetRace(); + } + // this is a hash-like key to deduplicate packets sent to clients // it includes spawn_id, material, elite_material, hero_forge_model, wear_slot_id, and color // we send an enormous amount of wearchange packets in brute-force fashion and this is a low cost way to deduplicate them @@ -418,6 +423,7 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client) auto send_if_changed = [&](Client* client) { auto& last_key = m_last_seen_wearchange[client->GetID()]; if (last_key == dedupe_key) { + LogInfo("Ignoring duplicate WearChange for client [{}] with key [{}]", client->GetName(), dedupe_key); return; } last_key = dedupe_key;