From 36e009a5bd7d675bd4aba85d465e71ec85abad6d Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Thu, 8 Jul 2021 11:38:57 -0500 Subject: [PATCH] Allow NPCs to aggro player pets with NPCAggro field set in database and new rule AggroPlayerPets set to true (#1450) Co-authored-by: Natedog2012 --- common/ruletypes.h | 1 + zone/aggro.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 409769bea..c0e740493 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -526,6 +526,7 @@ RULE_INT(Aggro, ClientAggroCheckMovingInterval, 1000, "Interval in which clients RULE_INT(Aggro, ClientAggroCheckIdleInterval, 6000, "Interval in which clients actually check for aggro while idle - in milliseconds - this should be higher than ClientAggroCheckMovingInterval") RULE_REAL(Aggro, PetAttackRange, 40000.0, "Maximum squared range /pet attack works at default is 200") RULE_BOOL(Aggro, NPCAggroMaxDistanceEnabled, true, "If enabled, NPC's will drop aggro beyond 600 units or what is defined at the zone level") +RULE_BOOL(Aggro, AggroPlayerPets, false, "If enabled, NPCs will aggro player pets") RULE_CATEGORY_END() RULE_CATEGORY(TaskSystem) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 33221b63a..5829bc3a3 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -252,7 +252,7 @@ bool Mob::CheckWillAggro(Mob *mob) { } Mob *pet_owner = mob->GetOwner(); - if (pet_owner && pet_owner->IsClient()) { + if (pet_owner && pet_owner->IsClient() && (!RuleB(Aggro, AggroPlayerPets) || pet_owner->CastToClient()->GetGM())) { return false; }