mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Adjust the behavior of out of range aggro removal
This is a bit more accurate
This commit is contained in:
parent
a7310cba17
commit
a440269c6b
@ -200,6 +200,7 @@ void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage,
|
||||
entity->hatelist_damage = (in_damage >= 0) ? in_damage : 0;
|
||||
entity->stored_hate_amount = in_hate;
|
||||
entity->is_entity_frenzy = in_is_entity_frenzied;
|
||||
entity->oor_count = 0;
|
||||
list.push_back(entity);
|
||||
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "1", 0);
|
||||
|
||||
@ -658,8 +659,20 @@ void HateList::RemoveStaleEntries(int time_ms, float dist)
|
||||
while (it != list.end()) {
|
||||
auto m = (*it)->entity_on_hatelist;
|
||||
if (m) {
|
||||
// 10 mins or distance
|
||||
if ((cur_time - (*it)->last_modified > time_ms) || hate_owner->CalculateDistance(m->GetX(), m->GetY(), m->GetZ()) > dist) {
|
||||
bool remove = false;
|
||||
|
||||
if (cur_time - (*it)->last_modified > time_ms)
|
||||
remove = true;
|
||||
|
||||
if (!remove && hate_owner->CalculateDistance(m->GetX(), m->GetY(), m->GetZ()) > dist) {
|
||||
(*it)->oor_count++;
|
||||
if ((*it)->oor_count == 2)
|
||||
remove = true;
|
||||
} else if ((*it)->oor_count != 0) {
|
||||
(*it)->oor_count = 0;
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), m, "0", 0);
|
||||
|
||||
if (m->IsClient()) {
|
||||
|
||||
@ -31,6 +31,7 @@ struct struct_HateList
|
||||
int32 hatelist_damage;
|
||||
uint32 stored_hate_amount;
|
||||
bool is_entity_frenzy;
|
||||
int8 oor_count; // count on how long we've been out of range
|
||||
uint32 last_modified; // we need to remove this if it gets higher than 10 mins
|
||||
};
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ Mob::Mob(const char* in_name,
|
||||
fix_z_timer_engaged(100),
|
||||
attack_anim_timer(1000),
|
||||
position_update_melee_push_timer(1000),
|
||||
mHateListCleanup(3000)
|
||||
mHateListCleanup(6000)
|
||||
{
|
||||
targeted = 0;
|
||||
tar_ndx = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user