From 8a87e00b660aa560035e4290cb1dbc2c99dd0a68 Mon Sep 17 00:00:00 2001 From: Fryguy Date: Fri, 26 Jan 2024 15:43:20 -0500 Subject: [PATCH] [Bug Fix] Limit Pet Taunt Distance (#4018) * [Bug Fix] Limit pet taunt distance Previously this was not regulated and allowed players to exploit unlimited taunt distance. Rule Name: PetTauntRange Rule Default: 150 Calculation is Rule Squared. * Remove `this` --- common/ruletypes.h | 1 + zone/special_attacks.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index da1bec40c..157b57889 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -269,6 +269,7 @@ RULE_BOOL(Pets, CanTakeNoDrop, false, "Setting whether anyone can give no-drop i RULE_BOOL(Pets, CanTakeQuestItems, true, "Setting whether anyone can give quest items to pets") RULE_BOOL(Pets, LivelikeBreakCharmOnInvis, true, "Default: true will break charm on any type of invis (hide/ivu/iva/etc) false will only break if the pet can not see you (ex. you have an undead pet and cast IVU") RULE_BOOL(Pets, ClientPetsUseOwnerNameInLastName, true, "Disable this to keep client pet's last names from being owner_name's pet") +RULE_INT(Pets, PetTauntRange, 150, "Range at which a pet will taunt targets.") RULE_CATEGORY_END() RULE_CATEGORY(GM) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 2d682f459..8d645e25c 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1819,14 +1819,16 @@ void NPC::DoClassAttacks(Mob *target) { target->GetBodyType() != BT_Undead && taunt_time && type_of_pet && - type_of_pet != petTargetLock + type_of_pet != petTargetLock && + DistanceSquared(GetPosition(), target->GetPosition()) <= (RuleI(Pets, PetTauntRange) * RuleI(Pets, PetTauntRange)) ) { GetOwner()->MessageString(Chat::PetResponse, PET_TAUNTING); Taunt(target->CastToNPC(), false); } - if(!ca_time) + if(!ca_time) { return; + } float HasteModifier = GetHaste() * 0.01f;