aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-01-07 19:47:13 +0100
committerShauren <shauren.trinity@gmail.com>2021-05-16 21:56:06 +0200
commit8b7728f82e6e7c326b7945efd719218179e9767a (patch)
tree6e70cddbfd2a1f4ad589eda6655a90e0f996b131 /src/server/game/AI/ScriptedAI
parent0f005c3686012e2c0403974e89cd1c3ba777450d (diff)
Core/Map: New Map::ForceRespawn to override objections and force a respawn (equivalent to force = true). Use this to fix various GM commands.
Scripts/Valithria: Fix an issue that could get the encounter stuck in an unloaded state. (cherry picked from commit 3bb33e3108c65ba8a1c35b934526562aa542b63b)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 831ddeb466a..bcdf801075c 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -216,7 +216,7 @@ void EscortAI::UpdateAI(uint32 diff)
}
// Check if player or any member of his group is within range
- if (_despawnAtFar && HasEscortState(STATE_ESCORT_ESCORTING) && !_playerGUID.IsEmpty() && !me->GetVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
+ if (_despawnAtFar && HasEscortState(STATE_ESCORT_ESCORTING) && !_playerGUID.IsEmpty() && !me->IsEngaged() && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (_playerCheckTimer <= diff)
{
@@ -228,10 +228,13 @@ void EscortAI::UpdateAI(uint32 diff)
if (CreatureData const* creatureData = me->GetCreatureData())
isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (creatureData->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
- if (_instantRespawn && !isEscort)
- me->DespawnOrUnsummon(0, Seconds(1));
- else if (_instantRespawn && isEscort)
- me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
+ if (_instantRespawn)
+ {
+ if (!isEscort)
+ me->DespawnOrUnsummon(0, 1s);
+ else
+ me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
+ }
else
me->DespawnOrUnsummon();