IsAggroed now defers to info struct for engaged_encounter to assure we are in/out of combat for various game instructions. Add /spawn details hated to show hated by list for players/entities,

This commit is contained in:
Emagi 2025-08-17 14:29:01 -04:00
parent 7869c2abcb
commit 8f402eb781
3 changed files with 29 additions and 9 deletions

View File

@ -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))
{

View File

@ -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<int32>::iterator itr;
MHatedBy.lock();
set<int32> 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");
}
}

View File

@ -1992,15 +1992,8 @@ public:
set<int32> 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;