aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h3
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp521
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h132
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp399
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h70
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp29
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp59
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h39
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp42
-rw-r--r--src/server/game/Entities/Creature/Creature.h7
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp14
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.h2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp30
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp2
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp3
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp7
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp8
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp3
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp5
-rw-r--r--src/server/game/Movement/MotionMaster.cpp40
-rw-r--r--src/server/game/Movement/MotionMaster.h8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerator.h3
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp7
-rw-r--r--src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp264
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h88
-rw-r--r--src/server/game/Movement/Waypoints/WaypointDefines.h71
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.cpp99
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.h38
-rw-r--r--src/server/game/Scripting/ScriptSystem.cpp56
-rw-r--r--src/server/game/Scripting/ScriptSystem.h46
-rw-r--r--src/server/game/World/World.cpp2
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp14
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/zone_ghostlands.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_hinterlands.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/zone_wetlands.cpp6
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp38
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp16
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp18
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp6
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_ashenvale.cpp20
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp10
-rw-r--r--src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp8
-rw-r--r--src/server/scripts/Kalimdor/zone_darkshore.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_desolace.cpp8
-rw-r--r--src/server/scripts/Kalimdor/zone_feralas.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_moonglade.cpp12
-rw-r--r--src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp6
-rw-r--r--src/server/scripts/Kalimdor/zone_tanaris.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp14
-rw-r--r--src/server/scripts/Kalimdor/zone_thousand_needles.cpp18
-rw-r--r--src/server/scripts/Kalimdor/zone_ungoro_crater.cpp8
-rw-r--r--src/server/scripts/Kalimdor/zone_winterspring.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp8
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp8
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp11
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp10
-rw-r--r--src/server/scripts/Northrend/zone_borean_tundra.cpp28
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp6
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp16
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp8
-rw-r--r--src/server/scripts/Northrend/zone_storm_peaks.cpp15
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp10
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp16
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp16
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp14
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp8
-rw-r--r--src/server/scripts/Outland/zone_shattrath_city.cpp6
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp20
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp6
-rw-r--r--src/server/scripts/World/npcs_special.cpp11
98 files changed, 1342 insertions, 1442 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 30a0575c3d2..8377f05d8c7 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -330,6 +330,9 @@ class TC_GAME_API UnitAI
// Called when the dialog status between a player and the creature is requested.
virtual uint32 GetDialogStatus(Player* /*player*/);
+ virtual void WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { }
+ virtual void WaypointReached(uint32 /*nodeId*/, uint32 /*pathId*/) { }
+
private:
UnitAI(UnitAI const& right) = delete;
UnitAI& operator=(UnitAI const& right) = delete;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 68bbcdb1472..b4c2a640517 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -16,21 +16,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Npc_EscortAI
-SD%Complete: 100
-SDComment:
-SDCategory: Npc
-EndScriptData */
-
#include "ScriptedEscortAI.h"
#include "Creature.h"
#include "Group.h"
#include "Log.h"
#include "Map.h"
#include "MotionMaster.h"
+#include "MovementGenerator.h"
#include "ObjectAccessor.h"
#include "Player.h"
+#include "ScriptSystem.h"
#include "World.h"
enum Points
@@ -39,101 +34,62 @@ enum Points
POINT_HOME = 0xFFFFFE
};
-npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
- m_uiWPWaitTimer(2500),
- m_uiPlayerCheckTimer(1000),
- m_uiEscortState(STATE_ESCORT_NONE),
- MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE),
- m_pQuestForEscort(nullptr),
- m_bIsActiveAttacker(true),
- m_bIsRunning(false),
- m_bCanInstantRespawn(false),
- m_bCanReturnToStart(false),
- DespawnAtEnd(true),
- DespawnAtFar(true),
- ScriptWP(false),
- HasImmuneToNPCFlags(false)
-{ }
-
-void npc_escortAI::AttackStart(Unit* who)
+EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE),
+ _escortQuest(nullptr), _activeAttacker(true), _running(false), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true), _manualPath(false),
+ _hasImmuneToNPCFlags(false), _started(false), _ended(false), _resume(false)
{
- if (!who)
- return;
-
- if (me->Attack(who, true))
- {
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
- me->GetMotionMaster()->MovementExpired();
-
- if (IsCombatMovementAllowed())
- me->GetMotionMaster()->MoveChase(who);
- }
}
-Player* npc_escortAI::GetPlayerForEscort()
+Player* EscortAI::GetPlayerForEscort()
{
- return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID);
+ return ObjectAccessor::GetPlayer(*me, _playerGUID);
}
-//see followerAI
-bool npc_escortAI::AssistPlayerInCombatAgainst(Unit* who)
+// see followerAI
+bool EscortAI::AssistPlayerInCombatAgainst(Unit* who)
{
if (!who || !who->GetVictim())
return false;
- //experimental (unknown) flag not present
+ if (me->HasReactState(REACT_PASSIVE))
+ return false;
+
+ // experimental (unknown) flag not present
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST))
return false;
- //not a player
+ // not a player
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
- //never attack friendly
- if (me->IsFriendlyTo(who))
+ // never attack friendly
+ if (!me->IsValidAssistTarget(who->GetVictim()))
return false;
- //too far away and no free sight?
+ // too far away and no free sight?
if (me->IsWithinDistInMap(who, GetMaxPlayerDistance()) && me->IsWithinLOSInMap(who))
{
- //already fighting someone?
- if (!me->GetVictim())
- {
- AttackStart(who);
- return true;
- }
- else
- {
- me->EngageWithTarget(who);
- return true;
- }
+ me->EngageWithTarget(who);
+ return true;
}
return false;
}
-void npc_escortAI::MoveInLineOfSight(Unit* who)
+void EscortAI::MoveInLineOfSight(Unit* who)
{
- if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
- {
- if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
- return;
+ if (!who)
+ return;
- if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
- return;
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
+ return;
- if (me->IsHostileTo(who))
- {
- float fAttackRadius = me->GetAttackDistance(who);
- if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
- me->EngageWithTarget(who);
- }
- }
+ ScriptedAI::MoveInLineOfSight(who);
}
-void npc_escortAI::JustDied(Unit* /*killer*/)
+void EscortAI::JustDied(Unit* /*killer*/)
{
- if (!HasEscortState(STATE_ESCORT_ESCORTING) || !m_uiPlayerGUID || !m_pQuestForEscort)
+ if (!HasEscortState(STATE_ESCORT_ESCORTING) || !_playerGUID || !_escortQuest)
return;
if (Player* player = GetPlayerForEscort())
@@ -141,24 +97,26 @@ void npc_escortAI::JustDied(Unit* /*killer*/)
if (Group* group = player->GetGroup())
{
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
+ {
if (Player* member = groupRef->GetSource())
if (member->IsInMap(player))
- member->FailQuest(m_pQuestForEscort->GetQuestId());
+ member->FailQuest(_escortQuest->GetQuestId());
+ }
}
else
- player->FailQuest(m_pQuestForEscort->GetQuestId());
+ player->FailQuest(_escortQuest->GetQuestId());
}
}
-void npc_escortAI::JustAppeared()
+void EscortAI::JustAppeared()
{
- m_uiEscortState = STATE_ESCORT_NONE;
+ _escortState = STATE_ESCORT_NONE;
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
- //add a small delay before going to first waypoint, normal in near all cases
- m_uiWPWaitTimer = 2500;
+ // add a small delay before going to first waypoint, normal in near all cases
+ _pauseTimer = 2000;
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->RestoreFaction();
@@ -166,14 +124,12 @@ void npc_escortAI::JustAppeared()
Reset();
}
-void npc_escortAI::ReturnToLastPoint()
+void EscortAI::ReturnToLastPoint()
{
- float x, y, z, o;
- me->GetHomePosition(x, y, z, o);
- me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
+ me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, me->GetHomePosition());
}
-void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
+void EscortAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->GetThreatManager().ClearAllThreat();
@@ -184,27 +140,29 @@ void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
- TC_LOG_DEBUG("scripts", "EscortAI has left combat and is now returning to last point");
+ TC_LOG_DEBUG("scripts", "EscortAI::EnterEvadeMode: left combat and is now returning to last point");
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
- if (HasImmuneToNPCFlags)
+ if (_hasImmuneToNPCFlags)
me->SetImmuneToNPC(true);
Reset();
}
}
-bool npc_escortAI::IsPlayerOrGroupInRange()
+bool EscortAI::IsPlayerOrGroupInRange()
{
if (Player* player = GetPlayerForEscort())
{
if (Group* group = player->GetGroup())
{
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
+ {
if (Player* member = groupRef->GetSource())
if (me->IsWithinDistInMap(member, GetMaxPlayerDistance()))
return true;
+ }
}
else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance()))
return true;
@@ -213,88 +171,77 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
return false;
}
-void npc_escortAI::UpdateAI(uint32 diff)
+void EscortAI::UpdateAI(uint32 diff)
{
- //Waypoint Updating
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->GetVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
+ // Waypoint Updating
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->IsEngaged() && !HasEscortState(STATE_ESCORT_RETURNING))
{
- if (m_uiWPWaitTimer <= diff)
+ if (_pauseTimer <= diff)
{
- //End of the line
- if (CurrentWP == WaypointList.end())
+ if (!HasEscortState(STATE_ESCORT_PAUSED))
{
- if (DespawnAtEnd)
- {
- TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints");
-
- if (m_bCanReturnToStart)
- {
- float fRetX, fRetY, fRetZ;
- me->GetRespawnPosition(fRetX, fRetY, fRetZ);
-
- me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
+ _pauseTimer = 0;
- m_uiWPWaitTimer = 0;
-
- TC_LOG_DEBUG("scripts", "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
- return;
- }
+ if (_ended)
+ {
+ _ended = false;
+ me->GetMotionMaster()->MoveIdle();
- if (m_bCanInstantRespawn && !sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC))
- {
- me->setDeathState(JUST_DIED);
- me->Respawn();
- }
- else
+ if (_despawnAtEnd)
{
- if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC))
- me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
- me->DespawnOrUnsummon();
+ TC_LOG_DEBUG("scripts", "EscortAI::UpdateAI: reached end of waypoints, despawning at end");
+ if (_returnToStart)
+ {
+ Position respawnPosition;
+ float orientation = 0.f;
+ me->GetRespawnPosition(respawnPosition.m_positionX, respawnPosition.m_positionY, respawnPosition.m_positionZ, &orientation);
+ respawnPosition.SetOrientation(orientation);
+ me->GetMotionMaster()->MovePoint(POINT_HOME, respawnPosition);
+ TC_LOG_DEBUG("scripts", "EscortAI::UpdateAI: returning to spawn location: %s", respawnPosition.ToString().c_str());
+ }
+ else if (_instantRespawn)
+ me->Respawn(true);
+ else
+ me->DespawnOrUnsummon();
}
-
+ TC_LOG_DEBUG("scripts", "EscortAI::UpdateAI: reached end of waypoints");
+ RemoveEscortState(STATE_ESCORT_ESCORTING);
return;
}
- else
- {
- TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints with Despawn off");
- return;
+ if (!_started)
+ {
+ _started = true;
+ me->GetMotionMaster()->MovePath(_path, false);
+ }
+ else if (_resume)
+ {
+ _resume = false;
+ if (MovementGenerator* movementGenerator = me->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
+ movementGenerator->Resume(0);
}
- }
-
- if (!HasEscortState(STATE_ESCORT_PAUSED))
- {
- me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- TC_LOG_DEBUG("scripts", "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
-
- WaypointStart(CurrentWP->id);
-
- m_uiWPWaitTimer = 0;
}
}
else
- m_uiWPWaitTimer -= diff;
+ _pauseTimer -= diff;
}
- //Check if player or any member of his group is within range
- if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !me->GetVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
+ // Check if player or any member of his group is within range
+ if (_despawnAtFar && HasEscortState(STATE_ESCORT_ESCORTING) && _playerGUID && !me->GetVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
{
- if (m_uiPlayerCheckTimer <= diff)
+ if (_playerCheckTimer <= diff)
{
- if (DespawnAtFar && !IsPlayerOrGroupInRange())
+ if (!IsPlayerOrGroupInRange())
{
- TC_LOG_DEBUG("scripts", "EscortAI failed because player/group was to far away or not found");
+ TC_LOG_DEBUG("scripts", "EscortAI::UpdateAI: failed because player/group was to far away or not found");
bool isEscort = false;
- if (CreatureData const* cdata = me->GetCreatureData())
- isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
+ if (CreatureData const* creatureData = me->GetCreatureData())
+ isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (creatureData->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
- if (m_bCanInstantRespawn && !isEscort)
- {
- me->setDeathState(JUST_DIED);
- me->Respawn();
- }
- else if (m_bCanInstantRespawn && isEscort)
+ if (_instantRespawn && !isEscort)
+ me->DespawnOrUnsummon(0, Seconds(1));
+ else if (_instantRespawn && isEscort)
me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
else
me->DespawnOrUnsummon();
@@ -302,16 +249,16 @@ void npc_escortAI::UpdateAI(uint32 diff)
return;
}
- m_uiPlayerCheckTimer = 1000;
+ _playerCheckTimer = 1000;
}
else
- m_uiPlayerCheckTimer -= diff;
+ _playerCheckTimer -= diff;
}
UpdateEscortAI(diff);
}
-void npc_escortAI::UpdateEscortAI(uint32 /*diff*/)
+void EscortAI::UpdateEscortAI(uint32 /*diff*/)
{
if (!UpdateVictim())
return;
@@ -319,121 +266,103 @@ void npc_escortAI::UpdateEscortAI(uint32 /*diff*/)
DoMeleeAttackIfReady();
}
-void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
+void EscortAI::MovementInform(uint32 type, uint32 id)
{
- if (moveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
+ // no action allowed if there is no escort
+ if (!HasEscortState(STATE_ESCORT_ESCORTING))
return;
- //Combat start position reached, continue waypoint movement
- if (pointId == POINT_LAST_POINT)
+ if (type == POINT_MOTION_TYPE)
{
- TC_LOG_DEBUG("scripts", "EscortAI has returned to original position before combat");
-
- me->SetWalk(!m_bIsRunning);
- RemoveEscortState(STATE_ESCORT_RETURNING);
+ if (!_pauseTimer)
+ _pauseTimer = 2000;
- if (!m_uiWPWaitTimer)
- m_uiWPWaitTimer = 1;
+ // continue waypoint movement
+ if (id == POINT_LAST_POINT)
+ {
+ TC_LOG_DEBUG("scripts", "EscortAI::MovementInform: returned to before combat position");
+ me->SetWalk(!_running);
+ RemoveEscortState(STATE_ESCORT_RETURNING);
+ }
+ else if (id == POINT_HOME)
+ {
+ TC_LOG_DEBUG("scripts", "EscortAI::MovementInform: returned to home location and restarting waypoint path");
+ _started = false;
+ }
}
- else if (pointId == POINT_HOME)
+ else if (type == WAYPOINT_MOTION_TYPE)
{
- TC_LOG_DEBUG("scripts", "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
+ ASSERT(id < _path.nodes.size(), "EscortAI::MovementInform: referenced movement id (%u) points to non-existing node in loaded path", id);
+ WaypointNode waypoint = _path.nodes[id];
- CurrentWP = WaypointList.begin();
- m_uiWPWaitTimer = 1;
- }
- else if (CurrentWP != WaypointList.end())
- {
- //Make sure that we are still on the right waypoint
- if (CurrentWP->id != pointId)
+ TC_LOG_DEBUG("scripts", "EscortAI::MovementInform: waypoint node %u reached", waypoint.id);
+
+ // last point
+ if (id == _path.nodes.size() - 1)
{
- TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
- return;
+ _started = false;
+ _ended = true;
+ _pauseTimer = 1000;
}
-
- TC_LOG_DEBUG("scripts", "EscortAI Waypoint %u reached", CurrentWP->id);
-
- //Call WP function
- WaypointReached(CurrentWP->id);
-
- m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;
-
- ++CurrentWP;
}
}
+///@todo investigate whether if its necessary to handle anything on charm
/*
-void npc_escortAI::OnPossess(bool apply)
+void EscortAI::OnCharmed(bool apply)
{
- // We got possessed in the middle of being escorted, store the point
- // where we left off to come back to when possess is removed
- if (HasEscortState(STATE_ESCORT_ESCORTING))
- {
- if (apply)
- me->GetPosition(LastPos.x, LastPos.y, LastPos.z);
- else
- {
- Returning = true;
- me->GetMotionMaster()->MovementExpired();
- me->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
- }
- }
}
*/
-void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime)
+void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, uint32 waitTime/* = 0*/)
{
- Escort_Waypoint t(id, x, y, z, waitTime);
-
- WaypointList.push_back(t);
-
- // i think SD2 no longer uses this function
- ScriptWP = true;
- /*PointMovement wp;
- wp.m_uiCreatureEntry = me->GetEntry();
- wp.m_uiPointId = id;
- wp.m_fX = x;
- wp.m_fY = y;
- wp.m_fZ = z;
- wp.m_uiWaitTime = WaitTimeMs;
- PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/
+ Trinity::NormalizeMapCoord(x);
+ Trinity::NormalizeMapCoord(y);
+
+ WaypointNode waypoint;
+ waypoint.id = id;
+ waypoint.x = x;
+ waypoint.y = y;
+ waypoint.z = z;
+ waypoint.orientation = orientation;
+ waypoint.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
+ waypoint.delay = waitTime;
+ waypoint.eventId = 0;
+ waypoint.eventChance = 100;
+ _path.nodes.push_back(std::move(waypoint));
+
+ _manualPath = true;
}
-void npc_escortAI::FillPointMovementListForCreature()
+void EscortAI::FillPointMovementListForCreature()
{
- ScriptPointVector const* movePoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
- if (!movePoints)
+ WaypointPath const* path = sScriptSystemMgr->GetPath(me->GetEntry());
+ if (!path)
return;
- for (ScriptPointVector::const_iterator itr = movePoints->begin(); itr != movePoints->end(); ++itr)
+ for (WaypointNode const& value : path->nodes)
{
- Escort_Waypoint point(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime);
- WaypointList.push_back(point);
+ WaypointNode node = value;
+ Trinity::NormalizeMapCoord(node.x);
+ Trinity::NormalizeMapCoord(node.y);
+ node.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
+
+ _path.nodes.push_back(std::move(node));
}
}
-void npc_escortAI::SetRun(bool on)
+void EscortAI::SetRun(bool on)
{
- if (on)
- {
- if (!m_bIsRunning)
- me->SetWalk(false);
- else
- TC_LOG_DEBUG("scripts", "EscortAI attempt to set run mode, but is already running.");
- }
- else
- {
- if (m_bIsRunning)
- me->SetWalk(true);
- else
- TC_LOG_DEBUG("scripts", "EscortAI attempt to set walk mode, but is already walking.");
- }
+ if (on && !_running)
+ me->SetWalk(false);
+ else if (!on && _running)
+ me->SetWalk(true);
- m_bIsRunning = on;
+ _running = on;
}
/// @todo get rid of this many variables passed in function.
-void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
+void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
{
// Queue respawn from the point it starts
if (Map* map = me->GetMap())
@@ -453,149 +382,75 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
if (me->GetVictim())
{
- TC_LOG_ERROR("scripts.escortai", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
+ TC_LOG_ERROR("scripts", "EscortAI::Start: (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- TC_LOG_ERROR("scripts.escortai", "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
+ TC_LOG_ERROR("scripts", "EscortAI::Start: (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
- if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
- {
- if (!WaypointList.empty())
- WaypointList.clear();
+ if (!_manualPath && resetWaypoints)
FillPointMovementListForCreature();
- }
- if (WaypointList.empty())
+ if (_path.nodes.empty())
{
- TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
- me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
+ TC_LOG_ERROR("scripts", "EscortAI::Start: (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
- //set variables
- m_bIsActiveAttacker = isActiveAttacker;
- m_bIsRunning = run;
-
- m_uiPlayerGUID = playerGUID;
- m_pQuestForEscort = quest;
+ // set variables
+ _activeAttacker = isActiveAttacker;
+ _running = run;
+ _playerGUID = playerGUID;
+ _escortQuest = quest;
+ _instantRespawn = instantRespawn;
+ _returnToStart = canLoopPath;
- m_bCanInstantRespawn = instantRespawn;
- m_bCanReturnToStart = canLoopPath;
+ if (_returnToStart && _instantRespawn)
+ TC_LOG_DEBUG("scripts", "EscortAI::Start: (script: %s, creature entry: %u) is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.", me->GetScriptName().c_str(), me->GetEntry());
- if (m_bCanReturnToStart && m_bCanInstantRespawn)
- TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
+ me->GetMotionMaster()->MoveIdle();
+ me->GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
- {
- me->GetMotionMaster()->MovementExpired();
- me->GetMotionMaster()->MoveIdle();
- TC_LOG_DEBUG("scripts", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
- }
-
- //disable npcflags
+ // disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if (me->IsImmuneToNPC())
{
- HasImmuneToNPCFlags = true;
+ _hasImmuneToNPCFlags = true;
me->SetImmuneToNPC(false);
}
- TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
-
- CurrentWP = WaypointList.begin();
+ TC_LOG_DEBUG("scripts", "EscortAI::Start: (script: %s, creature entry: %u) started with %u waypoints. ActiveAttacker = %d, Run = %d, Player = %s", me->GetScriptName().c_str(), me->GetEntry(), uint32(_path.nodes.size()), _activeAttacker, _running, _playerGUID.ToString().c_str());
- //Set initial speed
- if (m_bIsRunning)
- me->SetWalk(false);
- else
- me->SetWalk(true);
+ // set initial speed
+ me->SetWalk(!_running);
+ _started = false;
AddEscortState(STATE_ESCORT_ESCORTING);
}
-void npc_escortAI::SetEscortPaused(bool on)
+void EscortAI::SetEscortPaused(bool on)
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
return;
if (on)
- AddEscortState(STATE_ESCORT_PAUSED);
- else
- RemoveEscortState(STATE_ESCORT_PAUSED);
-}
-
-bool npc_escortAI::SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation)
-{
- me->UpdatePosition(x, y, z, orientation);
- return SetNextWaypoint(pointId, false, true);
-}
-
-bool npc_escortAI::SetNextWaypoint(uint32 pointId, bool setPosition, bool resetWaypointsOnFail)
-{
- if (!WaypointList.empty())
- WaypointList.clear();
-
- FillPointMovementListForCreature();
-
- if (WaypointList.empty())
- return false;
-
- size_t const size = WaypointList.size();
- Escort_Waypoint waypoint(0, 0, 0, 0, 0);
- do
{
- waypoint = WaypointList.front();
- WaypointList.pop_front();
- if (waypoint.id == pointId)
- {
- if (setPosition)
- me->UpdatePosition(waypoint.x, waypoint.y, waypoint.z, me->GetOrientation());
-
- CurrentWP = WaypointList.begin();
- return true;
- }
- }
- while (!WaypointList.empty());
-
- // we failed.
- // we reset the waypoints in the start; if we pulled any, reset it again
- if (resetWaypointsOnFail && size != WaypointList.size())
- {
- if (!WaypointList.empty())
- WaypointList.clear();
-
- FillPointMovementListForCreature();
+ AddEscortState(STATE_ESCORT_PAUSED);
+ if (MovementGenerator* movementGenerator = me->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
+ movementGenerator->Pause(0);
}
-
- return false;
-}
-
-bool npc_escortAI::GetWaypointPosition(uint32 pointId, float& x, float& y, float& z)
-{
- ScriptPointVector const* waypoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
- if (!waypoints)
- return false;
-
- for (ScriptPointVector::const_iterator itr = waypoints->begin(); itr != waypoints->end(); ++itr)
+ else
{
- if (itr->uiPointId == pointId)
- {
- x = itr->fX;
- y = itr->fY;
- z = itr->fZ;
- return true;
- }
+ RemoveEscortState(STATE_ESCORT_PAUSED);
+ _resume = true;
}
-
- return false;
}
-bool npc_escortAI::IsEscortNPC(bool onlyIfActive) const
+bool EscortAI::IsEscortNPC(bool onlyIfActive) const
{
if (!onlyIfActive)
return true;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 2a745ad999f..4a514af33cc 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -20,93 +20,59 @@
#define SC_ESCORTAI_H
#include "ScriptedCreature.h"
-#include "ScriptSystem.h"
+#include "WaypointDefines.h"
class Quest;
#define DEFAULT_MAX_PLAYER_DISTANCE 50
-struct Escort_Waypoint
+enum EscortState : uint32
{
- Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w)
- {
- id = _id;
- x = _x;
- y = _y;
- z = _z;
- WaitTimeMs = _w;
- }
-
- uint32 id;
- float x;
- float y;
- float z;
- uint32 WaitTimeMs;
+ STATE_ESCORT_NONE = 0x00, // nothing in progress
+ STATE_ESCORT_ESCORTING = 0x01, // escort is in progress
+ STATE_ESCORT_RETURNING = 0x02, // escort is returning after being in combat
+ STATE_ESCORT_PAUSED = 0x04 // escort is paused, wont continue with next waypoint
};
-enum eEscortState
-{
- STATE_ESCORT_NONE = 0x000, //nothing in progress
- STATE_ESCORT_ESCORTING = 0x001, //escort are in progress
- STATE_ESCORT_RETURNING = 0x002, //escort is returning after being in combat
- STATE_ESCORT_PAUSED = 0x004 //will not proceed with waypoints before state is removed
-};
-
-struct TC_GAME_API npc_escortAI : public ScriptedAI
+struct TC_GAME_API EscortAI : public ScriptedAI
{
public:
- explicit npc_escortAI(Creature* creature);
- ~npc_escortAI() { }
-
- // CreatureAI functions
- void AttackStart(Unit* who) override;
+ explicit EscortAI(Creature* creature);
+ ~EscortAI() { }
+ void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI()
void MoveInLineOfSight(Unit* who) override;
-
void JustDied(Unit*) override;
-
void JustAppeared() override;
-
void ReturnToLastPoint();
-
void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override;
-
- void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI()
- virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
-
void MovementInform(uint32, uint32) override;
- // EscortAI functions
- void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime = 0); // waitTime is in ms
-
- //this will set the current position to x/y/z/o, and the current WP to pointId.
- bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation);
+ virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
- //this will set the current position to WP start position (if setPosition == true),
- //and the current WP to pointId
- bool SetNextWaypoint(uint32 pointId, bool setPosition = true, bool resetWaypointsOnFail = true);
-
- bool GetWaypointPosition(uint32 pointId, float& x, float& y, float& z);
-
- virtual void WaypointReached(uint32 pointId) = 0;
- virtual void WaypointStart(uint32 /*pointId*/) { }
+ void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, uint32 waitTime = 0); // waitTime is in ms
void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true);
void SetRun(bool on = true);
+
void SetEscortPaused(bool on);
+ void SetPauseTimer(uint32 Timer) { _pauseTimer = Timer; }
+
+ bool HasEscortState(uint32 escortState) { return (_escortState & escortState) != 0; }
+ virtual bool IsEscorted() const override { return (_escortState & STATE_ESCORT_ESCORTING); }
+
+ void SetMaxPlayerDistance(float newMax) { _maxPlayerDistance = newMax; }
+ float GetMaxPlayerDistance() const { return _maxPlayerDistance; }
- bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState) != 0; }
- virtual bool IsEscorted() const override { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
+ void SetDespawnAtEnd(bool despawn) { _despawnAtEnd = despawn; }
+ void SetDespawnAtFar(bool despawn) { _despawnAtFar = despawn; }
- void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
- float GetMaxPlayerDistance() const { return MaxPlayerDistance; }
+ bool GetAttack() const { return _activeAttacker; } // used in EnterEvadeMode override
+ void SetCanAttack(bool attack) { _activeAttacker = attack; }
+
+ ObjectGuid GetEventStarterGUID() const { return _playerGUID; }
- void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
- void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
- bool GetAttack() const { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
- void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
- ObjectGuid GetEventStarterGUID() const { return m_uiPlayerGUID; }
virtual bool IsEscortNPC(bool isEscorting) const override;
protected:
@@ -117,27 +83,29 @@ struct TC_GAME_API npc_escortAI : public ScriptedAI
bool IsPlayerOrGroupInRange();
void FillPointMovementListForCreature();
- void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
- void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
-
- ObjectGuid m_uiPlayerGUID;
- uint32 m_uiWPWaitTimer;
- uint32 m_uiPlayerCheckTimer;
- uint32 m_uiEscortState;
- float MaxPlayerDistance;
-
- Quest const* m_pQuestForEscort; //generally passed in Start() when regular escort script.
-
- std::list<Escort_Waypoint> WaypointList;
- std::list<Escort_Waypoint>::iterator CurrentWP;
-
- bool m_bIsActiveAttacker; //obsolete, determined by faction.
- bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
- bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used)
- bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests.
- bool DespawnAtEnd;
- bool DespawnAtFar;
- bool ScriptWP;
- bool HasImmuneToNPCFlags;
+ void AddEscortState(uint32 escortState) { _escortState |= escortState; }
+ void RemoveEscortState(uint32 escortState) { _escortState &= ~escortState; }
+
+ ObjectGuid _playerGUID;
+ uint32 _pauseTimer;
+ uint32 _playerCheckTimer;
+ uint32 _escortState;
+ float _maxPlayerDistance;
+
+ Quest const* _escortQuest; // generally passed in Start() when regular escort script.
+
+ WaypointPath _path;
+
+ bool _activeAttacker; // obsolete, determined by faction.
+ bool _running; // all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
+ bool _instantRespawn; // if creature should respawn instantly after escort over (if not, database respawntime are used)
+ bool _returnToStart; // if creature can walk same path (loop) without despawn. Not for regular escort quests.
+ bool _despawnAtEnd;
+ bool _despawnAtFar;
+ bool _manualPath;
+ bool _hasImmuneToNPCFlags;
+ bool _started;
+ bool _ended;
+ bool _resume;
};
#endif
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
index 24155db1cdd..1b13db8f7a3 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
@@ -41,8 +41,6 @@ class TC_GAME_API FollowerAI : public ScriptedAI
explicit FollowerAI(Creature* creature);
~FollowerAI() { }
- //virtual void WaypointReached(uint32 uiPointId) = 0;
-
void MovementInform(uint32 motionType, uint32 pointId) override;
void AttackStart(Unit*) override;
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 71cb6f7fdad..58f8f72d47b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -17,6 +17,7 @@
#include "SmartAI.h"
#include "Creature.h"
+#include "CreatureGroups.h"
#include "DBCStructure.h"
#include "GameObject.h"
#include "Group.h"
@@ -28,54 +29,12 @@
#include "ScriptMgr.h"
#include "Vehicle.h"
-SmartAI::SmartAI(Creature* c) : CreatureAI(c)
+SmartAI::SmartAI(Creature* creature) : CreatureAI(creature), mIsCharmed(false), mFollowCreditType(0), mFollowArrivedTimer(0), mFollowCredit(0), mFollowArrivedEntry(0), mFollowDist(0.f), mFollowAngle(0.f),
+ _escortState(SMART_ESCORT_NONE), _escortNPCFlags(0), _escortInvokerCheckTimer(1000), _currentWaypointNode(0), _waypointReached(false), _waypointPauseTimer(0), _waypointPauseForced(false), _repeatWaypointPath(false),
+ _OOCReached(false), _waypointPathEnded(false), mRun(true), mEvadeDisabled(false), mCanAutoAttack(true), mCanCombatMove(true), mInvincibilityHpLevel(0), mDespawnTime(0), mDespawnState(0), mJustReset(false),
+ mConditionsTimer(0), _gossipReturn(false)
{
- mIsCharmed = false;
- // copy script to local (protection for table reload)
-
- mWayPoints = nullptr;
- mEscortState = SMART_ESCORT_NONE;
- mCurrentWPID = 0;//first wp id is 1 !!
- mWPReached = false;
- mWPPauseTimer = 0;
- mEscortNPCFlags = 0;
- mLastWP = nullptr;
-
- mCanRepeatPath = false;
-
- // Spawn in run mode
- me->SetWalk(false);
- mRun = false;
- mEvadeDisabled = false;
-
- mLastOOCPos = me->GetPosition();
-
- mCanAutoAttack = true;
- mCanCombatMove = true;
-
- mForcedPaused = false;
- mLastWPIDReached = 0;
-
- mEscortQuestID = 0;
-
- mDespawnTime = 0;
- mDespawnState = 0;
-
- mEscortInvokerCheckTimer = 1000;
- mFollowGuid.Clear();
- mFollowDist = 0;
- mFollowAngle = 0;
- mFollowCredit = 0;
- mFollowArrivedEntry = 0;
- mFollowCreditType = 0;
- mFollowArrivedTimer = 0;
- mInvincibilityHpLevel = 0;
-
- mJustReset = false;
- mConditionsTimer = 0;
- mHasConditions = sConditionMgr->HasConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, c->GetEntry());
-
- _gossipReturn = false;
+ mHasConditions = sConditionMgr->HasConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, creature->GetEntry());
}
bool SmartAI::IsAIControlled() const
@@ -101,74 +60,68 @@ void SmartAI::UpdateDespawn(uint32 diff)
} else mDespawnTime -= diff;
}
-WayPoint* SmartAI::GetNextWayPoint()
+void SmartAI::StartPath(bool run/* = false*/, uint32 pathId/* = 0*/, bool repeat/* = false*/, Unit* invoker/* = nullptr*/, uint32 nodeId/* = 1*/)
{
- if (!mWayPoints || mWayPoints->empty())
- return nullptr;
-
- mCurrentWPID++;
- WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID);
- if (itr != mWayPoints->end())
+ if (me->IsInCombat()) // no wp movement in combat
{
- mLastWP = (*itr).second;
- if (mLastWP->id != mCurrentWPID)
- {
- TC_LOG_ERROR("misc", "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
- }
- return (*itr).second;
- }
- return nullptr;
-}
-
-void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
-{
- if (me->IsInCombat())// no wp movement in combat
- {
- TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
+ TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement (%u) while in combat, ignoring.", me->GetEntry(), pathId);
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
- if (path)
+ SetRun(run);
+
+ if (pathId)
{
- if (!LoadPath(path))
+ if (!LoadPath(pathId))
return;
}
- if (!mWayPoints || mWayPoints->empty())
+ if (_path.nodes.empty())
return;
- if (WayPoint* wp = GetNextWayPoint())
- {
- AddEscortState(SMART_ESCORT_ESCORTING);
- mCanRepeatPath = repeat;
+ _currentWaypointNode = nodeId;
+ _waypointPathEnded = false;
- SetRun(run);
+ _repeatWaypointPath = repeat;
- if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
- {
- mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
- me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
- }
+ // Do not use AddEscortState, removing everything from previous
+ _escortState = SMART_ESCORT_ESCORTING;
- mLastOOCPos = me->GetPosition();
- me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, wp->id, GetScript()->GetPathId());
+ if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
+ {
+ _escortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
+ me->SetFlag(UNIT_NPC_FLAGS, 0);
}
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, _currentWaypointNode, GetScript()->GetPathId());
+
+ me->GetMotionMaster()->MovePath(_path, _repeatWaypointPath);
}
bool SmartAI::LoadPath(uint32 entry)
{
if (HasEscortState(SMART_ESCORT_ESCORTING))
return false;
- mWayPoints = sSmartWaypointMgr->GetPath(entry);
- if (!mWayPoints)
+
+ WaypointPath const* path = sSmartWaypointMgr->GetPath(entry);
+ if (!path || path->nodes.empty())
{
GetScript()->SetPathId(0);
return false;
}
+
+ _path.id = path->id;
+ _path.nodes = path->nodes;
+ for (WaypointNode& waypoint : _path.nodes)
+ {
+ Trinity::NormalizeMapCoord(waypoint.x);
+ Trinity::NormalizeMapCoord(waypoint.y);
+ waypoint.moveType = mRun ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;
+ }
+
GetScript()->SetPathId(entry);
return true;
}
@@ -177,22 +130,26 @@ void SmartAI::PausePath(uint32 delay, bool forced)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
+
if (HasEscortState(SMART_ESCORT_PAUSED))
{
- TC_LOG_ERROR("misc", "SmartAI::PausePath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
+ TC_LOG_ERROR("misc", "SmartAI::PausePath: Creature entry %u wanted to pause waypoint (current waypoint: %u) movement while already paused, ignoring.", me->GetEntry(), _currentWaypointNode);
return;
}
- mForcedPaused = forced;
- mLastOOCPos = me->GetPosition();
- AddEscortState(SMART_ESCORT_PAUSED);
- mWPPauseTimer = delay;
+
+ _waypointPauseTimer = delay;
+
if (forced)
{
+ _waypointPauseForced = forced;
SetRun(mRun);
- me->StopMoving();//force stop
- me->GetMotionMaster()->MoveIdle();//force stop
+ me->PauseMovement();
}
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, mLastWP->id, GetScript()->GetPathId());
+ else
+ _waypointReached = false;
+
+ AddEscortState(SMART_ESCORT_PAUSED);
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, _currentWaypointNode, GetScript()->GetPathId());
}
void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
@@ -202,40 +159,29 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
if (quest)
mEscortQuestID = quest;
- SetDespawnTime(DespawnTime);
- //mDespawnTime = DespawnTime;
- mLastOOCPos = me->GetPosition();
- me->StopMoving();//force stop
+ if (mDespawnState != 2)
+ SetDespawnTime(DespawnTime);
+
me->GetMotionMaster()->MoveIdle();
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, mLastWP->id, GetScript()->GetPathId());
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, _currentWaypointNode, GetScript()->GetPathId());
+
EndPath(fail);
}
void SmartAI::EndPath(bool fail)
{
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, mLastWP->id, GetScript()->GetPathId());
-
RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
- mWayPoints = nullptr;
- mCurrentWPID = 0;
- mWPPauseTimer = 0;
- mLastWP = nullptr;
+ _path.nodes.clear();
+ _waypointPauseTimer = 0;
- if (mEscortNPCFlags)
+ if (_escortNPCFlags)
{
- me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
- mEscortNPCFlags = 0;
+ me->SetFlag(UNIT_NPC_FLAGS, _escortNPCFlags);
+ _escortNPCFlags = 0;
}
- if (mCanRepeatPath)
- {
- if (IsAIControlled())
- StartPath(mRun, GetScript()->GetPathId(), true);
- }
- else
- GetScript()->SetPathId(0);
-
ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS, *me);
if (targets && mEscortQuestID)
{
@@ -279,15 +225,36 @@ void SmartAI::EndPath(bool fail)
}
}
+ // End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP
+ if (fail)
+ return;
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, _currentWaypointNode, GetScript()->GetPathId());
+
+ if (_repeatWaypointPath)
+ {
+ if (IsAIControlled())
+ StartPath(mRun, GetScript()->GetPathId(), _repeatWaypointPath);
+ }
+ else
+ GetScript()->SetPathId(0);
+
if (mDespawnState == 1)
StartDespawn();
}
void SmartAI::ResumePath()
{
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, _currentWaypointNode, GetScript()->GetPathId());
+
+ RemoveEscortState(SMART_ESCORT_PAUSED);
+
+ _waypointPauseForced = false;
+ _waypointReached = false;
+ _waypointPauseTimer = 0;
+
SetRun(mRun);
- if (mLastWP)
- me->GetMotionMaster()->MovePoint(mLastWP->id, mLastWP->x, mLastWP->y, mLastWP->z);
+ me->ResumeMovement();
}
void SmartAI::ReturnToLastOOCPos()
@@ -295,82 +262,57 @@ void SmartAI::ReturnToLastOOCPos()
if (!IsAIControlled())
return;
- SetRun(mRun);
- me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, mLastOOCPos);
+ me->SetWalk(false);
+ me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, me->GetHomePosition());
}
void SmartAI::UpdatePath(const uint32 diff)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
- if (mEscortInvokerCheckTimer < diff)
+
+ if (_escortInvokerCheckTimer < diff)
{
- // Escort failed, no players in range
if (!IsEscortInvokerInRange())
{
StopPath(0, mEscortQuestID, true);
// allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
- me->DespawnOrUnsummon(1);
+ me->DespawnOrUnsummon();
return;
}
- mEscortInvokerCheckTimer = 1000;
+ _escortInvokerCheckTimer = 1000;
}
else
- mEscortInvokerCheckTimer -= diff;
+ _escortInvokerCheckTimer -= diff;
// handle pause
- if (HasEscortState(SMART_ESCORT_PAUSED))
+ if (HasEscortState(SMART_ESCORT_PAUSED) && (_waypointReached || _waypointPauseForced))
{
- if (mWPPauseTimer < diff)
+ if (_waypointPauseTimer <= diff)
{
- if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT || mForcedPaused))
- {
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, mLastWP->id, GetScript()->GetPathId());
- RemoveEscortState(SMART_ESCORT_PAUSED);
- if (mForcedPaused)// if paused between 2 wps resend movement
- {
- ResumePath();
- mWPReached = false;
- mForcedPaused = false;
- }
- if (mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT)
- mWPReached = true;
- }
-
- mWPPauseTimer = 0;
+ if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING))
+ ResumePath();
}
else
- mWPPauseTimer -= diff;
+ _waypointPauseTimer -= diff;
+ }
+ else if (_waypointPathEnded) // end path
+ {
+ _waypointPathEnded = false;
+ StopPath();
+ return;
}
if (HasEscortState(SMART_ESCORT_RETURNING))
{
- if (mWPReached)//reached OOC WP
+ if (_OOCReached) // reached OOC WP
{
+ _OOCReached = false;
RemoveEscortState(SMART_ESCORT_RETURNING);
if (!HasEscortState(SMART_ESCORT_PAUSED))
ResumePath();
- mWPReached = false;
- }
- }
-
- if ((!me->HasReactState(REACT_PASSIVE) && me->IsInCombat()) || HasEscortState(SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING))
- return;
-
- // handle next wp
- if (mWPReached)//reached WP
- {
- mWPReached = false;
- if (mCurrentWPID == GetWPCount())
- {
- EndPath();
- }
- else if (WayPoint* wp = GetNextWayPoint())
- {
- SetRun(mRun);
- me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
}
}
}
@@ -450,24 +392,43 @@ bool SmartAI::IsEscortInvokerInRange()
return true;
}
-void SmartAI::MovepointReached(uint32 id)
+///@todo Implement new smart event SMART_EVENT_WAYPOINT_STARTED
+void SmartAI::WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/)
{
- if (id != SMART_ESCORT_LAST_OOC_POINT && mLastWPIDReached != id)
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, id);
+}
+
+void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId)
+{
+ _currentWaypointNode = nodeId;
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, _currentWaypointNode, pathId);
- mLastWPIDReached = id;
- mWPReached = true;
+ if (_waypointPauseTimer && !_waypointPauseForced)
+ {
+ _waypointReached = true;
+ me->PauseMovement();
+ }
+ else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
+ {
+ if (_currentWaypointNode == _path.nodes.size())
+ _waypointPathEnded = true;
+ else
+ SetRun(mRun);
+ }
}
-void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
+void SmartAI::MovementInform(uint32 type, uint32 id)
{
- if ((MovementType == POINT_MOTION_TYPE && Data == SMART_ESCORT_LAST_OOC_POINT) || MovementType == FOLLOW_MOTION_TYPE)
+ if (type == POINT_MOTION_TYPE && id == SMART_ESCORT_LAST_OOC_POINT)
me->ClearUnitState(UNIT_STATE_EVADE);
- GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data);
- if (MovementType != POINT_MOTION_TYPE || !HasEscortState(SMART_ESCORT_ESCORTING))
+ GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, type, id);
+
+ if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
- MovepointReached(Data);
+
+ if (type == POINT_MOTION_TYPE && id == SMART_ESCORT_LAST_OOC_POINT)
+ _OOCReached = true;
}
void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
@@ -511,8 +472,8 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
else
me->GetMotionMaster()->MoveTargetedHome();
- if (!HasEscortState(SMART_ESCORT_ESCORTING)) //dont mess up escort movement after combat
- SetRun(mRun);
+ if (!me->HasUnitState(UNIT_STATE_EVADE))
+ GetScript()->OnReset();
}
void SmartAI::MoveInLineOfSight(Unit* who)
@@ -544,19 +505,19 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who)
if (!who || !who->GetVictim())
return false;
- //experimental (unknown) flag not present
+ // experimental (unknown) flag not present
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST))
return false;
- //not a player
+ // not a player
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
- //never attack friendly
+ // never attack friendly
if (!me->IsValidAssistTarget(who->GetVictim()))
return false;
- //too far away and no free sight?
+ // too far away and no free sight?
if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who))
{
me->EngageWithTarget(who);
@@ -570,14 +531,14 @@ void SmartAI::JustAppeared()
{
mDespawnTime = 0;
mDespawnState = 0;
- mEscortState = SMART_ESCORT_NONE;
+ _escortState = SMART_ESCORT_NONE;
me->SetVisible(true);
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->RestoreFaction();
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
- mFollowGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
+ mFollowGuid.Clear(); // do not reset follower on Reset(), we need it after combat evade
mFollowDist = 0;
mFollowAngle = 0;
mFollowCredit = 0;
@@ -594,8 +555,16 @@ void SmartAI::JustReachedHome()
{
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
- if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
- me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
+ CreatureGroup* formation = me->GetFormation();
+ if (!formation || formation->getLeader() == me || !formation->isFormed())
+ {
+ if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
+ me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
+ else
+ me->ResumeMovement();
+ }
+ else if (formation->isFormed())
+ me->GetMotionMaster()->MoveIdle(); // wait the order of leader
}
mJustReset = false;
@@ -607,24 +576,14 @@ void SmartAI::EnterCombat(Unit* enemy)
me->InterruptNonMeleeSpells(false); // must be before ProcessEvents
GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy);
-
- if (!IsAIControlled())
- return;
- mLastOOCPos = me->GetPosition();
- SetRun(mRun);
- if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE)
- me->GetMotionMaster()->MovementExpired();
}
void SmartAI::JustDied(Unit* killer)
{
- GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, killer);
if (HasEscortState(SMART_ESCORT_ESCORTING))
- {
EndPath(true);
- me->StopMoving();//force stop
- me->GetMotionMaster()->MoveIdle();
- }
+
+ GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, killer);
}
void SmartAI::KilledUnit(Unit* victim)
@@ -642,15 +601,21 @@ void SmartAI::AttackStart(Unit* who)
// dont allow charmed npcs to act on their own
if (!IsAIControlled())
{
- if (who && mCanAutoAttack)
- me->Attack(who, true);
+ if (who)
+ me->Attack(who, mCanAutoAttack);
return;
}
- if (who && me->Attack(who, me->IsWithinMeleeRange(who)))
+ if (who && me->Attack(who, mCanAutoAttack))
{
+ me->GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
+ me->PauseMovement();
+
if (mCanCombatMove)
+ {
+ SetRun(mRun);
me->GetMotionMaster()->MoveChase(who);
+ }
}
}
@@ -713,10 +678,10 @@ void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
void SmartAI::InitializeAI()
{
GetScript()->OnInitialize(me);
+
if (!me->isDead())
{
- mJustReset = true;
- JustReachedHome();
+ GetScript()->OnReset();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
}
}
@@ -727,13 +692,13 @@ void SmartAI::OnCharmed(bool apply)
{
if (HasEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING))
EndPath(true);
- me->StopMoving();
}
+
mIsCharmed = apply;
if (!apply && !me->IsInEvadeMode())
{
- if (mCanRepeatPath)
+ if (_repeatWaypointPath)
StartPath(mRun, GetScript()->GetPathId(), true);
else
me->SetWalk(!mRun);
@@ -826,30 +791,21 @@ void SmartAI::SetCombatMove(bool on)
{
if (mCanCombatMove == on)
return;
+
mCanCombatMove = on;
+
if (!IsAIControlled())
return;
- if (!HasEscortState(SMART_ESCORT_ESCORTING))
+
+ if (me->IsEngaged())
{
- if (on && me->GetVictim())
+ if (on && !me->HasReactState(REACT_PASSIVE) && me->GetVictim() && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == MAX_MOTION_TYPE)
{
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
- {
- SetRun(mRun);
- me->GetMotionMaster()->MoveChase(me->GetVictim());
- me->CastStop();
- }
- }
- else
- {
- if (me->HasUnitState(UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE))
- return;
-
- me->GetMotionMaster()->MovementExpired();
- me->GetMotionMaster()->Clear(true);
- me->StopMoving();
- me->GetMotionMaster()->MoveIdle();
+ SetRun(mRun);
+ me->GetMotionMaster()->MoveChase(me->GetVictim());
}
+ else if (!on && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == CHASE_MOTION_TYPE)
+ me->GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
}
}
@@ -881,7 +837,6 @@ void SmartAI::StopFollow(bool complete)
mFollowArrivedTimer = 1000;
mFollowArrivedEntry = 0;
mFollowCreditType = 0;
- me->StopMoving();
me->GetMotionMaster()->MoveIdle();
if (!complete)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 3834fd01d07..9c22b509bc9 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -23,8 +23,7 @@
#include "GameObjectAI.h"
#include "Position.h"
#include "SmartScript.h"
-
-struct WayPoint;
+#include "WaypointDefines.h"
enum SmartEscortState
{
@@ -43,32 +42,37 @@ enum SmartEscortVars
class TC_GAME_API SmartAI : public CreatureAI
{
public:
- ~SmartAI(){ }
+ ~SmartAI() { }
explicit SmartAI(Creature* c);
+ // core related
+ static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
+
// Check whether we are currently permitted to make the creature take action
bool IsAIControlled() const;
// Start moving to the desired MovePoint
- void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr);
+ void StartPath(bool run = false, uint32 pathId = 0, bool repeat = false, Unit* invoker = nullptr, uint32 nodeId = 1);
bool LoadPath(uint32 entry);
void PausePath(uint32 delay, bool forced = false);
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
void EndPath(bool fail = false);
void ResumePath();
- WayPoint* GetNextWayPoint();
- bool HasEscortState(uint32 uiEscortState) const { return (mEscortState & uiEscortState) != 0; }
- void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
- void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
+ bool HasEscortState(uint32 uiEscortState) const { return (_escortState & uiEscortState) != 0; }
+ void AddEscortState(uint32 uiEscortState) { _escortState |= uiEscortState; }
+ void RemoveEscortState(uint32 uiEscortState) { _escortState &= ~uiEscortState; }
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
void SetCombatMove(bool on);
bool CanCombatMove() { return mCanCombatMove; }
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
void StopFollow(bool complete);
+ bool IsEscortInvokerInRange();
+
+ void WaypointStarted(uint32 nodeId, uint32 pathId) override;
+ void WaypointReached(uint32 nodeId, uint32 pathId) override;
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
SmartScript* GetScript() { return &mScript; }
- bool IsEscortInvokerInRange();
// Called when creature is spawned or respawned
void JustAppeared() override;
@@ -157,12 +161,6 @@ class TC_GAME_API SmartAI : public CreatureAI
// Used in scripts to share variables
ObjectGuid GetGUID(int32 id = 0) const override;
- //core related
- static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
-
- // Called at movepoint reached
- void MovepointReached(uint32 id);
-
// Makes the creature run/walk
void SetRun(bool run = true);
@@ -194,11 +192,20 @@ class TC_GAME_API SmartAI : public CreatureAI
void OnSpellClick(Unit* clicker, bool& result) override;
- void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
+ void SetWPPauseTimer(uint32 time) { _waypointPauseTimer = time; }
void SetGossipReturn(bool val) { _gossipReturn = val; }
private:
+ bool AssistPlayerInCombatAgainst(Unit* who);
+ void ReturnToLastOOCPos();
+ void UpdatePath(const uint32 diff);
+ void UpdateDespawn(uint32 diff);
+ // Vehicle conditions
+ void CheckConditions(uint32 diff);
+
+ SmartScript mScript;
+
bool mIsCharmed;
uint32 mFollowCreditType;
uint32 mFollowArrivedTimer;
@@ -208,36 +215,29 @@ class TC_GAME_API SmartAI : public CreatureAI
float mFollowDist;
float mFollowAngle;
- void ReturnToLastOOCPos();
- void UpdatePath(const uint32 diff);
- SmartScript mScript;
- WPPath* mWayPoints;
- uint32 mEscortState;
- uint32 mCurrentWPID;
- uint32 mLastWPIDReached;
- bool mWPReached;
- uint32 mWPPauseTimer;
- uint32 mEscortNPCFlags;
- WayPoint* mLastWP;
- Position mLastOOCPos;//set on enter combat
- uint32 GetWPCount() const { return mWayPoints ? uint32(mWayPoints->size()) : 0; }
- bool mCanRepeatPath;
+ uint32 _escortState;
+ uint32 _escortNPCFlags;
+ uint32 _escortInvokerCheckTimer;
+ WaypointPath _path;
+ uint32 _currentWaypointNode;
+ bool _waypointReached;
+ uint32 _waypointPauseTimer;
+ bool _waypointPauseForced;
+ bool _repeatWaypointPath;
+ bool _OOCReached;
+ bool _waypointPathEnded;
+
bool mRun;
bool mEvadeDisabled;
bool mCanAutoAttack;
bool mCanCombatMove;
- bool mForcedPaused;
uint32 mInvincibilityHpLevel;
- bool AssistPlayerInCombatAgainst(Unit* who);
uint32 mDespawnTime;
uint32 mDespawnState;
- void UpdateDespawn(uint32 diff);
- uint32 mEscortInvokerCheckTimer;
bool mJustReset;
// Vehicle conditions
- void CheckConditions(uint32 diff);
bool mHasConditions;
uint32 mConditionsTimer;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 79f3b7ce652..7f002ed6671 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -39,6 +39,7 @@
#include "SpellMgr.h"
#include "TemporarySummon.h"
#include "Vehicle.h"
+#include "WaypointDefines.h"
#include <G3D/Quat.h>
SmartScript::SmartScript()
@@ -1990,7 +1991,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
std::back_inserter(waypoints), [](uint32 wp) { return wp != 0; });
float distanceToClosest = std::numeric_limits<float>::max();
- WayPoint* closestWp = nullptr;
+ std::pair<uint32, uint32> closest = { 0, 0 };
for (WorldObject* target : targets)
{
@@ -1998,29 +1999,27 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsSmart(creature))
{
- for (uint32 wp : waypoints)
+ for (uint32 pathId : waypoints)
{
- WPPath* path = sSmartWaypointMgr->GetPath(wp);
- if (!path || path->empty())
+ WaypointPath const* path = sSmartWaypointMgr->GetPath(pathId);
+ if (!path || path->nodes.empty())
continue;
- auto itrWp = path->find(0);
- if (itrWp != path->end())
+ for (auto itr = path->nodes.begin(); itr != path->nodes.end(); ++itr)
{
- if (WayPoint* wp = itrWp->second)
+ WaypointNode const waypoint = *itr;
+ float distamceToThisNode = creature->GetDistance(waypoint.x, waypoint.y, waypoint.z);
+ if (distamceToThisNode < distanceToClosest)
{
- float distToThisPath = creature->GetDistance(wp->x, wp->y, wp->z);
- if (distToThisPath < distanceToClosest)
- {
- distanceToClosest = distToThisPath;
- closestWp = wp;
- }
+ distanceToClosest = distamceToThisNode;
+ closest.first = pathId;
+ closest.second = waypoint.id;
}
}
}
- if (closestWp)
- CAST_AI(SmartAI, creature->AI())->StartPath(false, closestWp->id, true);
+ if (closest.first != 0)
+ CAST_AI(SmartAI, creature->AI())->StartPath(false, closest.first, true, nullptr, closest.second);
}
}
}
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 3555575b2b2..b4713b7ed4d 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -29,6 +29,7 @@
#include "SpellMgr.h"
#include "Timer.h"
#include "UnitDefines.h"
+#include "WaypointDefines.h"
SmartWaypointMgr* SmartWaypointMgr::instance()
{
@@ -40,15 +41,7 @@ void SmartWaypointMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
- for (std::unordered_map<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
- {
- for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
- delete pathItr->second;
-
- delete itr->second;
- }
-
- waypoint_map.clear();
+ _waypointStore.clear();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);
PreparedQueryResult result = WorldDatabase.Query(stmt);
@@ -62,50 +55,47 @@ void SmartWaypointMgr::LoadFromDB()
uint32 count = 0;
uint32 total = 0;
- uint32 last_entry = 0;
- uint32 last_id = 1;
+ uint32 lastEntry = 0;
+ uint32 lastId = 1;
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 id = fields[1].GetUInt32();
- float x, y, z;
- x = fields[2].GetFloat();
- y = fields[3].GetFloat();
- z = fields[4].GetFloat();
+ float x = fields[2].GetFloat();
+ float y = fields[3].GetFloat();
+ float z = fields[4].GetFloat();
- if (last_entry != entry)
+ if (lastEntry != entry)
{
- waypoint_map[entry] = new WPPath();
- last_id = 1;
- count++;
+ lastId = 1;
+ ++count;
}
- if (last_id != id)
- TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
+ if (lastId != id)
+ TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, lastId);
- last_id++;
- (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
+ ++lastId;
+ WaypointPath& path = _waypointStore[entry];
+ path.id = entry;
+ path.nodes.emplace_back(id, x, y, z);
- last_entry = entry;
- total++;
+ lastEntry = entry;
+ ++total;
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
}
-SmartWaypointMgr::~SmartWaypointMgr()
+WaypointPath const* SmartWaypointMgr::GetPath(uint32 id)
{
- for (std::unordered_map<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
- {
- for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
- delete pathItr->second;
-
- delete itr->second;
- }
+ auto itr = _waypointStore.find(id);
+ if (itr != _waypointStore.end())
+ return &itr->second;
+ return nullptr;
}
SmartAIMgr* SmartAIMgr::instance()
@@ -1314,7 +1304,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_ACTION_WP_START:
{
- if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
+ WaypointPath const* path = sSmartWaypointMgr->GetPath(e.action.wpStart.pathID);
+ if (!path || path->nodes.empty())
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index f2ba244aaae..747b3c3d2c4 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -20,6 +20,7 @@
#include "Define.h"
#include "ObjectGuid.h"
+#include "WaypointDefines.h"
#include <map>
#include <string>
#include <unordered_map>
@@ -27,22 +28,6 @@
class WorldObject;
enum SpellEffIndex : uint8;
-struct WayPoint
-{
- WayPoint(uint32 _id, float _x, float _y, float _z)
- {
- id = _id;
- x = _x;
- y = _y;
- z = _z;
- }
-
- uint32 id;
- float x;
- float y;
- float z;
-};
-
enum eSmartAI
{
SMART_EVENT_PARAM_COUNT = 4,
@@ -1514,8 +1499,6 @@ struct SmartScriptHolder
operator bool() const { return entryOrGuid != 0; }
};
-typedef std::unordered_map<uint32, WayPoint*> WPPath;
-
typedef std::vector<WorldObject*> ObjectVector;
class ObjectGuidVector
@@ -1542,26 +1525,22 @@ typedef std::unordered_map<uint32, ObjectGuidVector> ObjectVectorMap;
class TC_GAME_API SmartWaypointMgr
{
- private:
- SmartWaypointMgr() { }
- ~SmartWaypointMgr();
-
public:
static SmartWaypointMgr* instance();
void LoadFromDB();
- WPPath* GetPath(uint32 id)
- {
- if (waypoint_map.find(id) != waypoint_map.end())
- return waypoint_map[id];
- else return nullptr;
- }
+ WaypointPath const* GetPath(uint32 id);
private:
- std::unordered_map<uint32, WPPath*> waypoint_map;
+ SmartWaypointMgr() { }
+ ~SmartWaypointMgr() { }
+
+ std::unordered_map<uint32, WaypointPath> _waypointStore;
};
+#define sSmartWaypointMgr SmartWaypointMgr::instance()
+
// all events for a single entry
typedef std::vector<SmartScriptHolder> SmartAIEventList;
typedef std::vector<SmartScriptHolder> SmartAIEventStoredList;
@@ -1627,5 +1606,5 @@ class TC_GAME_API SmartAIMgr
};
#define sSmartScriptMgr SmartAIMgr::instance()
-#define sSmartWaypointMgr SmartWaypointMgr::instance()
+
#endif
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index af1506c1fde..0e01304a9e4 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -313,6 +313,21 @@ void Creature::DisappearAndDie()
ForcedDespawn(0);
}
+void Creature::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
+{
+ Unit::PauseMovement(timer, slot);
+
+ SetHomePosition(GetPosition());
+}
+
+bool Creature::IsReturningHome() const
+{
+ if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == HOME_MOTION_TYPE)
+ return true;
+
+ return false;
+}
+
void Creature::SearchFormation()
{
if (IsSummon())
@@ -327,6 +342,33 @@ void Creature::SearchFormation()
sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this);
}
+bool Creature::IsFormationLeader() const
+{
+ if (!m_formation)
+ return false;
+
+ return m_formation->IsLeader(this);
+}
+
+void Creature::SignalFormationMovement(Position const& destination, uint32 id/* = 0*/, uint32 moveType/* = 0*/, bool orientation/* = false*/)
+{
+ if (!m_formation)
+ return;
+
+ if (!m_formation->IsLeader(this))
+ return;
+
+ m_formation->LeaderMoveTo(destination, id, moveType, orientation);
+}
+
+bool Creature::IsFormationLeaderMoveAllowed() const
+{
+ if (!m_formation)
+ return false;
+
+ return m_formation->CanLeaderStartMoving();
+}
+
void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
{
if (getDeathState() != CORPSE)
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 6273c34c04f..2446b9e87ad 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -35,6 +35,7 @@ class Quest;
class Player;
class SpellInfo;
class WorldSession;
+
enum MovementGeneratorType : uint8;
struct VendorItemCount
@@ -296,9 +297,15 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
uint32 GetCurrentWaypointID() const { return m_waypointID; }
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
+ void PauseMovement(uint32 timer = 0, uint8 slot = 0) override; // timer in ms
+ bool IsReturningHome() const;
+
void SearchFormation();
CreatureGroup* GetFormation() { return m_formation; }
void SetFormation(CreatureGroup* formation) { m_formation = formation; }
+ bool IsFormationLeader() const;
+ void SignalFormationMovement(Position const& destination, uint32 id = 0, uint32 moveType = 0, bool orientation = false);
+ bool IsFormationLeaderMoveAllowed() const;
Unit* SelectVictim();
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 3984a81cf71..b3eb8974048 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -258,3 +258,17 @@ void CreatureGroup::LeaderMoveTo(Position const& destination, uint32 id /*= 0*/,
member->SetHomePosition(dx, dy, dz, pathangle);
}
}
+
+bool CreatureGroup::CanLeaderStartMoving() const
+{
+ for (auto itr = m_members.begin(); itr != m_members.end(); ++itr)
+ {
+ if (itr->first != m_leader && itr->first->IsAlive())
+ {
+ if (itr->first->IsEngaged() || itr->first->IsReturningHome())
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h
index b36144db42f..52eb4eddf2a 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.h
+++ b/src/server/game/Entities/Creature/CreatureGroups.h
@@ -84,6 +84,7 @@ class TC_GAME_API CreatureGroup
uint32 GetId() const { return m_groupID; }
bool isEmpty() const { return m_members.empty(); }
bool isFormed() const { return m_Formed; }
+ bool IsLeader(Creature const* creature) const { return m_leader == creature; }
void AddMember(Creature* member);
void RemoveMember(Creature* member);
@@ -91,6 +92,7 @@ class TC_GAME_API CreatureGroup
void LeaderMoveTo(Position const& destination, uint32 id = 0, uint32 moveType = 0, bool orientation = false);
void MemberEngagingTarget(Creature* member, Unit* target);
+ bool CanLeaderStartMoving() const;
};
#define sFormationMgr FormationMgr::instance()
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index cced50e9531..8d6da421237 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -40,6 +40,7 @@
#include "Log.h"
#include "LootMgr.h"
#include "MotionMaster.h"
+#include "MovementGenerator.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
@@ -11406,6 +11407,26 @@ void Unit::StopMoving()
init.Stop();
}
+void Unit::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
+{
+ if (slot >= MAX_MOTION_SLOT)
+ return;
+
+ if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
+ movementGenerator->Pause(timer);
+
+ StopMoving();
+}
+
+void Unit::ResumeMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
+{
+ if (slot >= MAX_MOTION_SLOT)
+ return;
+
+ if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
+ movementGenerator->Resume(timer);
+}
+
void Unit::SendMovementFlagUpdate(bool self /* = false */)
{
WorldPacket data;
@@ -12596,8 +12617,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_UNIT)
{
+ if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
+ movementGenerator->Pause(0);
+
+ GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
+
+ StopMoving();
+
ToCreature()->AI()->OnCharmed(true);
- GetMotionMaster()->MoveIdle();
}
else if (Player* player = ToPlayer())
{
@@ -12711,6 +12738,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
else
RestoreFaction();
+ ///@todo Handle SLOT_IDLE motion resume
GetMotionMaster()->InitDefault();
if (Creature* creature = ToCreature())
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index a76137eec87..51031ce12a8 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1794,6 +1794,8 @@ class TC_GAME_API Unit : public WorldObject
bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); }
void StopMoving();
+ virtual void PauseMovement(uint32 timer = 0, uint8 slot = 0); // timer in ms
+ void ResumeMovement(uint32 timer = 0, uint8 slot = 0);
void AddUnitMovementFlag(uint32 f) { m_movementInfo.flags |= f; }
void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.flags &= ~f; }
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 8b03ff91240..a8e2315e8ec 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -51,7 +51,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
return;
// Stop the npc if moving
- unit->StopMoving();
+ unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(unit->GetEntry());
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 9f3e2a52efe..a1a661febab 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -615,8 +615,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
- if (vendor->HasUnitState(UNIT_STATE_MOVING))
- vendor->StopMoving();
+ vendor->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
VendorItemData const* items = vendor->GetVendorItems();
if (!items)
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 8b64e0e08bb..a8b365e5db2 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -24,9 +24,10 @@
#include "Corpse.h"
#include "Player.h"
#include "MapManager.h"
+#include "MotionMaster.h"
+#include "MovementGenerator.h"
#include "Transport.h"
#include "Battleground.h"
-#include "WaypointMovementGenerator.h"
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
#include "Vehicle.h"
@@ -133,8 +134,8 @@ void WorldSession::HandleMoveWorldportAck()
if (!_player->InBattleground())
{
// short preparations to continue flight
- FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
- flight->Initialize(GetPlayer());
+ MovementGenerator* movementGenerator = GetPlayer()->GetMotionMaster()->top();
+ movementGenerator->Initialize(GetPlayer());
return;
}
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index ddde13ae860..2bdfd463dbe 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -38,6 +38,7 @@
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
+#include "World.h"
#include "WorldPacket.h"
enum StableResultCode
@@ -322,11 +323,8 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
//if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
// GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- // and if he has pure gossip or is banker and moves or is tabard designer?
- //if (unit->IsArmorer() || unit->IsCivilian() || unit->IsQuestGiver() || unit->IsServiceProvider() || unit->IsGuard())
- {
- unit->StopMoving();
- }
+ // Stop the npc if moving
+ unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
// If spiritguide, no need for gossip menu, just put player into resurrect queue
if (unit->IsSpiritGuide())
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index f95fb01ed36..56464adb657 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -91,8 +91,9 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
+
// Stop the npc if moving
- creature->StopMoving();
+ creature->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
_player->PlayerTalkClass->ClearMenus();
if (creature->AI()->GossipHello(_player))
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index b35b2d711d2..6adc2d04aed 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -18,9 +18,11 @@
#include "WorldSession.h"
#include "Common.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
@@ -117,8 +119,7 @@ void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathN
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- while (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
- GetPlayer()->GetMotionMaster()->MovementExpired(false);
+ GetPlayer()->GetMotionMaster()->Clear(MOTION_SLOT_CONTROLLED);
if (mountDisplayId)
GetPlayer()->Mount(mountDisplayId);
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 003c9708628..c0450f97563 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -17,25 +17,28 @@
*/
#include "MotionMaster.h"
+#include "ConfusedMovementGenerator.h"
#include "Creature.h"
#include "CreatureAISelector.h"
#include "DBCStores.h"
-#include "Log.h"
-#include "Map.h"
-#include "PathGenerator.h"
-#include "ScriptSystem.h"
-#include "ConfusedMovementGenerator.h"
#include "FleeingMovementGenerator.h"
+#include "FormationMovementGenerator.h"
#include "HomeMovementGenerator.h"
#include "IdleMovementGenerator.h"
+#include "Log.h"
+#include "Map.h"
+#include "MoveSpline.h"
+#include "MoveSplineInit.h"
+#include "PathGenerator.h"
+#include "Player.h"
#include "PointMovementGenerator.h"
-#include "TargetedMovementGenerator.h"
-#include "WaypointMovementGenerator.h"
#include "RandomMovementGenerator.h"
+#include "ScriptSystem.h"
#include "SplineChainMovementGenerator.h"
-#include "FormationMovementGenerator.h"
-#include "MoveSpline.h"
-#include "MoveSplineInit.h"
+#include "TargetedMovementGenerator.h"
+#include "Unit.h"
+#include "WaypointDefines.h"
+#include "WaypointMovementGenerator.h"
inline MovementGenerator* GetIdleMovementGenerator()
{
@@ -672,16 +675,21 @@ void MotionMaster::MoveDistract(uint32 timer)
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
-void MotionMaster::MovePath(uint32 path_id, bool repeatable)
+void MotionMaster::MovePath(uint32 pathId, bool repeatable)
{
- if (!path_id)
+ if (!pathId)
return;
- Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
+ Mutate(new WaypointMovementGenerator<Creature>(pathId, repeatable), MOTION_SLOT_IDLE);
+
+ TC_LOG_DEBUG("misc", "%s (GUID: %u) starts moving over path(Id:%u, repeatable: %s).", _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().GetCounter(), pathId, repeatable ? "YES" : "NO");
+}
+
+void MotionMaster::MovePath(WaypointPath& path, bool repeatable)
+{
+ Mutate(new WaypointMovementGenerator<Creature>(path, repeatable), MOTION_SLOT_IDLE);
- TC_LOG_DEBUG("misc", "%s (GUID: %u) starts moving over path(Id:%u, repeatable: %s).",
- _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
- _owner->GetGUID().GetCounter(), path_id, repeatable ? "YES" : "NO");
+ TC_LOG_DEBUG("misc", "%s (GUID: %u) start moving over path(repeatable: %s)", _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().GetCounter(), repeatable ? "YES" : "NO");
}
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index d33739781b2..dcee98cdaaa 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -31,6 +31,7 @@ class Unit;
class PathGenerator;
struct SplineChainLink;
struct SplineChainResumeInfo;
+struct WaypointPath;
// Creature Entry ID used for waypoints show, visible only for GMs
#define VISUAL_WAYPOINT 1
@@ -61,9 +62,9 @@ enum MovementGeneratorType : uint8
MAX_MOTION_TYPE // limit
};
-enum MovementSlot
+enum MovementSlot : uint8
{
- MOTION_SLOT_IDLE,
+ MOTION_SLOT_IDLE = 0,
MOTION_SLOT_ACTIVE,
MOTION_SLOT_CONTROLLED,
MAX_MOTION_SLOT
@@ -160,7 +161,8 @@ class TC_GAME_API MotionMaster
void MoveSeekAssistanceDistract(uint32 timer);
void MoveTaxiFlight(uint32 path, uint32 pathnode);
void MoveDistract(uint32 time);
- void MovePath(uint32 path_id, bool repeatable);
+ void MovePath(uint32 pathId, bool repeatable);
+ void MovePath(WaypointPath& path, bool repeatable);
void MoveRotate(uint32 time, RotateDirection direction);
void MoveFormation(uint32 id, Position destination, uint32 moveType, bool forceRun = false, bool forceOrientation = false);
diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h
index 8f75e3a2361..39b2a16cc8b 100755
--- a/src/server/game/Movement/MovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerator.h
@@ -36,10 +36,11 @@ class TC_GAME_API MovementGenerator
virtual void Finalize(Unit*) = 0;
virtual void Reset(Unit*) = 0;
virtual bool Update(Unit*, uint32 diff) = 0;
-
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
virtual void UnitSpeedChanged() { }
+ virtual void Pause(uint32/* timer = 0*/) { } // timer in ms
+ virtual void Resume(uint32/* overrideTimer = 0*/) { } // timer in ms
// used by Evade code for select point to evade with expected restart default movement
virtual bool GetResetPosition(Unit*, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index a952421833d..7da90e2d515 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -18,7 +18,6 @@
#include "CreatureAI.h"
#include "Creature.h"
-#include "CreatureGroups.h"
#include "Player.h"
#include "MoveSplineInit.h"
#include "MoveSpline.h"
@@ -55,8 +54,7 @@ void PointMovementGenerator<T>::DoInitialize(T* owner)
// Call for creature group update
if (Creature* creature = owner->ToCreature())
- if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
- creature->GetFormation()->LeaderMoveTo(Position(_x, _y, _z), _movementId);
+ creature->SignalFormationMovement(Position(_x, _y, _z), _movementId);
}
template<class T>
@@ -90,8 +88,7 @@ bool PointMovementGenerator<T>::DoUpdate(T* owner, uint32 /*diff*/)
// Call for creature group update
if (Creature* creature = owner->ToCreature())
- if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
- creature->GetFormation()->LeaderMoveTo(Position(_x, _y, _z), _movementId);
+ creature->SignalFormationMovement(Position(_x, _y, _z), _movementId);
}
return !owner->movespline->Finalized();
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 0a1972c0972..b2a9e5b83b9 100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -18,7 +18,6 @@
#include "RandomMovementGenerator.h"
#include "Creature.h"
-#include "CreatureGroups.h"
#include "Map.h"
#include "MoveSplineInit.h"
#include "MoveSpline.h"
@@ -116,8 +115,7 @@ void RandomMovementGenerator<Creature>::SetRandomLocation(Creature* owner)
_timer.Reset(traveltime + resetTimer);
// Call for creature group update
- if (owner->GetFormation() && owner->GetFormation()->getLeader() == owner)
- owner->GetFormation()->LeaderMoveTo(position);
+ owner->SignalFormationMovement(position);
}
template<class T>
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index f292c0a8091..3ca1d581982 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -17,99 +17,128 @@
*/
#include "WaypointMovementGenerator.h"
+#include "Creature.h"
#include "CreatureAI.h"
-#include "CreatureGroups.h"
#include "Log.h"
#include "MapManager.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "Transport.h"
+#include "WaypointDefines.h"
+#include "WaypointManager.h"
#include "World.h"
+WaypointMovementGenerator<Creature>::WaypointMovementGenerator(WaypointPath& path, bool repeating)
+{
+ _path = &path;
+ _nextMoveTime = 0;
+ _recalculateSpeed = false;
+ _isArrivalDone = false;
+ _pathId = 0;
+ _repeating = repeating;
+ _loadedFromDB = false;
+ _stalled = false;
+}
+
void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
{
- if (!path_id)
- path_id = creature->GetWaypointPath();
+ if (_loadedFromDB)
+ {
+ if (!_pathId)
+ _pathId = creature->GetWaypointPath();
- i_path = sWaypointMgr->GetPath(path_id);
+ _path = sWaypointMgr->GetPath(_pathId);
+ }
- if (!i_path)
+ if (!_path)
{
// No path id found for entry
- TC_LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u DB GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUID().GetCounter(), creature->GetSpawnId(), path_id);
+ TC_LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u DB GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUID().GetCounter(), creature->GetSpawnId(), _pathId);
return;
}
- StartMoveNow(creature);
+ _nextMoveTime.Reset(3000);
+
+ if (CanMove(creature))
+ StartMoveNow(creature);
}
void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature)
{
LoadPath(creature);
- creature->AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
}
void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
{
- creature->ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
+ creature->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
creature->SetWalk(false);
}
void WaypointMovementGenerator<Creature>::DoReset(Creature* creature)
{
- creature->AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
- StartMoveNow(creature);
+ if (CanMove(creature))
+ StartMoveNow(creature);
}
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
{
- if (!i_path || i_path->empty())
+ if (!_path || _path->nodes.empty())
return;
- if (m_isArrivalDone)
- return;
-
- m_isArrivalDone = true;
- if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
+ WaypointNode const &waypoint = _path->nodes.at(_currentNode);
+ if (waypoint.delay)
{
- TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for %s.", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID().ToString().c_str());
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
- creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr);
+ _nextMoveTime.Reset(waypoint.delay);
}
- // Inform script
- MovementInform(creature);
- creature->UpdateWaypointID(i_currentNode);
-
- if (i_path->at(i_currentNode)->delay)
+ if (waypoint.eventId && urand(0, 99) < waypoint.eventChance)
{
+ TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for %s.", waypoint.eventId, _currentNode, creature->GetGUID().ToString().c_str());
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
- Stop(i_path->at(i_currentNode)->delay);
+ creature->GetMap()->ScriptsStart(sWaypointScripts, waypoint.eventId, creature, nullptr);
+ }
+
+ // inform AI
+ if (creature->AI())
+ {
+ creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, _currentNode);
+
+ ASSERT(_currentNode < _path->nodes.size(), "WaypointMovementGenerator::OnArrived: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
+ creature->AI()->WaypointReached(_path->nodes[_currentNode].id, _path->id);
}
+
+ creature->UpdateWaypointID(_currentNode);
}
bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
{
- if (!i_path || i_path->empty())
+ if (!creature || !creature->IsAlive())
return false;
- // Dont allow dead creatures to move
- if (!creature->IsAlive())
+ if (!_path || _path->nodes.empty())
return false;
- if (Stopped())
+ // if the owner is the leader of its formation, check members status
+ if (creature->IsFormationLeader() && !creature->IsFormationLeaderMoveAllowed())
+ {
+ _nextMoveTime.Reset(1000);
return true;
+ }
- bool transportPath = creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && creature->GetTransGUID();
+ bool transportPath = creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !creature->GetTransGUID().IsEmpty();
- if (m_isArrivalDone)
+ if (_isArrivalDone)
{
- if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
+ if ((_currentNode == _path->nodes.size() - 1) && !_repeating) // If that's our last waypoint
{
- float x = i_path->at(i_currentNode)->x;
- float y = i_path->at(i_currentNode)->y;
- float z = i_path->at(i_currentNode)->z;
+ WaypointNode const &waypoint = _path->nodes.at(_currentNode);
+
+ float x = waypoint.x;
+ float y = waypoint.y;
+ float z = waypoint.z;
float o = creature->GetOrientation();
if (!transportPath)
@@ -127,21 +156,27 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
transportPath = false;
// else if (vehicle) - this should never happen, vehicle offsets are const
}
-
- creature->GetMotionMaster()->Initialize();
return false;
}
- i_currentNode = (i_currentNode+1) % i_path->size();
+ _currentNode = (_currentNode + 1) % _path->nodes.size();
+
+ // inform AI
+ if (creature->AI())
+ {
+ ASSERT(_currentNode < _path->nodes.size(), "WaypointMovementGenerator::StartMove: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, _path->id);
+ creature->AI()->WaypointStarted(_path->nodes[_currentNode].id, _path->id);
+ }
}
- WaypointData const* node = i_path->at(i_currentNode);
+ WaypointNode const &waypoint = _path->nodes.at(_currentNode);
+ Position formationDest(waypoint.x, waypoint.y, waypoint.z, (waypoint.orientation && waypoint.delay) ? waypoint.orientation : 0.0f);
- m_isArrivalDone = false;
+ _isArrivalDone = false;
+ _recalculateSpeed = false;
creature->AddUnitState(UNIT_STATE_ROAMING_MOVE);
- Position formationDest(node->x, node->y, node->z, (node->orientation && node->delay) ? node->orientation : 0.0f);
Movement::MoveSplineInit init(creature);
//! If creature is on transport, we assume waypoints set in DB are already transport offsets
@@ -158,13 +193,13 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
//! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call
//! but formationDest contains global coordinates
- init.MoveTo(node->x, node->y, node->z);
+ init.MoveTo(waypoint.x, waypoint.y, waypoint.z);
//! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table
- if (node->orientation && node->delay)
- init.SetFacing(node->orientation);
+ if (waypoint.orientation && waypoint.delay)
+ init.SetFacing(waypoint.orientation);
- switch (node->move_type)
+ switch (waypoint.moveType)
{
case WAYPOINT_MOVE_TYPE_LAND:
init.SetAnimation(Movement::ToGround);
@@ -178,47 +213,57 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
case WAYPOINT_MOVE_TYPE_WALK:
init.SetWalk(true);
break;
+ default:
+ break;
}
init.Launch();
- // Call for creature group update
- if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
- creature->GetFormation()->LeaderMoveTo(formationDest, node->id, node->move_type, (node->orientation && node->delay) ? true : false);
+ // inform formation
+ creature->SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation && waypoint.delay) ? true : false);
return true;
}
bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 diff)
{
- // Waypoint movement can be switched on/off
- // This is quite handy for escort quests and other stuff
- if (creature->HasUnitState(UNIT_STATE_NOT_MOVE))
+ if (!creature || !creature->IsAlive())
+ return false;
+
+ if (_stalled || creature->HasUnitState(UNIT_STATE_NOT_MOVE) || creature->IsMovementPreventedByCasting())
{
- creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
+ creature->StopMoving();
return true;
}
+
// prevent a crash at empty waypoint path.
- if (!i_path || i_path->empty())
+ if (!_path || _path->nodes.empty())
return false;
- if (Stopped())
+ if (!_nextMoveTime.Passed())
{
- if (CanMove(diff))
- return StartMove(creature);
+ _nextMoveTime.Update(diff);
+ if (_nextMoveTime.Passed())
+ return StartMoveNow(creature);
}
else
{
// Set home position at place on waypoint movement.
- if (!creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || !creature->GetTransGUID())
+ if (!creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || creature->GetTransGUID().IsEmpty())
creature->SetHomePosition(creature->GetPosition());
- if (creature->IsStopped())
- Stop(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
- else if (creature->movespline->Finalized())
+ if (creature->movespline->Finalized())
{
OnArrived(creature);
- return StartMove(creature);
+ _isArrivalDone = true;
+
+ if (_nextMoveTime.Passed())
+ return StartMove(creature);
+ }
+ else if (_recalculateSpeed)
+ {
+ if (_nextMoveTime.Passed())
+ StartMove(creature);
}
}
return true;
@@ -227,38 +272,61 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
{
if (creature->AI())
- creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, i_currentNode);
+ creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, _currentNode);
}
bool WaypointMovementGenerator<Creature>::GetResetPos(Creature*, float& x, float& y, float& z)
{
// prevent a crash at empty waypoint path.
- if (!i_path || i_path->empty())
+ if (!_path || _path->nodes.empty())
return false;
- WaypointData const* node = i_path->at(i_currentNode);
- x = node->x; y = node->y; z = node->z;
+ WaypointNode const &waypoint = _path->nodes.at(_currentNode);
+
+ x = waypoint.x;
+ y = waypoint.y;
+ z = waypoint.z;
return true;
}
+void WaypointMovementGenerator<Creature>::Pause(uint32 timer/* = 0*/)
+{
+ _stalled = timer ? false : true;
+ _nextMoveTime.Reset(timer ? timer : 1);
+}
+
+void WaypointMovementGenerator<Creature>::Resume(uint32 overrideTimer/* = 0*/)
+{
+ _stalled = false;
+ if (overrideTimer)
+ _nextMoveTime.Reset(overrideTimer);
+}
+
+bool WaypointMovementGenerator<Creature>::CanMove(Creature* creature)
+{
+ return _nextMoveTime.Passed() && !creature->HasUnitState(UNIT_STATE_NOT_MOVE) && !creature->IsMovementPreventedByCasting();
+}
//----------------------------------------------------//
+#define FLIGHT_TRAVEL_UPDATE 100
+#define TIMEDIFF_NEXT_WP 250
+#define SKIP_SPLINE_POINT_DISTANCE_SQ (40.f * 40.f)
+#define PLAYER_FLIGHT_SPEED 32.0f
+
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
{
- if (i_currentNode >= i_path.size())
- return i_path.size();
+ if (_currentNode >= _path.size())
+ return _path.size();
- uint32 curMapId = i_path[i_currentNode]->MapID;
- for (uint32 i = i_currentNode; i < i_path.size(); ++i)
- if (i_path[i]->MapID != curMapId)
- return i;
+ uint32 curMapId = _path[_currentNode]->MapID;
+ for (uint32 itr = _currentNode; itr < _path.size(); ++itr)
+ if (_path[itr]->MapID != curMapId)
+ return itr;
- return i_path.size();
+ return _path.size();
}
-#define SKIP_SPLINE_POINT_DISTANCE_SQ (40.0f * 40.0f)
-
bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2)
{
return p1->MapID != p2->MapID || std::pow(p1->LocX - p2->LocX, 2) + std::pow(p1->LocY - p2->LocY, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ;
@@ -283,24 +351,24 @@ void FlightPathMovementGenerator::LoadPath(Player* player)
bool passedPreviousSegmentProximityCheck = false;
for (uint32 i = 0; i < nodes.size(); ++i)
{
- if (passedPreviousSegmentProximityCheck || !src || i_path.empty() || IsNodeIncludedInShortenedPath(i_path[i_path.size() - 1], nodes[i]))
+ if (passedPreviousSegmentProximityCheck || !src || _path.empty() || IsNodeIncludedInShortenedPath(_path[_path.size() - 1], nodes[i]))
{
if ((!src || (IsNodeIncludedInShortenedPath(start, nodes[i]) && i >= 2)) &&
(dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1)))
{
passedPreviousSegmentProximityCheck = true;
- i_path.push_back(nodes[i]);
+ _path.push_back(nodes[i]);
}
}
else
{
- i_path.pop_back();
+ _path.pop_back();
--_pointsForPathSwitch.back().PathIndex;
}
}
}
- _pointsForPathSwitch.push_back({ uint32(i_path.size() - 1), int32(cost) });
+ _pointsForPathSwitch.push_back({ uint32(_path.size() - 1), int32(cost) });
}
}
@@ -331,8 +399,6 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
}
-#define PLAYER_FLIGHT_SPEED 32.0f
-
void FlightPathMovementGenerator::DoReset(Player* player)
{
player->getHostileRefManager().setOnlineOfflineState(false);
@@ -343,7 +409,7 @@ void FlightPathMovementGenerator::DoReset(Player* player)
uint32 end = GetPathAtMapEnd();
for (uint32 i = GetCurrentNode(); i != end; ++i)
{
- G3D::Vector3 vertice(i_path[i]->LocX, i_path[i]->LocY, i_path[i]->LocZ);
+ G3D::Vector3 vertice(_path[i]->LocX, _path[i]->LocY, _path[i]->LocZ);
init.Path().push_back(vertice);
}
init.SetFirstPointId(GetCurrentNode());
@@ -355,13 +421,13 @@ void FlightPathMovementGenerator::DoReset(Player* player)
bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
{
uint32 pointId = (uint32)player->movespline->currentPathIdx();
- if (pointId > i_currentNode)
+ if (pointId > _currentNode)
{
bool departureEvent = true;
do
{
- DoEventIfAny(player, i_path[i_currentNode], departureEvent);
- while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= i_currentNode)
+ DoEventIfAny(player, _path[_currentNode], departureEvent);
+ while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= _currentNode)
{
_pointsForPathSwitch.pop_front();
player->m_taxi.NextTaxiDestination();
@@ -372,31 +438,31 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
}
}
- if (pointId == i_currentNode)
+ if (pointId == _currentNode)
break;
- if (i_currentNode == _preloadTargetNode)
+ if (_currentNode == _preloadTargetNode)
PreloadEndGrid();
- i_currentNode += (uint32)departureEvent;
+ _currentNode += departureEvent ? 1 : 0;
departureEvent = !departureEvent;
}
while (true);
}
- return i_currentNode < (i_path.size() - 1);
+ return _currentNode < (_path.size() - 1);
}
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
{
- if (i_path.empty() || i_currentNode >= i_path.size())
+ if (_path.empty() || _currentNode >= _path.size())
return;
- uint32 map0 = i_path[i_currentNode]->MapID;
- for (size_t i = i_currentNode + 1; i < i_path.size(); ++i)
+ uint32 map0 = _path[_currentNode]->MapID;
+ for (size_t i = _currentNode + 1; i < _path.size(); ++i)
{
- if (i_path[i]->MapID != map0)
+ if (_path[i]->MapID != map0)
{
- i_currentNode = i;
+ _currentNode = i;
return;
}
}
@@ -413,7 +479,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry
bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float& z)
{
- TaxiPathNodeEntry const* node = i_path[i_currentNode];
+ TaxiPathNodeEntry const* node = _path[_currentNode];
x = node->LocX;
y = node->LocY;
z = node->LocZ;
@@ -424,11 +490,11 @@ void FlightPathMovementGenerator::InitEndGridInfo()
{
/*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. */
- uint32 nodeCount = i_path.size(); //! Number of nodes in path.
- _endMapId = i_path[nodeCount - 1]->MapID; //! MapId of last node
+ uint32 nodeCount = _path.size(); //! Number of nodes in path.
+ _endMapId = _path[nodeCount - 1]->MapID; //! MapId of last node
_preloadTargetNode = nodeCount - 3;
- _endGridX = i_path[nodeCount - 1]->LocX;
- _endGridY = i_path[nodeCount - 1]->LocY;
+ _endGridX = _path[nodeCount - 1]->LocX;
+ _endGridY = _path[nodeCount - 1]->LocY;
}
void FlightPathMovementGenerator::PreloadEndGrid()
@@ -439,7 +505,7 @@ void FlightPathMovementGenerator::PreloadEndGrid()
// Load the grid
if (endMap)
{
- TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path.size() - 1));
+ TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(_path.size() - 1));
endMap->LoadGrid(_endGridX, _endGridY);
}
else
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index 7426a166ea1..2ea92f021da 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -19,98 +19,91 @@
#ifndef TRINITY_WAYPOINTMOVEMENTGENERATOR_H
#define TRINITY_WAYPOINTMOVEMENTGENERATOR_H
-/** @page PathMovementGenerator is used to generate movements
+/**
+ * @page PathMovementGenerator is used to generate movements
* of waypoints and flight paths. Each serves the purpose
* of generate activities so that it generates updated
* packets for the players.
*/
-#include "MovementGenerator.h"
-#include "Creature.h"
#include "DBCStructure.h"
-#include "Player.h"
+#include "MovementGenerator.h"
#include "Timer.h"
-#include "WaypointManager.h"
-#define FLIGHT_TRAVEL_UPDATE 100
-#define TIMEDIFF_NEXT_WP 250
+class Creature;
+class Player;
+struct WaypointPath;
-template<class T, class P>
+template<class Entity, class BasePath>
class PathMovementBase
{
public:
- PathMovementBase() : i_path(), i_currentNode(0) { }
+ PathMovementBase() : _path(), _currentNode(0) { }
virtual ~PathMovementBase() { };
- uint32 GetCurrentNode() const { return i_currentNode; }
+ uint32 GetCurrentNode() const { return _currentNode; }
protected:
- P i_path;
- uint32 i_currentNode;
+ BasePath _path;
+ uint32 _currentNode;
};
template<class T>
class WaypointMovementGenerator;
template<>
-class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
- public PathMovementBase<Creature, WaypointPath const*>
+class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium<Creature, WaypointMovementGenerator<Creature>>, public PathMovementBase<Creature, WaypointPath const*>
{
public:
- WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
- : i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) { }
- ~WaypointMovementGenerator() { i_path = nullptr; }
+ explicit WaypointMovementGenerator(uint32 pathId = 0, bool repeating = true) : _nextMoveTime(0), _recalculateSpeed(false), _isArrivalDone(false), _pathId(pathId), _repeating(repeating), _loadedFromDB(true), _stalled(false) { }
+ explicit WaypointMovementGenerator(WaypointPath& path, bool repeating = true);
+
+ ~WaypointMovementGenerator() { _path = nullptr; }
+
void DoInitialize(Creature*);
void DoFinalize(Creature*);
void DoReset(Creature*);
bool DoUpdate(Creature*, uint32 diff);
- void MovementInform(Creature*);
-
MovementGeneratorType GetMovementGeneratorType() const override { return WAYPOINT_MOTION_TYPE; }
+ void UnitSpeedChanged() override { _recalculateSpeed = true; }
+ void Pause(uint32 timer = 0) override;
+ void Resume(uint32 overrideTimer = 0) override;
- // now path movement implmementation
- void LoadPath(Creature*);
+ void MovementInform(Creature*);
bool GetResetPos(Creature*, float& x, float& y, float& z);
private:
-
- void Stop(int32 time) { i_nextMoveTime.Reset(time);}
-
- bool Stopped() { return !i_nextMoveTime.Passed();}
-
- bool CanMove(int32 diff)
- {
- i_nextMoveTime.Update(diff);
- return i_nextMoveTime.Passed();
- }
-
+ void LoadPath(Creature*);
void OnArrived(Creature*);
bool StartMove(Creature*);
-
- void StartMoveNow(Creature* creature)
+ bool CanMove(Creature*);
+ bool StartMoveNow(Creature* creature)
{
- i_nextMoveTime.Reset(0);
- StartMove(creature);
+ _nextMoveTime.Reset(0);
+ return StartMove(creature);
}
- TimeTrackerSmall i_nextMoveTime;
- bool m_isArrivalDone;
- uint32 path_id;
- bool repeating;
+ TimeTrackerSmall _nextMoveTime;
+ bool _recalculateSpeed;
+ bool _isArrivalDone;
+ uint32 _pathId;
+ bool _repeating;
+ bool _loadedFromDB;
+ bool _stalled;
};
-/** FlightPathMovementGenerator generates movement of the player for the paths
+/**
+ * FlightPathMovementGenerator generates movement of the player for the paths
* and hence generates ground and activities for the player.
*/
-class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
- public PathMovementBase<Player, TaxiPathNodeList>
+class FlightPathMovementGenerator : public MovementGeneratorMedium<Player, FlightPathMovementGenerator>, public PathMovementBase<Player, TaxiPathNodeList>
{
public:
explicit FlightPathMovementGenerator(uint32 startNode = 0)
{
- i_currentNode = startNode;
+ _currentNode = startNode;
_endGridX = 0.0f;
_endGridY = 0.0f;
_endMapId = 0;
@@ -123,15 +116,14 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig
bool DoUpdate(Player*, uint32);
MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
- TaxiPathNodeList const& GetPath() { return i_path; }
+ TaxiPathNodeList const& GetPath() { return _path; }
uint32 GetPathAtMapEnd() const;
- bool HasArrived() const { return (i_currentNode >= i_path.size()); }
+ bool HasArrived() const { return (_currentNode >= _path.size()); }
void SetCurrentNodeAfterTeleport();
- void SkipCurrentNode() { ++i_currentNode; }
+ void SkipCurrentNode() { ++_currentNode; }
void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure);
bool GetResetPos(Player*, float& x, float& y, float& z);
-
void InitEndGridInfo();
void PreloadEndGrid();
diff --git a/src/server/game/Movement/Waypoints/WaypointDefines.h b/src/server/game/Movement/Waypoints/WaypointDefines.h
new file mode 100644
index 00000000000..dbb7a15fa5c
--- /dev/null
+++ b/src/server/game/Movement/Waypoints/WaypointDefines.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_WAYPOINTDEFINES_H
+#define TRINITY_WAYPOINTDEFINES_H
+
+#include "Define.h"
+#include <vector>
+
+enum WaypointMoveType
+{
+ WAYPOINT_MOVE_TYPE_WALK,
+ WAYPOINT_MOVE_TYPE_RUN,
+ WAYPOINT_MOVE_TYPE_LAND,
+ WAYPOINT_MOVE_TYPE_TAKEOFF,
+
+ WAYPOINT_MOVE_TYPE_MAX
+};
+
+struct WaypointNode
+{
+ WaypointNode() : id(0), x(0.f), y(0.f), z(0.f), orientation(0.f), delay(0), eventId(0), moveType(WAYPOINT_MOVE_TYPE_RUN), eventChance(0) { }
+ WaypointNode(uint32 _id, float _x, float _y, float _z, float _orientation = 0.f, uint32 _delay = 0)
+ {
+ id = _id;
+ x = _x;
+ y = _y;
+ z = _z;
+ orientation = _orientation;
+ delay = _delay;
+ eventId = 0;
+ moveType = WAYPOINT_MOVE_TYPE_WALK;
+ eventChance = 100;
+ }
+
+ uint32 id;
+ float x, y, z, orientation;
+ uint32 delay;
+ uint32 eventId;
+ uint32 moveType;
+ uint8 eventChance;
+};
+
+struct WaypointPath
+{
+ WaypointPath() : id(0) { }
+ WaypointPath(uint32 _id, std::vector<WaypointNode>&& _nodes)
+ {
+ id = _id;
+ nodes = _nodes;
+ }
+
+ std::vector<WaypointNode> nodes;
+ uint32 id;
+};
+
+#endif
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 76c6228d302..3112459245f 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -16,27 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WaypointManager.h"
#include "DatabaseEnv.h"
#include "GridDefines.h"
-#include "WaypointManager.h"
#include "MapManager.h"
#include "Log.h"
-WaypointMgr::WaypointMgr() { }
-
-WaypointMgr::~WaypointMgr()
-{
- for (WaypointPathContainer::iterator itr = _waypointStore.begin(); itr != _waypointStore.end(); ++itr)
- {
- for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
- delete *it;
-
- itr->second.clear();
- }
-
- _waypointStore.clear();
-}
-
void WaypointMgr::Load()
{
uint32 oldMSTime = getMSTime();
@@ -55,11 +40,7 @@ void WaypointMgr::Load()
do
{
Field* fields = result->Fetch();
- WaypointData* wp = new WaypointData();
-
uint32 pathId = fields[0].GetUInt32();
- WaypointPath& path = _waypointStore[pathId];
-
float x = fields[2].GetFloat();
float y = fields[3].GetFloat();
float z = fields[4].GetFloat();
@@ -68,25 +49,27 @@ void WaypointMgr::Load()
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
- wp->id = fields[1].GetUInt32();
- wp->x = x;
- wp->y = y;
- wp->z = z;
- wp->orientation = o;
- wp->move_type = fields[6].GetUInt32();
+ WaypointNode waypoint;
+ waypoint.id = fields[1].GetUInt32();
+ waypoint.x = x;
+ waypoint.y = y;
+ waypoint.z = z;
+ waypoint.orientation = o;
+ waypoint.moveType = fields[6].GetUInt32();
- if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
+ if (waypoint.moveType >= WAYPOINT_MOVE_TYPE_MAX)
{
- TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
- delete wp;
+ TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", waypoint.id);
continue;
}
- wp->delay = fields[7].GetUInt32();
- wp->event_id = fields[8].GetUInt32();
- wp->event_chance = fields[9].GetInt16();
+ waypoint.delay = fields[7].GetUInt32();
+ waypoint.eventId = fields[8].GetUInt32();
+ waypoint.eventChance = fields[9].GetInt16();
- path.push_back(wp);
+ WaypointPath& path = _waypointStore[pathId];
+ path.id = pathId;
+ path.nodes.push_back(std::move(waypoint));
++count;
}
while (result->NextRow());
@@ -102,14 +85,9 @@ WaypointMgr* WaypointMgr::instance()
void WaypointMgr::ReloadPath(uint32 id)
{
- WaypointPathContainer::iterator itr = _waypointStore.find(id);
+ auto itr = _waypointStore.find(id);
if (itr != _waypointStore.end())
- {
- for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
- delete *it;
-
_waypointStore.erase(itr);
- }
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID);
@@ -120,13 +98,10 @@ void WaypointMgr::ReloadPath(uint32 id)
if (!result)
return;
- WaypointPath& path = _waypointStore[id];
-
+ std::vector<WaypointNode> values;
do
{
Field* fields = result->Fetch();
- WaypointData* wp = new WaypointData();
-
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
float z = fields[3].GetFloat();
@@ -135,26 +110,36 @@ void WaypointMgr::ReloadPath(uint32 id)
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
- wp->id = fields[0].GetUInt32();
- wp->x = x;
- wp->y = y;
- wp->z = z;
- wp->orientation = o;
- wp->move_type = fields[5].GetUInt32();
+ WaypointNode waypoint;
+ waypoint.id = fields[0].GetUInt32();
+ waypoint.x = x;
+ waypoint.y = y;
+ waypoint.z = z;
+ waypoint.orientation = o;
+ waypoint.moveType = fields[5].GetUInt32();
- if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
+ if (waypoint.moveType >= WAYPOINT_MOVE_TYPE_MAX)
{
- TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
- delete wp;
+ TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", waypoint.id);
continue;
}
- wp->delay = fields[6].GetUInt32();
- wp->event_id = fields[7].GetUInt32();
- wp->event_chance = fields[8].GetUInt8();
-
- path.push_back(wp);
+ waypoint.delay = fields[6].GetUInt32();
+ waypoint.eventId = fields[7].GetUInt32();
+ waypoint.eventChance = fields[8].GetUInt8();
+ values.push_back(std::move(waypoint));
}
while (result->NextRow());
+
+ _waypointStore[id] = WaypointPath(id, std::move(values));
+}
+
+WaypointPath const* WaypointMgr::GetPath(uint32 id) const
+{
+ auto itr = _waypointStore.find(id);
+ if (itr != _waypointStore.end())
+ return &itr->second;
+
+ return nullptr;
}
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h
index f62805594ef..769e45432e7 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.h
+++ b/src/server/game/Movement/Waypoints/WaypointManager.h
@@ -20,32 +20,10 @@
#define TRINITY_WAYPOINTMANAGER_H
#include "Define.h"
+#include "WaypointDefines.h"
#include <vector>
#include <unordered_map>
-enum WaypointMoveType
-{
- WAYPOINT_MOVE_TYPE_WALK,
- WAYPOINT_MOVE_TYPE_RUN,
- WAYPOINT_MOVE_TYPE_LAND,
- WAYPOINT_MOVE_TYPE_TAKEOFF,
-
- WAYPOINT_MOVE_TYPE_MAX
-};
-
-struct WaypointData
-{
- uint32 id;
- float x, y, z, orientation;
- uint32 delay;
- uint32 event_id;
- uint32 move_type;
- uint8 event_chance;
-};
-
-typedef std::vector<WaypointData*> WaypointPath;
-typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer;
-
class TC_GAME_API WaypointMgr
{
public:
@@ -58,20 +36,12 @@ class TC_GAME_API WaypointMgr
void Load();
// Returns the path from a given id
- WaypointPath const* GetPath(uint32 id) const
- {
- WaypointPathContainer::const_iterator itr = _waypointStore.find(id);
- if (itr != _waypointStore.end())
- return &itr->second;
-
- return nullptr;
- }
+ WaypointPath const* GetPath(uint32 id) const;
private:
- WaypointMgr();
- ~WaypointMgr();
+ WaypointMgr() { }
- WaypointPathContainer _waypointStore;
+ std::unordered_map<uint32, WaypointPath> _waypointStore;
};
#define sWaypointMgr WaypointMgr::instance()
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 1b4ad6b98d5..b814229151a 100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -37,17 +37,17 @@ void SystemMgr::LoadScriptWaypoints()
{
uint32 oldMSTime = getMSTime();
- // Drop Existing Waypoint list
- m_mPointMoveMap.clear();
+ // drop Existing Waypoint list
+ _waypointStore.clear();
- uint64 uiCreatureCount = 0;
+ uint64 entryCount = 0;
- // Load Waypoints
+ // load Waypoints
QueryResult result = WorldDatabase.Query("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
if (result)
- uiCreatureCount = result->GetRowCount();
+ entryCount = result->GetRowCount();
- TC_LOG_INFO("server.loading", "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ TC_LOG_INFO("server.loading", "Loading Script Waypoints for " UI64FMTD " creature(s)...", entryCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
@@ -61,29 +61,28 @@ void SystemMgr::LoadScriptWaypoints()
do
{
- Field* pFields = result->Fetch();
- ScriptPointMove temp;
-
- temp.uiCreatureEntry = pFields[0].GetUInt32();
- uint32 uiEntry = temp.uiCreatureEntry;
- temp.uiPointId = pFields[1].GetUInt32();
- temp.fX = pFields[2].GetFloat();
- temp.fY = pFields[3].GetFloat();
- temp.fZ = pFields[4].GetFloat();
- temp.uiWaitTime = pFields[5].GetUInt32();
-
- CreatureTemplate const* pCInfo = sObjectMgr->GetCreatureTemplate(temp.uiCreatureEntry);
-
- if (!pCInfo)
+ Field* fields = result->Fetch();
+ uint32 entry = fields[0].GetUInt32();
+ uint32 id = fields[1].GetUInt32();
+ float x = fields[2].GetFloat();
+ float y = fields[3].GetFloat();
+ float z = fields[4].GetFloat();
+ uint32 waitTime = fields[5].GetUInt32();
+
+ CreatureTemplate const* info = sObjectMgr->GetCreatureTemplate(entry);
+ if (!info)
{
- TC_LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
+ TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for non-existant creature entry %u", entry);
continue;
}
- if (!pCInfo->ScriptID)
- TC_LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
+ if (!info->ScriptID)
+ TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", entry);
+
+ WaypointPath& path = _waypointStore[entry];
+ path.id = entry;
+ path.nodes.emplace_back(id, x, y, z, 0.f, waitTime);
- m_mPointMoveMap[uiEntry].push_back(temp);
++count;
} while (result->NextRow());
@@ -163,6 +162,15 @@ void SystemMgr::LoadScriptSplineChains()
}
}
+WaypointPath const* SystemMgr::GetPath(uint32 creatureEntry) const
+{
+ auto itr = _waypointStore.find(creatureEntry);
+ if (itr == _waypointStore.end())
+ return nullptr;
+
+ return &itr->second;
+}
+
std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(uint32 entry, uint16 chainId) const
{
auto it = m_mSplineChainsMap.find({ entry, chainId });
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index 7828c24d680..7370a6262eb 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -21,59 +21,39 @@
#include "Define.h"
#include "Hash.h"
+#include "WaypointDefines.h"
#include <unordered_map>
#include <vector>
class Creature;
struct SplineChainLink;
-#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
-
-struct ScriptPointMove
-{
- uint32 uiCreatureEntry;
- uint32 uiPointId;
- float fX;
- float fY;
- float fZ;
- uint32 uiWaitTime;
-};
-
-typedef std::vector<ScriptPointMove> ScriptPointVector;
+#define TEXT_SOURCE_RANGE -1000000 // the amount of entries each text source has available
class TC_GAME_API SystemMgr
{
- private:
- SystemMgr();
- ~SystemMgr();
- SystemMgr(SystemMgr const&) = delete;
- SystemMgr& operator=(SystemMgr const&) = delete;
-
public:
static SystemMgr* instance();
- typedef std::unordered_map<uint32, ScriptPointVector> PointMoveMap;
-
- //Database
+ // database
void LoadScriptWaypoints();
void LoadScriptSplineChains();
- ScriptPointVector const* GetPointMoveList(uint32 creatureEntry) const
- {
- PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry);
-
- if (itr == m_mPointMoveMap.end())
- return nullptr;
-
- return &itr->second;
- }
+ WaypointPath const* GetPath(uint32 creatureEntry) const;
std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const;
std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const;
- protected:
- PointMoveMap m_mPointMoveMap; //coordinates for waypoints
+ private:
typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
+
+ SystemMgr();
+ ~SystemMgr();
+
+ SystemMgr(SystemMgr const&) = delete;
+ SystemMgr& operator=(SystemMgr const&) = delete;
+
+ std::unordered_map<uint32, WaypointPath> _waypointStore;
std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains
};
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index c67b8e4382e..3a0aeba72d1 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -81,7 +81,7 @@
#include "VMapFactory.h"
#include "VMapManager2.h"
#include "WardenCheckMgr.h"
-#include "WaypointMovementGenerator.h"
+#include "WaypointManager.h"
#include "WeatherMgr.h"
#include "WhoListStorage.h"
#include "WorldSession.h"
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 6298a34644f..609b4bd8918 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -31,6 +31,7 @@ EndScriptData */
#include "MotionMaster.h"
#include "Player.h"
#include "RBAC.h"
+#include "WaypointDefines.h"
#include "WaypointManager.h"
#include "WorldSession.h"
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index bcd4a915595..854f571c18c 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -135,9 +135,9 @@ public:
return GetBlackrockDepthsAI<npc_grimstoneAI>(creature);
}
- struct npc_grimstoneAI : public npc_escortAI
+ struct npc_grimstoneAI : public EscortAI
{
- npc_grimstoneAI(Creature* creature) : npc_escortAI(creature)
+ npc_grimstoneAI(Creature* creature) : EscortAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -202,7 +202,7 @@ public:
MobDeath_Timer = 2500;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -349,7 +349,7 @@ public:
}
if (CanWalk)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
};
@@ -510,9 +510,9 @@ class npc_rocknot : public CreatureScript
public:
npc_rocknot() : CreatureScript("npc_rocknot") { }
- struct npc_rocknotAI : public npc_escortAI
+ struct npc_rocknotAI : public EscortAI
{
- npc_rocknotAI(Creature* creature) : npc_escortAI(creature)
+ npc_rocknotAI(Creature* creature) : EscortAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -543,7 +543,7 @@ public:
go->SetGoState((GOState)state);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -597,7 +597,7 @@ public:
} else BreakDoor_Timer -= diff;
}
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
void QuestReward(Player* /*player*/, Quest const* quest, uint32 /*item*/) override
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index 83d0fdcc943..b965e3063e9 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -94,9 +94,9 @@ public:
return GetGnomereganAI<npc_blastmaster_emi_shortfuseAI>(creature);
}
- struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
+ struct npc_blastmaster_emi_shortfuseAI : public EscortAI
{
- npc_blastmaster_emi_shortfuseAI(Creature* creature) : npc_escortAI(creature)
+ npc_blastmaster_emi_shortfuseAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
creature->RestoreFaction();
@@ -219,7 +219,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
//just in case
if (GetPlayerForEscort())
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 8c5f57e9a8e..994dc2a989a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -131,9 +131,9 @@ class npc_barnes : public CreatureScript
public:
npc_barnes() : CreatureScript("npc_barnes") { }
- struct npc_barnesAI : public npc_escortAI
+ struct npc_barnesAI : public EscortAI
{
- npc_barnesAI(Creature* creature) : npc_escortAI(creature)
+ npc_barnesAI(Creature* creature) : EscortAI(creature)
{
Initialize();
RaidWiped = false;
@@ -184,7 +184,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -288,7 +288,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (HasEscortState(STATE_ESCORT_PAUSED))
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index f15b4613cb0..d11f352f6c0 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -1107,9 +1107,9 @@ class npc_scarlet_miner : public CreatureScript
public:
npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { }
- struct npc_scarlet_minerAI : public npc_escortAI
+ struct npc_scarlet_minerAI : public EscortAI
{
- npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature)
+ npc_scarlet_minerAI(Creature* creature) : EscortAI(creature)
{
Initialize();
me->SetReactState(REACT_PASSIVE);
@@ -1138,7 +1138,7 @@ class npc_scarlet_miner : public CreatureScript
void InitWaypoint()
{
- AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000);
+ AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 0.f, 5000);
AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f);
AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
@@ -1157,7 +1157,7 @@ class npc_scarlet_miner : public CreatureScript
AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f);
- AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000);
+ AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 0.f, 10000);
}
else
{
@@ -1165,7 +1165,7 @@ class npc_scarlet_miner : public CreatureScript
AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f);
- AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000);
+ AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 0.f, 10000);
}
}
@@ -1176,7 +1176,7 @@ class npc_scarlet_miner : public CreatureScript
SetDespawnAtFar(false);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -1224,7 +1224,7 @@ class npc_scarlet_miner : public CreatureScript
else
IntroTimer -= diff;
}
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 5e02a18caa6..0f571dda0c4 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -201,9 +201,9 @@ class npc_koltira_deathweaver : public CreatureScript
public:
npc_koltira_deathweaver() : CreatureScript("npc_koltira_deathweaver") { }
- struct npc_koltira_deathweaverAI : public npc_escortAI
+ struct npc_koltira_deathweaverAI : public EscortAI
{
- npc_koltira_deathweaverAI(Creature* creature) : npc_escortAI(creature)
+ npc_koltira_deathweaverAI(Creature* creature) : EscortAI(creature)
{
Initialize();
me->SetReactState(REACT_DEFENSIVE);
@@ -228,7 +228,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -281,7 +281,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_PAUSED))
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 5484bb78c2f..61806772fcd 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -274,9 +274,9 @@ class npc_highlord_darion_mograine : public CreatureScript
public:
npc_highlord_darion_mograine() : CreatureScript("npc_highlord_darion_mograine") { }
- struct npc_highlord_darion_mograineAI : public npc_escortAI
+ struct npc_highlord_darion_mograineAI : public EscortAI
{
- npc_highlord_darion_mograineAI(Creature* creature) : npc_escortAI(creature)
+ npc_highlord_darion_mograineAI(Creature* creature) : EscortAI(creature)
{
Reset();
}
@@ -453,7 +453,7 @@ public:
SetEscortPaused(bOnHold);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -571,12 +571,12 @@ public:
void EnterEvadeMode(EvadeReason why) override
{
if (!bIsBattle)//do not reset self if we are in battle
- npc_escortAI::EnterEvadeMode(why);
+ EscortAI::EnterEvadeMode(why);
}
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!bIsBattle)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 509faae7957..35d551afa71 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -149,9 +149,9 @@ public:
return GetScarletMonasteryAI<npc_scarlet_traineeAI>(creature);
}
- struct npc_scarlet_traineeAI : public npc_escortAI
+ struct npc_scarlet_traineeAI : public EscortAI
{
- npc_scarlet_traineeAI(Creature* creature) : npc_escortAI(creature)
+ npc_scarlet_traineeAI(Creature* creature) : EscortAI(creature)
{
Start_Timer = urand(1000, 6000);
}
@@ -159,7 +159,6 @@ public:
uint32 Start_Timer;
void Reset() override { }
- void WaypointReached(uint32 /*waypointId*/) override { }
void EnterCombat(Unit* /*who*/) override { }
void UpdateAI(uint32 diff) override
@@ -173,7 +172,7 @@ public:
} else Start_Timer -= diff;
}
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
};
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index f6a5009d112..21585333cbf 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -67,16 +67,16 @@ class npc_shadowfang_prisoner : public CreatureScript
public:
npc_shadowfang_prisoner() : CreatureScript("npc_shadowfang_prisoner") { }
- struct npc_shadowfang_prisonerAI : public npc_escortAI
+ struct npc_shadowfang_prisonerAI : public EscortAI
{
- npc_shadowfang_prisonerAI(Creature* creature) : npc_escortAI(creature)
+ npc_shadowfang_prisonerAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
}
InstanceScript* instance;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
index 501838888ef..2d3d36d425a 100644
--- a/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_arathi_highlands.cpp
@@ -60,11 +60,11 @@ class npc_professor_phizzlethorpe : public CreatureScript
public:
npc_professor_phizzlethorpe() : CreatureScript("npc_professor_phizzlethorpe") { }
- struct npc_professor_phizzlethorpeAI : public npc_escortAI
+ struct npc_professor_phizzlethorpeAI : public EscortAI
{
- npc_professor_phizzlethorpeAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_professor_phizzlethorpeAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -118,14 +118,14 @@ class npc_professor_phizzlethorpe : public CreatureScript
if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE)
{
Talk(SAY_PROGRESS_1, player);
- npc_escortAI::Start(false, false, player->GetGUID(), quest);
+ EscortAI::Start(false, false, player->GetGUID(), quest);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
}
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
index 5a8197d8f5f..28d942c0716 100644
--- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp
@@ -60,11 +60,11 @@ class npc_ranger_lilatha : public CreatureScript
public:
npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { }
- struct npc_ranger_lilathaAI : public npc_escortAI
+ struct npc_ranger_lilathaAI : public EscortAI
{
- npc_ranger_lilathaAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_ranger_lilathaAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
index fd5da36ecc8..519bfe5f619 100644
--- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
@@ -55,9 +55,9 @@ class npc_oox09hl : public CreatureScript
public:
npc_oox09hl() : CreatureScript("npc_oox09hl") { }
- struct npc_oox09hlAI : public npc_escortAI
+ struct npc_oox09hlAI : public EscortAI
{
- npc_oox09hlAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_oox09hlAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
@@ -81,11 +81,11 @@ public:
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetFaction(player->GetTeam() == ALLIANCE ? FACTION_ESCORTEE_A_PASSIVE : FACTION_ESCORTEE_H_PASSIVE);
Talk(SAY_OOX_START, player);
- npc_escortAI::Start(false, false, player->GetGUID(), quest);
+ EscortAI::Start(false, false, player->GetGUID(), quest);
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -103,7 +103,7 @@ public:
}
}
- void WaypointStart(uint32 pointId) override
+ void WaypointStarted(uint32 pointId, uint32 /*pathId*/) override
{
switch (pointId)
{
@@ -168,9 +168,9 @@ class npc_rinji : public CreatureScript
public:
npc_rinji() : CreatureScript("npc_rinji") { }
- struct npc_rinjiAI : public npc_escortAI
+ struct npc_rinjiAI : public EscortAI
{
- npc_rinjiAI(Creature* creature) : npc_escortAI(creature)
+ npc_rinjiAI(Creature* creature) : EscortAI(creature)
{
Initialize();
_IsByOutrunner = false;
@@ -193,7 +193,7 @@ public:
_IsByOutrunner = false;
spawnId = 0;
- npc_escortAI::JustAppeared();
+ EscortAI::JustAppeared();
}
void EnterCombat(Unit* who) override
@@ -241,11 +241,11 @@ public:
if (GameObject* go = me->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE))
go->UseDoorOrButton();
- npc_escortAI::Start(false, false, player->GetGUID(), quest);
+ EscortAI::Start(false, false, player->GetGUID(), quest);
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
index bcd4f9bcb37..4e4f767d989 100644
--- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
@@ -43,9 +43,9 @@ class npc_corporal_keeshan : public CreatureScript
public:
npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { }
- struct npc_corporal_keeshanAI : public npc_escortAI
+ struct npc_corporal_keeshanAI : public EscortAI
{
- npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature)
+ npc_corporal_keeshanAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -69,11 +69,11 @@ public:
{
Talk(SAY_CORPORAL_1, player);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
- npc_escortAI::Start(true, false, player->GetGUID(), quest);
+ EscortAI::Start(true, false, player->GetGUID(), quest);
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -105,7 +105,7 @@ public:
if (HasEscortState(STATE_ESCORT_NONE))
return;
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (phase)
{
diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
index 4a4e19d0225..bad77139853 100644
--- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
@@ -65,11 +65,11 @@ class npc_deathstalker_erland : public CreatureScript
public:
npc_deathstalker_erland() : CreatureScript("npc_deathstalker_erland") { }
- struct npc_deathstalker_erlandAI : public npc_escortAI
+ struct npc_deathstalker_erlandAI : public EscortAI
{
- npc_deathstalker_erlandAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_deathstalker_erlandAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
index d883f282549..e7f5ed8866f 100644
--- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
@@ -128,9 +128,9 @@ public:
return new npc_lord_gregor_lescovarAI(creature);
}
- struct npc_lord_gregor_lescovarAI : public npc_escortAI
+ struct npc_lord_gregor_lescovarAI : public EscortAI
{
- npc_lord_gregor_lescovarAI(Creature* creature) : npc_escortAI(creature)
+ npc_lord_gregor_lescovarAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -173,7 +173,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -264,7 +264,7 @@ public:
}
} else uiTimer -= uiDiff;
}
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
@@ -389,9 +389,9 @@ public:
return new npc_tyrion_spybotAI(creature);
}
- struct npc_tyrion_spybotAI : public npc_escortAI
+ struct npc_tyrion_spybotAI : public EscortAI
{
- npc_tyrion_spybotAI(Creature* creature) : npc_escortAI(creature)
+ npc_tyrion_spybotAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -410,7 +410,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -506,7 +506,7 @@ public:
}
} else uiTimer -= uiDiff;
}
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
index e0396397889..fcc2ea370ec 100644
--- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
@@ -43,9 +43,9 @@ class npc_galen_goodward : public CreatureScript
public:
npc_galen_goodward() : CreatureScript("npc_galen_goodward") { }
- struct npc_galen_goodwardAI : public npc_escortAI
+ struct npc_galen_goodwardAI : public EscortAI
{
- npc_galen_goodwardAI(Creature* creature) : npc_escortAI(creature)
+ npc_galen_goodwardAI(Creature* creature) : EscortAI(creature)
{
galensCageGUID.Clear();
Reset();
@@ -67,11 +67,11 @@ public:
if (quest->GetQuestId() == QUEST_GALENS_ESCAPE)
{
Talk(SAY_QUEST_ACCEPTED, player);
- npc_escortAI::Start(false, false, player->GetGUID(), quest);
+ EscortAI::Start(false, false, player->GetGUID(), quest);
}
}
- void WaypointStart(uint32 uiPointId) override
+ void WaypointStarted(uint32 uiPointId, uint32 /*pathId*/) override
{
switch (uiPointId)
{
@@ -95,7 +95,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -118,7 +118,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (HasEscortState(STATE_ESCORT_NONE))
return;
diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
index 51dbdf19a03..6120b89ee2b 100644
--- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp
@@ -56,9 +56,9 @@ public:
return new npc_tapoke_slim_jahnAI(creature);
}
- struct npc_tapoke_slim_jahnAI : public npc_escortAI
+ struct npc_tapoke_slim_jahnAI : public EscortAI
{
- npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature)
+ npc_tapoke_slim_jahnAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -76,7 +76,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index 921af01bfb4..a026506bb9d 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -223,16 +223,16 @@ class npc_morridune : public CreatureScript
public:
npc_morridune() : CreatureScript("npc_morridune") { }
- struct npc_morriduneAI : public npc_escortAI
+ struct npc_morriduneAI : public EscortAI
{
- npc_morriduneAI(Creature* creature) : npc_escortAI(creature)
+ npc_morriduneAI(Creature* creature) : EscortAI(creature)
{
Talk(SAY_MORRIDUNE_1);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Start(false);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
index b41eb13c46c..885d611e3bc 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
@@ -99,7 +99,7 @@ public:
Talk(SAY_ONSLAY);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7)
{
@@ -121,8 +121,8 @@ public:
{
if (IsEvent)
{
- //Must update npc_escortAI
- npc_escortAI::UpdateAI(diff);
+ //Must update EscortAI
+ EscortAI::UpdateAI(diff);
if (!go)
{
go = true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index 985f4e214a8..5e3ba51b1ca 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -102,7 +102,7 @@ public:
Talk(SAY_ONSLAY);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && instance)
{
@@ -124,8 +124,8 @@ public:
{
if (IsEvent)
{
- //Must update npc_escortAI
- npc_escortAI::UpdateAI(diff);
+ //Must update EscortAI
+ EscortAI::UpdateAI(diff);
if (!go)
{
go = true;
@@ -225,10 +225,6 @@ public:
{
}
- void WaypointReached(uint32 /*waypointId*/) override
- {
- }
-
void MoveInLineOfSight(Unit* who) override
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 25c174cb26a..fc26c35a314 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -97,7 +97,7 @@ public:
Talk(SAY_ONSLAY);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && instance)
{
@@ -119,8 +119,8 @@ public:
{
if (IsEvent)
{
- //Must update npc_escortAI
- npc_escortAI::UpdateAI(diff);
+ //Must update EscortAI
+ EscortAI::UpdateAI(diff);
if (!go)
{
go = true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index d1677b2c8ef..746350853b9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -92,7 +92,7 @@ public:
Talk(SAY_ONSLAY);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && instance)
{
@@ -114,8 +114,8 @@ public:
{
if (IsEvent)
{
- //Must update npc_escortAI
- npc_escortAI::UpdateAI(diff);
+ //Must update EscortAI
+ EscortAI::UpdateAI(diff);
if (!go)
{
go = true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index 48b8e59a5a7..ec918cbb3a4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -316,7 +316,7 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde
{5545.43f, -2647.82f, 1483.05f, 5.38848f, 0, 0, 0.432578f, -0.901596f}
};
-hyjalAI::hyjalAI(Creature* creature) : npc_escortAI(creature), Summons(me)
+hyjalAI::hyjalAI(Creature* creature) : EscortAI(creature), Summons(me)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -447,7 +447,7 @@ void hyjalAI::MoveInLineOfSight(Unit* who)
if (IsDummy)
return;
- npc_escortAI::MoveInLineOfSight(who);
+ EscortAI::MoveInLineOfSight(who);
}
void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
@@ -930,7 +930,7 @@ void hyjalAI::RespawnNearPos(float x, float y)
Cell::VisitGridObjects(x, y, me->GetMap(), worker, me->GetGridActivationRange());
}
-void hyjalAI::WaypointReached(uint32 waypointId)
+void hyjalAI::WaypointReached(uint32 waypointId, uint32 /*pathId*/)
{
if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
{
@@ -979,7 +979,7 @@ void hyjalAI::WaypointReached(uint32 waypointId)
}
void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (WaitForTeleport)
{
if (TeleportTimer <= diff)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index a61a568f61b..9a0c1f78b92 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -115,7 +115,7 @@ enum YellId
DEATH = 6, // Used on death
};
-struct hyjalAI : public npc_escortAI
+struct hyjalAI : public EscortAI
{
hyjalAI(Creature* creature);
@@ -144,7 +144,7 @@ struct hyjalAI : public npc_escortAI
void SummonedCreatureDespawn(Creature* summoned) override;
void HideNearPos(float x, float y);
void RespawnNearPos(float x, float y);
- void WaypointReached(uint32 waypointId) override;
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override;
void DoOverrun(uint32 faction, const uint32 diff);
void MoveInLineOfSight(Unit* who) override;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index f9cd454c67e..6d05e6094b1 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -176,7 +176,7 @@ float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the
{5429.91f, -2718.44f, 1493.42f}//20 end 2
};
-hyjal_trashAI::hyjal_trashAI(Creature* creature) : npc_escortAI(creature)
+hyjal_trashAI::hyjal_trashAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
IsEvent = false;
@@ -443,7 +443,7 @@ public:
void EnterCombat(Unit* /*who*/) override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 0 && !IsOverrun)
{
@@ -498,7 +498,7 @@ public:
if (!CanMove)return;
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -558,7 +558,7 @@ public:
KnockDownTimer = 10000;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -590,7 +590,7 @@ public:
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -656,7 +656,7 @@ public:
RandomMove = false;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -689,7 +689,7 @@ public:
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -766,7 +766,7 @@ public:
summons.Despawn(summon);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -810,7 +810,7 @@ public:
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
@@ -879,7 +879,7 @@ public:
ShellTimer = 50000 + rand32() % 10000;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -904,7 +904,7 @@ public:
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -975,7 +975,7 @@ public:
WebTimer = 20000 + rand32() % 5000;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -1000,7 +1000,7 @@ public:
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -1061,7 +1061,7 @@ public:
ManaBurnTimer = 9000 + rand32() % 5000;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 7 && !IsOverrun)
{
@@ -1086,7 +1086,7 @@ public:
{
hyjal_trashAI::UpdateAI(diff);
if (IsEvent || IsOverrun)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (IsEvent)
{
if (!go)
@@ -1155,7 +1155,7 @@ public:
me->SetDisableGravity(true);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 2 && !IsOverrun)
{
@@ -1189,7 +1189,7 @@ public:
if (IsEvent || IsOverrun)
{
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
if (IsEvent)
@@ -1280,7 +1280,7 @@ public:
me->SetDisableGravity(true);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 2 && !IsOverrun)
{
@@ -1310,7 +1310,7 @@ public:
if (IsEvent || IsOverrun)
{
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
if (IsEvent)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
index 66189f9c71d..d3ccbecf7ea 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h
@@ -21,7 +21,7 @@
#include "hyjal.h"
#include "ScriptedEscortAI.h"
-struct hyjal_trashAI : public npc_escortAI
+struct hyjal_trashAI : public EscortAI
{
hyjal_trashAI(Creature* creature);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
index 26c718c3930..93ccba1dc0a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -258,9 +258,9 @@ class npc_arthas : public CreatureScript
public:
npc_arthas() : CreatureScript("npc_arthas") { }
- struct npc_arthasAI : public npc_escortAI
+ struct npc_arthasAI : public EscortAI
{
- npc_arthasAI(Creature* creature) : npc_escortAI(creature)
+ npc_arthasAI(Creature* creature) : EscortAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -336,7 +336,7 @@ public:
void AttackStart(Unit* who) override
{
if (who && !who->IsImmuneToPC())
- npc_escortAI::AttackStart(who);
+ EscortAI::AttackStart(who);
}
void EnterCombat(Unit* /*who*/) override
@@ -391,7 +391,7 @@ public:
++step;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -511,7 +511,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (bStepping)
{
@@ -901,7 +901,7 @@ public:
}
}
else if (instance->GetBossState(bossEvent) == FAIL)
- npc_escortAI::EnterEvadeMode();
+ EscortAI::EnterEvadeMode();
else
phaseTimer = 10000;
break;
@@ -1061,7 +1061,7 @@ public:
JumpToNextStep(15000);
}
else if (instance->GetBossState(DATA_EPOCH) == FAIL)
- npc_escortAI::EnterEvadeMode();
+ EscortAI::EnterEvadeMode();
else
phaseTimer = 10000;
break;
@@ -1106,7 +1106,7 @@ public:
JumpToNextStep(1000);
}
else if (instance->GetBossState(DATA_MAL_GANIS) == FAIL)
- npc_escortAI::EnterEvadeMode();
+ EscortAI::EnterEvadeMode();
else
phaseTimer = 10000;
break;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 29e94b2bd9f..c4ba72f2563 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -197,9 +197,9 @@ class npc_thrall_old_hillsbrad : public CreatureScript
public:
npc_thrall_old_hillsbrad() : CreatureScript("npc_thrall_old_hillsbrad") { }
- struct npc_thrall_old_hillsbradAI : public npc_escortAI
+ struct npc_thrall_old_hillsbradAI : public EscortAI
{
- npc_thrall_old_hillsbradAI(Creature* creature) : npc_escortAI(creature)
+ npc_thrall_old_hillsbradAI(Creature* creature) : EscortAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -217,7 +217,7 @@ public:
bool LowHp;
bool HadMount;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -354,7 +354,7 @@ public:
if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA)))
{
if (Player* player = GetPlayerForEscort())
- ENSURE_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, player->GetGUID());
+ ENSURE_AI(EscortAI, (Taretha->AI()))->Start(false, true, player->GetGUID());
}
//kill credit Creature for quest
@@ -455,7 +455,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
@@ -564,16 +564,16 @@ class npc_taretha : public CreatureScript
public:
npc_taretha() : CreatureScript("npc_taretha") { }
- struct npc_tarethaAI : public npc_escortAI
+ struct npc_tarethaAI : public EscortAI
{
- npc_tarethaAI(Creature* creature) : npc_escortAI(creature)
+ npc_tarethaAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
}
InstanceScript* instance;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -591,7 +591,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index b2ee684d0f5..131087fb683 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -46,9 +46,9 @@ class npc_willix : public CreatureScript
public:
npc_willix() : CreatureScript("npc_willix") { }
- struct npc_willixAI : public npc_escortAI
+ struct npc_willixAI : public EscortAI
{
- npc_willixAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_willixAI(Creature* creature) : EscortAI(creature) { }
void QuestAccept(Player* player, Quest const* quest) override
{
@@ -60,7 +60,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 0286de05581..48308c9bc16 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -81,9 +81,9 @@ class npc_disciple_of_naralex : public CreatureScript
public:
npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { }
- struct npc_disciple_of_naralexAI : public npc_escortAI
+ struct npc_disciple_of_naralexAI : public EscortAI
{
- npc_disciple_of_naralexAI(Creature* creature) : npc_escortAI(creature)
+ npc_disciple_of_naralexAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
eventTimer = 0;
@@ -98,7 +98,7 @@ public:
uint32 eventProgress;
InstanceScript* instance;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -153,7 +153,7 @@ public:
void UpdateAI(uint32 diff) override
{
if (currentEvent != TYPE_NARALEX_PART3)
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (eventTimer <= diff)
{
@@ -177,7 +177,7 @@ public:
++eventProgress;
Talk(SAY_BANISH_THE_SPIRITS);
DoCast(me, SPELL_SERPENTINE_CLEANSING);
- //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
+ //CAST_AI(EscortAI, me->AI())->SetCanDefend(false);
eventTimer = 30000;
me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261f, 273.676f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658f, 280.799f, -92.8393f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
@@ -186,7 +186,7 @@ public:
else
if (eventProgress == 2)
{
- //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true);
+ //CAST_AI(EscortAI, me->AI())->SetCanDefend(true);
Talk(SAY_CAVERNS_PURIFIED);
instance->SetData(TYPE_NARALEX_PART2, DONE);
if (me->HasAura(SPELL_SERPENTINE_CLEANSING))
@@ -206,7 +206,7 @@ public:
{
++eventProgress;
eventTimer = 15000;
- //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
+ //CAST_AI(EscortAI, me->AI())->SetCanDefend(false);
if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX)))
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
Talk(EMOTE_AWAKENING_RITUAL);
diff --git a/src/server/scripts/Kalimdor/zone_ashenvale.cpp b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
index f5680664e27..964c8506113 100644
--- a/src/server/scripts/Kalimdor/zone_ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/zone_ashenvale.cpp
@@ -64,9 +64,9 @@ class npc_ruul_snowhoof : public CreatureScript
public:
npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
- struct npc_ruul_snowhoofAI : public npc_escortAI
+ struct npc_ruul_snowhoofAI : public EscortAI
{
- npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_ruul_snowhoofAI(Creature* creature) : EscortAI(creature) { }
void Reset() override
{
@@ -86,11 +86,11 @@ public:
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
{
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
- npc_escortAI::Start(true, false, player->GetGUID());
+ EscortAI::Start(true, false, player->GetGUID());
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -121,7 +121,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
@@ -181,9 +181,9 @@ class npc_muglash : public CreatureScript
public:
npc_muglash() : CreatureScript("npc_muglash") { }
- struct npc_muglashAI : public npc_escortAI
+ struct npc_muglashAI : public EscortAI
{
- npc_muglashAI(Creature* creature) : npc_escortAI(creature)
+ npc_muglashAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -229,11 +229,11 @@ public:
{
Talk(SAY_MUG_START1);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
- npc_escortAI::Start(true, false, player->GetGUID());
+ EscortAI::Start(true, false, player->GetGUID());
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
@@ -291,7 +291,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!me->GetVictim())
{
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index c4036fbe836..0565226a4cd 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -348,9 +348,9 @@ class npc_magwin : public CreatureScript
public:
npc_magwin() : CreatureScript("npc_magwin") { }
- struct npc_magwinAI : public npc_escortAI
+ struct npc_magwinAI : public EscortAI
{
- npc_magwinAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_magwinAI(Creature* creature) : EscortAI(creature) { }
void Reset() override
{
@@ -371,7 +371,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
@@ -410,7 +410,7 @@ public:
break;
case EVENT_START_ESCORT:
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
- npc_escortAI::Start(true, false, player->GetGUID());
+ EscortAI::Start(true, false, player->GetGUID());
_events.ScheduleEvent(EVENT_STAND, Seconds(2));
break;
case EVENT_STAND: // Remove kneel standstate. Using a separate delayed event because it causes unwanted delay before starting waypoint movement.
@@ -428,7 +428,7 @@ public:
}
}
- npc_escortAI::UpdateEscortAI(diff);
+ EscortAI::UpdateEscortAI(diff);
}
private:
diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
index 86eae7f4b40..3a92623ce15 100644
--- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp
@@ -355,9 +355,9 @@ class npc_demolitionist_legoso : public CreatureScript
public:
npc_demolitionist_legoso() : CreatureScript("npc_demolitionist_legoso") { }
- struct npc_demolitionist_legosoAI : public npc_escortAI
+ struct npc_demolitionist_legosoAI : public EscortAI
{
- npc_demolitionist_legosoAI(Creature* creature) : npc_escortAI(creature)
+ npc_demolitionist_legosoAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -466,7 +466,7 @@ public:
if (HasEscortState(STATE_ESCORT_NONE))
return;
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (_phase)
{
@@ -710,7 +710,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Kalimdor/zone_darkshore.cpp b/src/server/scripts/Kalimdor/zone_darkshore.cpp
index b2bdd76c137..8d07fd1e506 100644
--- a/src/server/scripts/Kalimdor/zone_darkshore.cpp
+++ b/src/server/scripts/Kalimdor/zone_darkshore.cpp
@@ -204,9 +204,9 @@ class npc_prospector_remtravel : public CreatureScript
public:
npc_prospector_remtravel() : CreatureScript("npc_prospector_remtravel") { }
- struct npc_prospector_remtravelAI : public npc_escortAI
+ struct npc_prospector_remtravelAI : public EscortAI
{
- npc_prospector_remtravelAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_prospector_remtravelAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
@@ -222,7 +222,7 @@ public:
//pSummoned->AI()->AttackStart(me);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp
index 4360574a65f..74786200a43 100644
--- a/src/server/scripts/Kalimdor/zone_desolace.cpp
+++ b/src/server/scripts/Kalimdor/zone_desolace.cpp
@@ -176,9 +176,9 @@ class npc_dalinda : public CreatureScript
public:
npc_dalinda() : CreatureScript("npc_dalinda") { }
- struct npc_dalindaAI : public npc_escortAI
+ struct npc_dalindaAI : public EscortAI
{
- npc_dalindaAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_dalindaAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
@@ -191,7 +191,7 @@ public:
return;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
@@ -209,7 +209,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/zone_feralas.cpp b/src/server/scripts/Kalimdor/zone_feralas.cpp
index 16c30f6fadd..0d0f75d4d4d 100644
--- a/src/server/scripts/Kalimdor/zone_feralas.cpp
+++ b/src/server/scripts/Kalimdor/zone_feralas.cpp
@@ -63,11 +63,11 @@ class npc_oox22fe : public CreatureScript
public:
npc_oox22fe() : CreatureScript("npc_oox22fe") { }
- struct npc_oox22feAI : public npc_escortAI
+ struct npc_oox22feAI : public EscortAI
{
- npc_oox22feAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_oox22feAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp
index e19d8797bc9..792fe737c8b 100644
--- a/src/server/scripts/Kalimdor/zone_moonglade.cpp
+++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp
@@ -111,10 +111,10 @@ public:
return new npc_clintar_spiritAI(creature);
}
- struct npc_clintar_spiritAI : public npc_escortAI
+ struct npc_clintar_spiritAI : public EscortAI
{
public:
- npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature)
+ npc_clintar_spiritAI(Creature* creature) : EscortAI(creature)
{
Initialize();
PlayerGUID.Clear();
@@ -189,7 +189,7 @@ public:
AttackStart(player->getAttackerForHelper());
return;
}
- npc_escortAI::EnterEvadeMode(why);
+ EscortAI::EnterEvadeMode(why);
}
void StartEvent(Player* player)
@@ -198,7 +198,7 @@ public:
{
for (uint8 i = 0; i < 41; ++i)
{
- AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]);
+ AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], Clintar_spirit_WP[i][3], (uint32)Clintar_spirit_WP[i][4]);
}
PlayerGUID = player->GetGUID();
Start(true, false, PlayerGUID);
@@ -210,7 +210,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!PlayerGUID)
{
@@ -370,7 +370,7 @@ public:
} else if (EventOnWait) EventTimer -= diff;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
CurrWP = waypointId;
EventTimer = 0;
diff --git a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp
index fa9164fced8..9095ac29830 100644
--- a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp
+++ b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp
@@ -46,11 +46,11 @@ class npc_kaya_flathoof : public CreatureScript
public:
npc_kaya_flathoof() : CreatureScript("npc_kaya_flathoof") { }
- struct npc_kaya_flathoofAI : public npc_escortAI
+ struct npc_kaya_flathoofAI : public EscortAI
{
- npc_kaya_flathoofAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_kaya_flathoofAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp
index b1e44a4ac55..c3803d06022 100644
--- a/src/server/scripts/Kalimdor/zone_tanaris.cpp
+++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp
@@ -195,11 +195,11 @@ public:
return new npc_custodian_of_timeAI(creature);
}
- struct npc_custodian_of_timeAI : public npc_escortAI
+ struct npc_custodian_of_timeAI : public EscortAI
{
- npc_custodian_of_timeAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_custodian_of_timeAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
@@ -290,7 +290,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
@@ -319,11 +319,11 @@ class npc_OOX17 : public CreatureScript
public:
npc_OOX17() : CreatureScript("npc_OOX17") { }
- struct npc_OOX17AI : public npc_escortAI
+ struct npc_OOX17AI : public EscortAI
{
- npc_OOX17AI(Creature* creature) : npc_escortAI(creature) { }
+ npc_OOX17AI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index 4e1c211ddde..2029ee3fbba 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -101,13 +101,13 @@ class npc_gilthares : public CreatureScript
public:
npc_gilthares() : CreatureScript("npc_gilthares") { }
- struct npc_giltharesAI : public npc_escortAI
+ struct npc_giltharesAI : public EscortAI
{
- npc_giltharesAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_giltharesAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -530,9 +530,9 @@ class npc_wizzlecrank_shredder : public CreatureScript
public:
npc_wizzlecrank_shredder() : CreatureScript("npc_wizzlecrank_shredder") { }
- struct npc_wizzlecrank_shredderAI : public npc_escortAI
+ struct npc_wizzlecrank_shredderAI : public EscortAI
{
- npc_wizzlecrank_shredderAI(Creature* creature) : npc_escortAI(creature)
+ npc_wizzlecrank_shredderAI(Creature* creature) : EscortAI(creature)
{
IsPostEvent = false;
PostEventTimer = 1000;
@@ -556,7 +556,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -579,7 +579,7 @@ public:
}
}
- void WaypointStart(uint32 PointId) override
+ void WaypointStarted(uint32 PointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
diff --git a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
index a1439f4cc00..7823e535bb2 100644
--- a/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/zone_thousand_needles.cpp
@@ -56,13 +56,13 @@ class npc_kanati : public CreatureScript
public:
npc_kanati() : CreatureScript("npc_kanati") { }
- struct npc_kanatiAI : public npc_escortAI
+ struct npc_kanatiAI : public EscortAI
{
- npc_kanatiAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_kanatiAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -136,13 +136,13 @@ class npc_lakota_windsong : public CreatureScript
public:
npc_lakota_windsong() : CreatureScript("npc_lakota_windsong") { }
- struct npc_lakota_windsongAI : public npc_escortAI
+ struct npc_lakota_windsongAI : public EscortAI
{
- npc_lakota_windsongAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_lakota_windsongAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -216,13 +216,13 @@ class npc_paoka_swiftmountain : public CreatureScript
public:
npc_paoka_swiftmountain() : CreatureScript("npc_paoka_swiftmountain") { }
- struct npc_paoka_swiftmountainAI : public npc_escortAI
+ struct npc_paoka_swiftmountainAI : public EscortAI
{
- npc_paoka_swiftmountainAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_paoka_swiftmountainAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
index 4a1456a18c0..f7f7c5cd1dd 100644
--- a/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
@@ -57,9 +57,9 @@ class npc_ame : public CreatureScript
public:
npc_ame() : CreatureScript("npc_ame") { }
- struct npc_ameAI : public npc_escortAI
+ struct npc_ameAI : public EscortAI
{
- npc_ameAI(Creature* creature) : npc_escortAI(creature)
+ npc_ameAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -71,7 +71,7 @@ public:
uint32 DemoralizingShoutTimer;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (Player* player = GetPlayerForEscort())
{
@@ -118,7 +118,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp
index 9bc3711e830..a2557bbdd43 100644
--- a/src/server/scripts/Kalimdor/zone_winterspring.cpp
+++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp
@@ -307,9 +307,9 @@ class npc_ranshalla : public CreatureScript
public:
npc_ranshalla() : CreatureScript("npc_ranshalla") { }
- struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
+ struct npc_ranshallaAI : public EscortAI, private DialogueHelper
{
- npc_ranshallaAI(Creature* creature) : npc_escortAI(creature), DialogueHelper(introDialogue)
+ npc_ranshallaAI(Creature* creature) : EscortAI(creature), DialogueHelper(introDialogue)
{
Initialize();
}
@@ -393,7 +393,7 @@ public:
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
}
- void WaypointReached(uint32 pointId) override
+ void WaypointReached(uint32 pointId, uint32 /*pathId*/) override
{
switch (pointId)
{
@@ -580,7 +580,7 @@ public:
if (events.ExecuteEvent() == EVENT_RESUME)
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
- npc_escortAI::UpdateEscortAI(diff);
+ EscortAI::UpdateEscortAI(diff);
}
void QuestAccept(Player* player, Quest const* quest) override
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index 1061dc37aff..3b997fe9516 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -505,9 +505,9 @@ public:
npc_argent_soldier() : CreatureScript("npc_argent_soldier") { }
// THIS AI NEEDS MORE IMPROVEMENTS
- struct npc_argent_soldierAI : public npc_escortAI
+ struct npc_argent_soldierAI : public EscortAI
{
- npc_argent_soldierAI(Creature* creature) : npc_escortAI(creature)
+ npc_argent_soldierAI(Creature* creature) : EscortAI(creature)
{
instance = creature->GetInstanceScript();
me->SetReactState(REACT_DEFENSIVE);
@@ -519,7 +519,7 @@ public:
uint8 uiWaypoint;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == 0)
{
@@ -592,7 +592,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
index be1c5b69bd8..c64222cc61c 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -354,18 +354,16 @@ class npc_black_knight_skeletal_gryphon : public CreatureScript
public:
npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") { }
- struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI
+ struct npc_black_knight_skeletal_gryphonAI : public EscortAI
{
- npc_black_knight_skeletal_gryphonAI(Creature* creature) : npc_escortAI(creature)
+ npc_black_knight_skeletal_gryphonAI(Creature* creature) : EscortAI(creature)
{
Start(false, true);
}
- void WaypointReached(uint32 /*waypointId*/) override { }
-
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
UpdateVictim();
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
index e0d59e6b4d5..ac7bb108a54 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -152,9 +152,9 @@ class generic_vehicleAI_toc5 : public CreatureScript
public:
generic_vehicleAI_toc5() : CreatureScript("generic_vehicleAI_toc5") { }
- struct generic_vehicleAI_toc5AI : public npc_escortAI
+ struct generic_vehicleAI_toc5AI : public EscortAI
{
- generic_vehicleAI_toc5AI(Creature* creature) : npc_escortAI(creature)
+ generic_vehicleAI_toc5AI(Creature* creature) : EscortAI(creature)
{
Initialize();
SetDespawnAtEnd(false);
@@ -212,7 +212,7 @@ public:
Start(false, true);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -239,7 +239,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 90d764cd9db..59a95ae0b9c 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -955,9 +955,9 @@ class npc_crok_scourgebane : public CreatureScript
public:
npc_crok_scourgebane() : CreatureScript("npc_crok_scourgebane") { }
- struct npc_crok_scourgebaneAI : public npc_escortAI
+ struct npc_crok_scourgebaneAI : public EscortAI
{
- npc_crok_scourgebaneAI(Creature* creature) : npc_escortAI(creature),
+ npc_crok_scourgebaneAI(Creature* creature) : EscortAI(creature),
_instance(creature->GetInstanceScript()), _respawnTime(creature->GetRespawnDelay()),
_corpseDelay(creature->GetCorpseDelay())
{
@@ -1036,7 +1036,7 @@ class npc_crok_scourgebane : public CreatureScript
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -1067,7 +1067,7 @@ class npc_crok_scourgebane : public CreatureScript
}
}
- void WaypointStart(uint32 waypointId) override
+ void WaypointStarted(uint32 waypointId, uint32 /*pathId*/) override
{
_currentWPid = waypointId;
switch (waypointId)
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
index fc54e6fec54..80d59691fb5 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -271,9 +271,9 @@ class npc_brann_hos : public CreatureScript
public:
npc_brann_hos() : CreatureScript("npc_brann_hos") { }
- struct npc_brann_hosAI : public npc_escortAI
+ struct npc_brann_hosAI : public EscortAI
{
- npc_brann_hosAI(Creature* creature) : npc_escortAI(creature)
+ npc_brann_hosAI(Creature* creature) : EscortAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
@@ -326,7 +326,7 @@ public:
lDwarfGUIDList.clear();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index dac2a8707d9..3925fd3b042 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -973,9 +973,9 @@ class npc_mimirons_inferno : public CreatureScript
public:
npc_mimirons_inferno() : CreatureScript("npc_mimirons_inferno") { }
- struct npc_mimirons_infernoAI : public npc_escortAI
+ struct npc_mimirons_infernoAI : public EscortAI
{
- npc_mimirons_infernoAI(Creature* creature) : npc_escortAI(creature)
+ npc_mimirons_infernoAI(Creature* creature) : EscortAI(creature)
{
Initialize();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
@@ -988,11 +988,6 @@ public:
infernoTimer = 2000;
}
- void WaypointReached(uint32 /*waypointId*/) override
- {
-
- }
-
void Reset() override
{
Initialize();
@@ -1002,7 +997,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!HasEscortState(STATE_ESCORT_ESCORTING))
Start(false, true, ObjectGuid::Empty, nullptr, false, true);
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index e06087a738b..3675973c6e9 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -820,9 +820,9 @@ class npc_violet_hold_teleportation_portal_intro : public CreatureScript
}
};
-struct violet_hold_trashAI : public npc_escortAI
+struct violet_hold_trashAI : public EscortAI
{
- violet_hold_trashAI(Creature* creature) : npc_escortAI(creature)
+ violet_hold_trashAI(Creature* creature) : EscortAI(creature)
{
_instance = creature->GetInstanceScript();
@@ -898,7 +898,7 @@ struct violet_hold_trashAI : public npc_escortAI
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId == _lastWaypointId)
CreatureStartAttackDoor();
@@ -906,7 +906,7 @@ struct violet_hold_trashAI : public npc_escortAI
void EnterCombat(Unit* who) override
{
- npc_escortAI::EnterCombat(who);
+ EscortAI::EnterCombat(who);
ScheduledTasks();
}
@@ -919,7 +919,7 @@ struct violet_hold_trashAI : public npc_escortAI
return;
_scheduler.Update(diff,
- std::bind(&npc_escortAI::DoMeleeAttackIfReady, this));
+ std::bind(&EscortAI::DoMeleeAttackIfReady, this));
}
virtual void ScheduledTasks() { }
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp
index fccc0a8f437..fd898a61d41 100644
--- a/src/server/scripts/Northrend/zone_borean_tundra.cpp
+++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp
@@ -571,9 +571,9 @@ class npc_lurgglbr : public CreatureScript
public:
npc_lurgglbr() : CreatureScript("npc_lurgglbr") { }
- struct npc_lurgglbrAI : public npc_escortAI
+ struct npc_lurgglbrAI : public EscortAI
{
- npc_lurgglbrAI(Creature* creature) : npc_escortAI(creature)
+ npc_lurgglbrAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -593,7 +593,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -659,7 +659,7 @@ public:
}
} else IntroTimer -= diff;
}
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
@@ -794,9 +794,9 @@ class npc_thassarian : public CreatureScript
public:
npc_thassarian() : CreatureScript("npc_thassarian") { }
- struct npc_thassarianAI : public npc_escortAI
+ struct npc_thassarianAI : public EscortAI
{
- npc_thassarianAI(Creature* creature) : npc_escortAI(creature)
+ npc_thassarianAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -838,7 +838,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -873,7 +873,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (arthasInPosition && talbotInPosition)
{
@@ -1638,9 +1638,9 @@ class npc_mootoo_the_younger : public CreatureScript
public:
npc_mootoo_the_younger() : CreatureScript("npc_mootoo_the_younger") { }
- struct npc_mootoo_the_youngerAI : public npc_escortAI
+ struct npc_mootoo_the_youngerAI : public EscortAI
{
- npc_mootoo_the_youngerAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_mootoo_the_youngerAI(Creature* creature) : EscortAI(creature) { }
void Reset() override
{
@@ -1653,7 +1653,7 @@ public:
player->FailQuest(QUEST_ESCAPING_THE_MIST);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -1727,9 +1727,9 @@ class npc_bonker_togglevolt : public CreatureScript
public:
npc_bonker_togglevolt() : CreatureScript("npc_bonker_togglevolt") { }
- struct npc_bonker_togglevoltAI : public npc_escortAI
+ struct npc_bonker_togglevoltAI : public EscortAI
{
- npc_bonker_togglevoltAI(Creature* creature) : npc_escortAI(creature)
+ npc_bonker_togglevoltAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -1767,7 +1767,7 @@ public:
else Bonker_agro=0;
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index f4749ef74f4..de646c0c6a0 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -64,9 +64,9 @@ class npc_emily : public CreatureScript
public:
npc_emily() : CreatureScript("npc_emily") { }
- struct npc_emilyAI : public npc_escortAI
+ struct npc_emilyAI : public EscortAI
{
- npc_emilyAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_emilyAI(Creature* creature) : EscortAI(creature) { }
void JustSummoned(Creature* summoned) override
{
@@ -76,7 +76,7 @@ public:
summoned->AI()->AttackStart(me->GetVictim());
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp
index aeb2fa3e59a..e2df8f6ca96 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -80,9 +80,9 @@ class npc_apothecary_hanes : public CreatureScript
public:
npc_apothecary_hanes() : CreatureScript("npc_apothecary_hanes") { }
- struct npc_Apothecary_HanesAI : public npc_escortAI
+ struct npc_Apothecary_HanesAI : public EscortAI
{
- npc_Apothecary_HanesAI(Creature* creature) : npc_escortAI(creature)
+ npc_Apothecary_HanesAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -133,7 +133,7 @@ public:
if (GetAttack() && UpdateVictim())
DoMeleeAttackIfReady();
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (me->IsInCombat())
return;
@@ -156,7 +156,7 @@ public:
events.Reset();
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
me->SetReactState(REACT_AGGRESSIVE);
- ENSURE_AI(npc_escortAI, (me->AI()))->Start(true, true, _player);
+ ENSURE_AI(EscortAI, (me->AI()))->Start(true, true, _player);
break;
case EVENT_TALK_1:
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
@@ -202,7 +202,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -272,9 +272,9 @@ class npc_plaguehound_tracker : public CreatureScript
public:
npc_plaguehound_tracker() : CreatureScript("npc_plaguehound_tracker") { }
- struct npc_plaguehound_trackerAI : public npc_escortAI
+ struct npc_plaguehound_trackerAI : public EscortAI
{
- npc_plaguehound_trackerAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_plaguehound_trackerAI(Creature* creature) : EscortAI(creature) { }
void Reset() override
{
@@ -292,7 +292,7 @@ public:
Start(false, false, summonerGUID);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
if (waypointId != 26)
return;
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index 118aae0da83..11e50e3003c 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -253,9 +253,9 @@ class npc_engineer_helice : public CreatureScript
public:
npc_engineer_helice() : CreatureScript("npc_engineer_helice") { }
- struct npc_engineer_heliceAI : public npc_escortAI
+ struct npc_engineer_heliceAI : public EscortAI
{
- npc_engineer_heliceAI(Creature* creature) : npc_escortAI(creature)
+ npc_engineer_heliceAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -267,7 +267,7 @@ public:
uint32 m_uiChatTimer;
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
@@ -322,7 +322,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp
index cf1f22a94a9..c0c22a43696 100644
--- a/src/server/scripts/Northrend/zone_storm_peaks.cpp
+++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp
@@ -48,11 +48,11 @@ class npc_injured_goblin : public CreatureScript
public:
npc_injured_goblin() : CreatureScript("npc_injured_goblin") { }
- struct npc_injured_goblinAI : public npc_escortAI
+ struct npc_injured_goblinAI : public EscortAI
{
- npc_injured_goblinAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_injured_goblinAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -82,7 +82,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
@@ -346,9 +346,9 @@ class npc_icefang : public CreatureScript
public:
npc_icefang() : CreatureScript("npc_icefang") { }
- struct npc_icefangAI : public npc_escortAI
+ struct npc_icefangAI : public EscortAI
{
- npc_icefangAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_icefangAI(Creature* creature) : EscortAI(creature) { }
void AttackStart(Unit* /*who*/) override { }
void EnterCombat(Unit* /*who*/) override { }
@@ -363,13 +363,12 @@ public:
}
}
- void WaypointReached(uint32 /*waypointId*/) override { }
void JustDied(Unit* /*killer*/) override { }
void OnCharmed(bool /*apply*/) override { }
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
index c12dd178729..945edfe3772 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -57,9 +57,9 @@ class boss_ambassador_hellmaw : public CreatureScript
public:
boss_ambassador_hellmaw() : CreatureScript("boss_ambassador_hellmaw") { }
- struct boss_ambassador_hellmawAI : public npc_escortAI
+ struct boss_ambassador_hellmawAI : public EscortAI
{
- boss_ambassador_hellmawAI(Creature* creature) : npc_escortAI(creature)
+ boss_ambassador_hellmawAI(Creature* creature) : EscortAI(creature)
{
_instance = creature->GetInstanceScript();
_intro = false;
@@ -86,11 +86,7 @@ class boss_ambassador_hellmaw : public CreatureScript
if (me->HasAura(SPELL_BANISH))
return;
- npc_escortAI::MoveInLineOfSight(who);
- }
-
- void WaypointReached(uint32 /*waypointId*/) override
- {
+ EscortAI::MoveInLineOfSight(who);
}
void DoAction(int32 actionId) override
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 0660d781e57..c56208d77af 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -150,9 +150,9 @@ class npc_ancestral_wolf : public CreatureScript
public:
npc_ancestral_wolf() : CreatureScript("npc_ancestral_wolf") { }
- struct npc_ancestral_wolfAI : public npc_escortAI
+ struct npc_ancestral_wolfAI : public EscortAI
{
- npc_ancestral_wolfAI(Creature* creature) : npc_escortAI(creature)
+ npc_ancestral_wolfAI(Creature* creature) : EscortAI(creature)
{
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
Start(false, false, creature->GetOwner()->GetGUID());
@@ -170,11 +170,11 @@ public:
// Override Evade Mode event, recast buff that was removed by standard handler
void EnterEvadeMode(EvadeReason why) override
{
- npc_escortAI::EnterEvadeMode(why);
+ EscortAI::EnterEvadeMode(why);
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -258,9 +258,9 @@ class npc_wounded_blood_elf : public CreatureScript
public:
npc_wounded_blood_elf() : CreatureScript("npc_wounded_blood_elf") { }
- struct npc_wounded_blood_elfAI : public npc_escortAI
+ struct npc_wounded_blood_elfAI : public EscortAI
{
- npc_wounded_blood_elfAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_wounded_blood_elfAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
@@ -280,11 +280,11 @@ public:
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
- npc_escortAI::Start(true, false, player->GetGUID());
+ EscortAI::Start(true, false, player->GetGUID());
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index ce71c80e5f0..d19e77a6d0f 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -73,9 +73,9 @@ class npc_maghar_captive : public CreatureScript
public:
npc_maghar_captive() : CreatureScript("npc_maghar_captive") { }
- struct npc_maghar_captiveAI : public npc_escortAI
+ struct npc_maghar_captiveAI : public EscortAI
{
- npc_maghar_captiveAI(Creature* creature) : npc_escortAI(creature) { Reset(); }
+ npc_maghar_captiveAI(Creature* creature) : EscortAI(creature) { Reset(); }
uint32 ChainLightningTimer;
uint32 HealTimer;
@@ -105,7 +105,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -157,7 +157,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
@@ -434,9 +434,9 @@ class npc_kurenai_captive : public CreatureScript
public:
npc_kurenai_captive() : CreatureScript("npc_kurenai_captive") { }
- struct npc_kurenai_captiveAI : public npc_escortAI
+ struct npc_kurenai_captiveAI : public EscortAI
{
- npc_kurenai_captiveAI(Creature* creature) : npc_escortAI(creature)
+ npc_kurenai_captiveAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -474,7 +474,7 @@ public:
}
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
switch (waypointId)
{
@@ -538,7 +538,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index 6fcf5c37004..7857b452f98 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -488,9 +488,9 @@ class npc_bessy : public CreatureScript
public:
npc_bessy() : CreatureScript("npc_bessy") { }
- struct npc_bessyAI : public npc_escortAI
+ struct npc_bessyAI : public EscortAI
{
- npc_bessyAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_bessyAI(Creature* creature) : EscortAI(creature) { }
void JustDied(Unit* /*killer*/) override
{
@@ -498,7 +498,7 @@ public:
player->FailQuest(Q_ALMABTRIEB);
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -569,9 +569,9 @@ class npc_maxx_a_million_escort : public CreatureScript
public:
npc_maxx_a_million_escort() : CreatureScript("npc_maxx_a_million_escort") { }
- struct npc_maxx_a_million_escortAI : public npc_escortAI
+ struct npc_maxx_a_million_escortAI : public EscortAI
{
- npc_maxx_a_million_escortAI(Creature* creature) : npc_escortAI(creature)
+ npc_maxx_a_million_escortAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -590,7 +590,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -624,7 +624,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (bTake)
{
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 65eaefa2d7b..1b0ccbf094f 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -592,9 +592,9 @@ class npc_earthmender_wilda : public CreatureScript
public:
npc_earthmender_wilda() : CreatureScript("npc_earthmender_wilda") { }
- struct npc_earthmender_wildaAI : public npc_escortAI
+ struct npc_earthmender_wildaAI : public EscortAI
{
- npc_earthmender_wildaAI(Creature* creature) : npc_escortAI(creature)
+ npc_earthmender_wildaAI(Creature* creature) : EscortAI(creature)
{
Initialize();
}
@@ -611,7 +611,7 @@ public:
Initialize();
}
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -704,7 +704,7 @@ public:
void UpdateAI(uint32 uiDiff) override
{
- npc_escortAI::UpdateAI(uiDiff);
+ EscortAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp
index 87143a32e7b..1ac09a0bfc9 100644
--- a/src/server/scripts/Outland/zone_shattrath_city.cpp
+++ b/src/server/scripts/Outland/zone_shattrath_city.cpp
@@ -399,12 +399,12 @@ public:
return new npc_kservantAI(creature);
}
- struct npc_kservantAI : public npc_escortAI
+ struct npc_kservantAI : public EscortAI
{
public:
- npc_kservantAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_kservantAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index 758db799ea4..ba39e16e4d7 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -221,12 +221,12 @@ public:
return new npc_skywingAI(creature);
}
- struct npc_skywingAI : public npc_escortAI
+ struct npc_skywingAI : public EscortAI
{
public:
- npc_skywingAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_skywingAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -258,7 +258,7 @@ public:
void UpdateAI(uint32 diff) override
{
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};
};
@@ -437,11 +437,11 @@ class npc_isla_starmane : public CreatureScript
public:
npc_isla_starmane() : CreatureScript("npc_isla_starmane") { }
- struct npc_isla_starmaneAI : public npc_escortAI
+ struct npc_isla_starmaneAI : public EscortAI
{
- npc_isla_starmaneAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_isla_starmaneAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
@@ -656,11 +656,11 @@ class npc_akuno : public CreatureScript
public:
npc_akuno() : CreatureScript("npc_akuno") { }
- struct npc_akunoAI : public npc_escortAI
+ struct npc_akunoAI : public EscortAI
{
- npc_akunoAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_akunoAI(Creature* creature) : EscortAI(creature) { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index fabf7290129..f111d92df4b 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -330,13 +330,13 @@ class npc_kayra_longmane : public CreatureScript
public:
npc_kayra_longmane() : CreatureScript("npc_kayra_longmane") { }
- struct npc_kayra_longmaneAI : public npc_escortAI
+ struct npc_kayra_longmaneAI : public EscortAI
{
- npc_kayra_longmaneAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_kayra_longmaneAI(Creature* creature) : EscortAI(creature) { }
void Reset() override { }
- void WaypointReached(uint32 waypointId) override
+ void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index dd8e313e54d..4ca666a55bb 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1040,9 +1040,9 @@ class npc_garments_of_quests : public CreatureScript
public:
npc_garments_of_quests() : CreatureScript("npc_garments_of_quests") { }
- struct npc_garments_of_questsAI : public npc_escortAI
+ struct npc_garments_of_questsAI : public EscortAI
{
- npc_garments_of_questsAI(Creature* creature) : npc_escortAI(creature)
+ npc_garments_of_questsAI(Creature* creature) : EscortAI(creature)
{
switch (me->GetEntry())
{
@@ -1130,11 +1130,6 @@ public:
}
}
- void WaypointReached(uint32 /*waypointId*/) override
- {
-
- }
-
void UpdateAI(uint32 diff) override
{
if (CanRun && !me->IsInCombat())
@@ -1165,7 +1160,7 @@ public:
RunAwayTimer -= diff;
}
- npc_escortAI::UpdateAI(diff);
+ EscortAI::UpdateAI(diff);
}
};