[Performance] Clear Wearchange Deduplication Cache (#4960)

* [Performance] Clear Wearchange Deduplication Cache

* Move timers to process loops
This commit is contained in:
Chris Miles 2025-06-30 13:57:43 -05:00 committed by GitHub
parent 07d484597d
commit 659a960401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 0 deletions

View File

@ -561,6 +561,10 @@ bool Client::Process() {
{
ItemTimerCheck();
}
if (m_clear_wearchange_cache_timer.Check()) {
m_last_seen_wearchange.clear();
}
}
}

View File

@ -133,6 +133,7 @@ Mob::Mob(
m_see_close_mobs_timer(1000),
m_mob_check_moving_timer(1000),
bot_attack_flag_timer(10000),
m_clear_wearchange_cache_timer(60 * 10 * 1000), // 10 minutes
m_destroying(false)
{
mMovementManager = &MobMovementManager::Get();

View File

@ -211,6 +211,7 @@ public:
uint16 m_last_wearchange_race_id = 0;
// client_id -> slot_id -> key
std::unordered_map<uint32_t, std::unordered_map<uint8_t, uint64_t>> m_last_seen_wearchange;
Timer m_clear_wearchange_cache_timer;
// Bot attack flag
Timer bot_attack_flag_timer;

View File

@ -632,6 +632,10 @@ bool NPC::Process()
}
if (tic_timer.Check()) {
if (m_clear_wearchange_cache_timer.Check()) {
m_last_seen_wearchange.clear();
}
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_TICK)) {
parse->EventNPC(EVENT_TICK, this, nullptr, "", 0);
}