diff --git a/source/WorldServer/Commands/Commands.cpp b/source/WorldServer/Commands/Commands.cpp index d4f0b50..9613be4 100644 --- a/source/WorldServer/Commands/Commands.cpp +++ b/source/WorldServer/Commands/Commands.cpp @@ -4885,6 +4885,17 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie client->Message(CHANNEL_COLOR_YELLOW, "Angle %f between player %s and target %s", spawnAngle, client->GetPlayer()->GetTarget() ? client->GetPlayer()->GetTarget()->GetName() : client->GetPlayer()->GetName(), client->GetPlayer()->GetName()); break; } + else if (ToLower(string(sep->arg[0])) == "hated") + { + if(client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsEntity()) { + Entity* target = (Entity*)client->GetPlayer()->GetTarget(); + target->SendHatedByList(client); + } + else { + client->Message(CHANNEL_COLOR_YELLOW, "No target or target is not entity to display hated by list."); + } + break; + } } if (sep->IsNumber(0)) { diff --git a/source/WorldServer/Entity.cpp b/source/WorldServer/Entity.cpp index 91df26a..237e60d 100644 --- a/source/WorldServer/Entity.cpp +++ b/source/WorldServer/Entity.cpp @@ -4138,4 +4138,20 @@ void Entity::CalculateMaxReduction() { } GetInfoStruct()->set_max_spell_reduction(maxReduction); +} + +bool Entity::IsAggroed() { + return (bool)GetInfoStruct()->get_engaged_encounter(); +} + +void Entity::SendHatedByList(Client* client) { + set::iterator itr; + MHatedBy.lock(); + set hatedByCopy(HatedBy); + MHatedBy.unlock(); + client->Message(CHANNEL_COLOR_RED, "HatedBy List for %s, size: %u", GetName(), hatedByCopy.size()); + for (itr = hatedByCopy.begin(); itr != hatedByCopy.end(); itr++) { + Spawn* spawn = GetZone()->GetSpawnByID(*itr); + client->Message(CHANNEL_COLOR_YELLOW, "ID: %u, Name: %s", *itr, spawn ? spawn->GetName() : "N/A"); + } } \ No newline at end of file diff --git a/source/WorldServer/Entity.h b/source/WorldServer/Entity.h index a3c2238..fd16b6d 100644 --- a/source/WorldServer/Entity.h +++ b/source/WorldServer/Entity.h @@ -1992,15 +1992,8 @@ public: set HatedBy; std::mutex MHatedBy; - bool IsAggroed() { - int32 size = 0; - - MHatedBy.lock(); - size = HatedBy.size(); - MHatedBy.unlock(); - - return size > 0; - } + bool IsAggroed(); + void SendHatedByList(Client* client); Mutex MCommandMutex;