From e7ce79261da095a3f03e2641a20f1d86716a8922 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 18 Jan 2018 15:54:53 -0500 Subject: [PATCH] Add a timer to rate limit the hatelist check --- zone/mob.cpp | 3 ++- zone/mob.h | 1 + zone/mob_ai.cpp | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 322bc7658..150469da4 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -115,7 +115,8 @@ Mob::Mob(const char* in_name, fix_z_timer(300), fix_z_timer_engaged(100), attack_anim_timer(1000), - position_update_melee_push_timer(1000) + position_update_melee_push_timer(1000), + mHateListCleanup(3000) { targeted = 0; tar_ndx = 0; diff --git a/zone/mob.h b/zone/mob.h index deb24f640..d5de43e0c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1419,6 +1419,7 @@ protected: void AddItemFactionBonus(uint32 pFactionID,int32 bonus); int32 GetItemFactionBonus(uint32 pFactionID); void ClearItemFactionBonuses(); + Timer mHateListCleanup; void CalculateFearPosition(); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 920ec8863..07e7770b0 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1024,7 +1024,8 @@ void Mob::AI_Process() { // NPCs will forget people after 10 mins of not interacting with them or out of range // both of these maybe zone specific, hardcoded for now - hate_list.RemoveStaleEntries(600000, 600.0f); + if (mHateListCleanup.Check()) + hate_list.RemoveStaleEntries(600000, 600.0f); // we are prevented from getting here if we are blind and don't have a target in range // from above, so no extra blind checks needed if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind())