mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
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:
+29
-1
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user