From d967d03151b94e89180192684c055e9709cb1447 Mon Sep 17 00:00:00 2001 From: ccrs Date: Mon, 25 Nov 2019 20:43:23 +0100 Subject: Core/AI: add another helper for "ScriptedAI::ForceCombatStop" (cherry picked from commit 3842ab2781e4ca518d98d4f50566e42eeced18bf) --- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 6 ++++++ src/server/game/AI/ScriptedAI/ScriptedCreature.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/server/game/AI/ScriptedAI') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 80ce28a98ee..5bc89845941 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -272,6 +272,12 @@ void ScriptedAI::ForceCombatStopForCreatureEntry(uint32 entry, float maxSearchRa ForceCombatStop(creature, reset); } +void ScriptedAI::ForceCombatStopForCreatureEntry(std::vector creatureEntries, float maxSearchRange /*= 250.0f*/, bool samePhase /*= true*/, bool reset /*= true*/) +{ + for (uint32 const entry : creatureEntries) + ForceCombatStopForCreatureEntry(entry, maxSearchRange, samePhase, reset); +} + Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime) { return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, TempSummonType(type), despawntime); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 42d2006ebd4..dbeae11f4c5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -192,6 +192,8 @@ struct TC_GAME_API ScriptedAI : public CreatureAI void ForceCombatStop(Creature* who, bool reset = true); // Stops combat, ignoring restrictions, for the found creatures void ForceCombatStopForCreatureEntry(uint32 entry, float maxSearchRange = 250.0f, bool samePhase = true, bool reset = true); + // Stops combat, ignoring restrictions, for the found creatures + void ForceCombatStopForCreatureEntry(std::vector creatureEntries, float maxSearchRange = 250.0f, bool samePhase = true, bool reset = true); void DoTeleportTo(float x, float y, float z, uint32 time = 0); void DoTeleportTo(float const pos[4]); -- cgit v1.2.3