mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 02:31:03 +00:00
[Bug Fix] NPC Faction War prevention. (#3595)
* [Bug] NPC Faction War prevention. This should assist with prevention of NPC Faction waring. I have been using this code on my server for over 5 years with no coredumps or any noted bugs. This was brought up as users have reported a few events where they can trigger NPC's to fight each other. * Correct a few entries to line up with updated code. * Re-add missing RestTimer functionality
This commit is contained in:
+16
-17
@@ -42,27 +42,26 @@ HateList::~HateList()
|
||||
{
|
||||
}
|
||||
|
||||
void HateList::WipeHateList()
|
||||
{
|
||||
void HateList::WipeHateList(bool npc_only) {
|
||||
auto iterator = list.begin();
|
||||
while (iterator != list.end()) {
|
||||
Mob *m = (*iterator)->entity_on_hatelist;
|
||||
if (m && (m->IsClient() || (m->IsPet() && m->GetOwner()->IsClient())) && npc_only) {
|
||||
iterator++;
|
||||
} else {
|
||||
if (m) {
|
||||
if (parse->HasQuestSub(hate_owner->GetNPCTypeID(), EVENT_HATE_LIST)) {
|
||||
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), m, "0", 0);
|
||||
}
|
||||
|
||||
while (iterator != list.end())
|
||||
{
|
||||
Mob* m = (*iterator)->entity_on_hatelist;
|
||||
if (m)
|
||||
{
|
||||
if (parse->HasQuestSub(hate_owner->GetNPCTypeID(), EVENT_HATE_LIST)) {
|
||||
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), m, "0", 0);
|
||||
}
|
||||
|
||||
if (m->IsClient()) {
|
||||
m->CastToClient()->DecrementAggroCount();
|
||||
m->CastToClient()->RemoveXTarget(hate_owner, true);
|
||||
if (m->IsClient()) {
|
||||
m->CastToClient()->DecrementAggroCount();
|
||||
m->CastToClient()->RemoveXTarget(hate_owner, true);
|
||||
}
|
||||
delete (*iterator);
|
||||
iterator = list.erase(iterator);
|
||||
}
|
||||
}
|
||||
delete (*iterator);
|
||||
iterator = list.erase(iterator);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user