mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-22 01:22:27 +00:00
Some more refactoring of hate_list
This commit is contained in:
parent
18f9a06f06
commit
4af3834715
@ -152,7 +152,7 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
|
Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
|
||||||
Mob* close = nullptr;
|
Mob* close_entity = nullptr;
|
||||||
float close_distance = 99999.9f;
|
float close_distance = 99999.9f;
|
||||||
float this_distance;
|
float this_distance;
|
||||||
|
|
||||||
@ -161,15 +161,15 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
|
|||||||
this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater);
|
this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater);
|
||||||
if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) {
|
if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) {
|
||||||
close_distance = this_distance;
|
close_distance = this_distance;
|
||||||
close = (*iterator)->entity_on_hatelist;
|
close_entity = (*iterator)->entity_on_hatelist;
|
||||||
}
|
}
|
||||||
++iterator;
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!close && hater->IsNPC()) || (close && close->DivineAura()))
|
if ((!close_entity && hater->IsNPC()) || (close_entity && close_entity->DivineAura()))
|
||||||
close = hater->CastToNPC()->GetHateTop();
|
close_entity = hater->CastToNPC()->GetHateTop();
|
||||||
|
|
||||||
return close;
|
return close_entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzied, bool iAddIfNotExist)
|
void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzied, bool iAddIfNotExist)
|
||||||
|
|||||||
@ -28,7 +28,8 @@ struct ExtraAttackOptions;
|
|||||||
struct struct_HateList
|
struct struct_HateList
|
||||||
{
|
{
|
||||||
Mob *entity_on_hatelist;
|
Mob *entity_on_hatelist;
|
||||||
int32 hatelist_damage, stored_hate_amount;
|
int32 hatelist_damage;
|
||||||
|
uint32 stored_hate_amount;
|
||||||
bool is_entity_frenzy;
|
bool is_entity_frenzy;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ public:
|
|||||||
Mob *GetRandomEntOnHateList();
|
Mob *GetRandomEntOnHateList();
|
||||||
Mob* GetEntWithMostHateOnList();
|
Mob* GetEntWithMostHateOnList();
|
||||||
|
|
||||||
bool IsEntOnHateList(Mob *);
|
bool IsEntOnHateList(Mob *mob);
|
||||||
bool IsHateListEmpty();
|
bool IsHateListEmpty();
|
||||||
bool RemoveEntFromHateList(Mob *ent);
|
bool RemoveEntFromHateList(Mob *ent);
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ public:
|
|||||||
void IsEntityInFrenzyMode();
|
void IsEntityInFrenzyMode();
|
||||||
void PrintHateListToClient(Client *c);
|
void PrintHateListToClient(Client *c);
|
||||||
void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_damage);
|
void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_damage);
|
||||||
void SetOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; }
|
void SetHateOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; }
|
||||||
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr);
|
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr);
|
||||||
void WipeHateList();
|
void WipeHateList();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user