Implement aggro meter for RoF2 (RoF wasn't tested)

I didn't test RoF, so it's disabled for now (change AggroMeterAvaliable if you want to test)

Group member meters probably buggy ... but do later

The "lock target" feature isn't working currently either
This commit is contained in:
Michael Cook (mackal)
2017-02-18 22:27:34 -05:00
parent 9f4604ec3e
commit 08c2f73e37
15 changed files with 328 additions and 5 deletions
+29 -1
View File
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "raids.h"
#include "../common/rulesys.h"
#include "../common/data_verification.h"
#include "hate_list.h"
#include "quest_parser_collection.h"
@@ -277,7 +278,24 @@ int HateList::GetSummonedPetCountOnHateList(Mob *hater) {
return pet_count;
}
Mob *HateList::GetEntWithMostHateOnList(Mob *center)
int HateList::GetHateRatio(Mob *top, Mob *other)
{
auto other_entry = Find(other);
if (!other_entry || other_entry->stored_hate_amount < 1)
return 0;
auto top_entry = Find(top);
if (!top_entry || top_entry->stored_hate_amount < 1)
return 999; // shouldn't happen if you call it right :P
return EQEmu::Clamp(static_cast<int>((other_entry->stored_hate_amount * 100) / top_entry->stored_hate_amount), 1, 999);
}
// skip is used to ignore a certain mob on the list
// Currently used for getting 2nd on list for aggro meter
Mob *HateList::GetEntWithMostHateOnList(Mob *center, Mob *skip)
{
// hack fix for zone shutdown crashes on some servers
if (!zone->IsLoaded())
@@ -310,6 +328,11 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center)
continue;
}
if (cur->entity_on_hatelist == skip) {
++iterator;
continue;
}
auto hateEntryPosition = glm::vec3(cur->entity_on_hatelist->GetX(), cur->entity_on_hatelist->GetY(), cur->entity_on_hatelist->GetZ());
if (center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if (!zone->watermap->InLiquid(hateEntryPosition)) {
@@ -436,6 +459,11 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center)
while (iterator != list.end())
{
struct_HateList *cur = (*iterator);
if (cur->entity_on_hatelist == skip) {
++iterator;
continue;
}
if (center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(glm::vec3(cur->entity_on_hatelist->GetPosition()))) {
skipped_count++;