diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-10-12 20:28:18 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-18 22:46:24 +0100 |
commit | 7d78ddcbd5f68ba7b8d3a7cce527d53d4f37ae0a (patch) | |
tree | 2a62fa584b6a0744b97d7b67aea451b4e80d9a81 /src | |
parent | 14c2a7fb92e49265071f36b65fb845ecc6dd4381 (diff) |
Core/AI: Add new method to force creatures around to stop combat
(cherry picked from commit 06443e38e761ed8ac7ce803c39bbbc7263983479)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 10 | ||||
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 3af141dae8a..f5a8710cbe5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -515,6 +515,16 @@ void BossAI::TeleportCheaters() } } +void BossAI::ForceStopCombatForCreature(uint32 entry, float maxSearchRange /*= 250.0f*/) +{ + TC_LOG_WARN("scripts.ai", "BossAI::ForceStopCombatForCreature: called on '%s' with creature entry '%u'. This should be fixed in another way than calling this function. Debug info: %s", me->GetName().c_str(), entry, me->GetDebugInfo().c_str()); + std::list<Creature*> creatures; + me->GetCreatureListWithEntryInGrid(creatures, entry, maxSearchRange); + + for (Creature* creature : creatures) + creature->CombatStop(); +} + void BossAI::JustSummoned(Creature* summon) { summons.Summon(summon); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 68980803da5..9f39f981415 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -338,6 +338,8 @@ class TC_GAME_API BossAI : public ScriptedAI void TeleportCheaters(); + void ForceStopCombatForCreature(uint32 entry, float maxSearchRange = 250.0f); + EventMap events; SummonList summons; TaskScheduler scheduler; |