From 2bf05331941cd624fff892748593e4ac9dfb5f66 Mon Sep 17 00:00:00 2001 From: Trust Date: Sun, 26 Jan 2025 20:45:58 -0500 Subject: [PATCH] add rule and consolidate logic --- common/ruletypes.h | 1 + zone/npc.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 2b52e081d..d26dae361 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -686,6 +686,7 @@ RULE_BOOL(NPC, NPCIgnoreLevelBasedHasteCaps, false, "Ignores hard coded level ba RULE_INT(NPC, NPCHasteCap, 150, "Haste cap for non-v3(over haste) haste") RULE_INT(NPC, NPCHastev3Cap, 25, "Haste cap for v3(over haste) haste") RULE_STRING(NPC, ExcludedFaceTargetRaces, "52,72,73,141,233,328,329,372,376,377,378,379,380,381,382,383,404,422,423,424,425,426,428,429,445,449,460,462,463,500,501,502,503,504,505,506,507,508,509,510,511,513,514,515,516,533,534,535,536,537,538,539,540,541,542,543,544,545,546,550,551,552,553,554,555,556,557,567,573,577,586,589,590,591,592,593,595,596,599,601,616,619,621,628,629,630,633,634,635,636,665,683,684,685,691,692,693,694,702,703,705,706,707,710,711,714,720,2250,2254", "Race IDs excluded from facing target when hailed") +RULE_BOOL(NPC, ResetUnderworldMobsToSpawn, false, "Reset mobs that are under the world back to spawn point if valid. DEFAULT: False") RULE_CATEGORY_END() RULE_CATEGORY(Aggro) diff --git a/zone/npc.cpp b/zone/npc.cpp index 2cbee0f76..52802ae63 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -596,13 +596,15 @@ bool NPC::Process() } // If mobs are under the world, move them back to spawn point. - if (!IsEngaged() && IsTrackable()) { - if (GetZ() <= zone->newzone_data.underworld) { - if (respawn2) { - Teleport(glm::vec3(respawn2->GetX(), respawn2->GetY(), respawn2->GetZ())); - SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0, true); - } - } + if ( + RuleB(NPC, ResetUnderworldMobsToSpawn) && + !IsEngaged() && + IsTrackable() && + GetZ() <= zone->newzone_data.underworld && + respawn2 + ) { + Teleport(glm::vec3(respawn2->GetX(), respawn2->GetY(), respawn2->GetZ())); + SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0, true); } SpellProcess();