Core/Movement: merged smooth waypoint movement. Followup commits will be merged soon (tm)
This commit is contained in:
1 parent
d59a20701e
commit
c808b981f7
88 files changed
+1301
-1396
No files matched your search
@@ -308,6 +308,9 @@ class TC_GAME_API UnitAI
|
|||||||
// Called when the dialog status between a player and the creature is requested.
|
// Called when the dialog status between a player and the creature is requested.
|
||||||
virtual uint32 GetDialogStatus(Player* /*player*/);
|
virtual uint32 GetDialogStatus(Player* /*player*/);
|
||||||
|
|
||||||
|
virtual void WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { }
|
||||||
|
virtual void WaypointReached(uint32 /*nodeId*/, uint32 /*pathId*/) { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UnitAI(UnitAI const& right) = delete;
|
UnitAI(UnitAI const& right) = delete;
|
||||||
UnitAI& operator=(UnitAI const& right) = delete;
|
UnitAI& operator=(UnitAI const& right) = delete;
|
||||||
|
|||||||
@@ -16,21 +16,16 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 "ScriptedEscortAI.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "MotionMaster.h"
|
#include "MotionMaster.h"
|
||||||
|
#include "MovementGenerator.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "ScriptSystem.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
enum Points
|
enum Points
|
||||||
@@ -39,119 +34,62 @@ enum Points
|
|||||||
POINT_HOME = 0xFFFFFE
|
POINT_HOME = 0xFFFFFE
|
||||||
};
|
};
|
||||||
|
|
||||||
npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
|
EscortAI::EscortAI(Creature* creature) : ScriptedAI(creature), _pauseTimer(2500), _playerCheckTimer(1000), _escortState(STATE_ESCORT_NONE), _maxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE),
|
||||||
m_uiWPWaitTimer(2500),
|
_escortQuest(nullptr), _activeAttacker(true), _running(false), _instantRespawn(false), _returnToStart(false), _despawnAtEnd(true), _despawnAtFar(true), _manualPath(false),
|
||||||
m_uiPlayerCheckTimer(1000),
|
_hasImmuneToNPCFlags(false), _started(false), _ended(false), _resume(false)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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
|
// see followerAI
|
||||||
bool npc_escortAI::AssistPlayerInCombatAgainst(Unit* who)
|
bool EscortAI::AssistPlayerInCombatAgainst(Unit* who)
|
||||||
{
|
{
|
||||||
if (!who || !who->GetVictim())
|
if (!who || !who->GetVictim())
|
||||||
return false;
|
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))
|
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//not a player
|
// not a player
|
||||||
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//never attack friendly
|
// never attack friendly
|
||||||
if (me->IsFriendlyTo(who))
|
if (!me->IsValidAssistTarget(who->GetVictim()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//too far away and no free sight?
|
// too far away and no free sight?
|
||||||
if (me->IsWithinDistInMap(who, GetMaxPlayerDistance()) && me->IsWithinLOSInMap(who))
|
if (me->IsWithinDistInMap(who, GetMaxPlayerDistance()) && me->IsWithinLOSInMap(who))
|
||||||
{
|
{
|
||||||
//already fighting someone?
|
AttackStart(who);
|
||||||
if (!me->GetVictim())
|
return true;
|
||||||
{
|
|
||||||
AttackStart(who);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
who->SetInCombatWith(me);
|
|
||||||
me->AddThreat(who, 0.0f);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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 (!who)
|
||||||
{
|
return;
|
||||||
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (me->IsHostileTo(who))
|
ScriptedAI::MoveInLineOfSight(who);
|
||||||
{
|
|
||||||
float fAttackRadius = me->GetAttackDistance(who);
|
|
||||||
if (me->IsWithinDistInMap(who, fAttackRadius) && me->IsWithinLOSInMap(who))
|
|
||||||
{
|
|
||||||
if (!me->GetVictim())
|
|
||||||
{
|
|
||||||
// Clear distracted state on combat
|
|
||||||
if (me->HasUnitState(UNIT_STATE_DISTRACTED))
|
|
||||||
{
|
|
||||||
me->ClearUnitState(UNIT_STATE_DISTRACTED);
|
|
||||||
me->GetMotionMaster()->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
AttackStart(who);
|
|
||||||
}
|
|
||||||
else if (me->GetMap()->IsDungeon())
|
|
||||||
{
|
|
||||||
who->SetInCombatWith(me);
|
|
||||||
me->AddThreat(who, 0.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
return;
|
||||||
|
|
||||||
if (Player* player = GetPlayerForEscort())
|
if (Player* player = GetPlayerForEscort())
|
||||||
@@ -159,24 +97,26 @@ void npc_escortAI::JustDied(Unit* /*killer*/)
|
|||||||
if (Group* group = player->GetGroup())
|
if (Group* group = player->GetGroup())
|
||||||
{
|
{
|
||||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||||
|
{
|
||||||
if (Player* member = groupRef->GetSource())
|
if (Player* member = groupRef->GetSource())
|
||||||
if (member->IsInMap(player))
|
if (member->IsInMap(player))
|
||||||
member->FailQuest(m_pQuestForEscort->GetQuestId());
|
member->FailQuest(_escortQuest->GetQuestId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
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())
|
if (!IsCombatMovementAllowed())
|
||||||
SetCombatMovement(true);
|
SetCombatMovement(true);
|
||||||
|
|
||||||
//add a small delay before going to first waypoint, normal in near all cases
|
// add a small delay before going to first waypoint, normal in near all cases
|
||||||
m_uiWPWaitTimer = 2500;
|
_pauseTimer = 2000;
|
||||||
|
|
||||||
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
|
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
|
||||||
me->RestoreFaction();
|
me->RestoreFaction();
|
||||||
@@ -184,14 +124,12 @@ void npc_escortAI::JustAppeared()
|
|||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::ReturnToLastPoint()
|
void EscortAI::ReturnToLastPoint()
|
||||||
{
|
{
|
||||||
float x, y, z, o;
|
me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, me->GetHomePosition());
|
||||||
me->GetHomePosition(x, y, z, o);
|
|
||||||
me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
|
void EscortAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||||
{
|
{
|
||||||
me->RemoveAllAuras();
|
me->RemoveAllAuras();
|
||||||
me->DeleteThreatList();
|
me->DeleteThreatList();
|
||||||
@@ -202,27 +140,29 @@ void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
|
|||||||
{
|
{
|
||||||
AddEscortState(STATE_ESCORT_RETURNING);
|
AddEscortState(STATE_ESCORT_RETURNING);
|
||||||
ReturnToLastPoint();
|
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
|
else
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MoveTargetedHome();
|
me->GetMotionMaster()->MoveTargetedHome();
|
||||||
if (HasImmuneToNPCFlags)
|
if (_hasImmuneToNPCFlags)
|
||||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool npc_escortAI::IsPlayerOrGroupInRange()
|
bool EscortAI::IsPlayerOrGroupInRange()
|
||||||
{
|
{
|
||||||
if (Player* player = GetPlayerForEscort())
|
if (Player* player = GetPlayerForEscort())
|
||||||
{
|
{
|
||||||
if (Group* group = player->GetGroup())
|
if (Group* group = player->GetGroup())
|
||||||
{
|
{
|
||||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||||
|
{
|
||||||
if (Player* member = groupRef->GetSource())
|
if (Player* member = groupRef->GetSource())
|
||||||
if (me->IsWithinDistInMap(member, GetMaxPlayerDistance()))
|
if (me->IsWithinDistInMap(member, GetMaxPlayerDistance()))
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance()))
|
else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance()))
|
||||||
return true;
|
return true;
|
||||||
@@ -231,88 +171,77 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::UpdateAI(uint32 diff)
|
void EscortAI::UpdateAI(uint32 diff)
|
||||||
{
|
{
|
||||||
//Waypoint Updating
|
// Waypoint Updating
|
||||||
if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->GetVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
|
if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->IsInCombat() && !HasEscortState(STATE_ESCORT_RETURNING))
|
||||||
{
|
{
|
||||||
if (m_uiWPWaitTimer <= diff)
|
if (_pauseTimer <= diff)
|
||||||
{
|
{
|
||||||
//End of the line
|
|
||||||
if (CurrentWP == WaypointList.end())
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
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 (m_bCanInstantRespawn && !sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC))
|
|
||||||
{
|
|
||||||
me->setDeathState(JUST_DIED);
|
|
||||||
me->Respawn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC))
|
|
||||||
me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
|
|
||||||
me->DespawnOrUnsummon();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints with Despawn off");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!HasEscortState(STATE_ESCORT_PAUSED))
|
if (!HasEscortState(STATE_ESCORT_PAUSED))
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
|
_pauseTimer = 0;
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
|
|
||||||
|
|
||||||
WaypointStart(CurrentWP->id);
|
if (_ended)
|
||||||
|
{
|
||||||
|
_ended = false;
|
||||||
|
me->GetMotionMaster()->MoveIdle();
|
||||||
|
|
||||||
m_uiWPWaitTimer = 0;
|
if (_despawnAtEnd)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_uiWPWaitTimer -= diff;
|
_pauseTimer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if player or any member of his group is within range
|
// 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))
|
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;
|
bool isEscort = false;
|
||||||
if (CreatureData const* cdata = me->GetCreatureData())
|
if (CreatureData const* creatureData = me->GetCreatureData())
|
||||||
isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (cdata->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
|
isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && (creatureData->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC));
|
||||||
|
|
||||||
if (m_bCanInstantRespawn && !isEscort)
|
if (_instantRespawn && !isEscort)
|
||||||
{
|
me->DespawnOrUnsummon(0, Seconds(1));
|
||||||
me->setDeathState(JUST_DIED);
|
else if (_instantRespawn && isEscort)
|
||||||
me->Respawn();
|
|
||||||
}
|
|
||||||
else if (m_bCanInstantRespawn && isEscort)
|
|
||||||
me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
|
me->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, me->GetSpawnId(), true);
|
||||||
else
|
else
|
||||||
me->DespawnOrUnsummon();
|
me->DespawnOrUnsummon();
|
||||||
@@ -320,16 +249,16 @@ void npc_escortAI::UpdateAI(uint32 diff)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_uiPlayerCheckTimer = 1000;
|
_playerCheckTimer = 1000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_uiPlayerCheckTimer -= diff;
|
_playerCheckTimer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateEscortAI(diff);
|
UpdateEscortAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::UpdateEscortAI(uint32 /*diff*/)
|
void EscortAI::UpdateEscortAI(uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -337,122 +266,103 @@ void npc_escortAI::UpdateEscortAI(uint32 /*diff*/)
|
|||||||
DoMeleeAttackIfReady();
|
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;
|
return;
|
||||||
|
|
||||||
//Combat start position reached, continue waypoint movement
|
if (type == POINT_MOTION_TYPE)
|
||||||
if (pointId == POINT_LAST_POINT)
|
|
||||||
{
|
{
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI has returned to original position before combat");
|
if (!_pauseTimer)
|
||||||
|
_pauseTimer = 2000;
|
||||||
|
|
||||||
me->SetWalk(!m_bIsRunning);
|
// continue waypoint movement
|
||||||
RemoveEscortState(STATE_ESCORT_RETURNING);
|
if (id == POINT_LAST_POINT)
|
||||||
|
|
||||||
if (!m_uiWPWaitTimer)
|
|
||||||
m_uiWPWaitTimer = 1;
|
|
||||||
}
|
|
||||||
else if (pointId == POINT_HOME)
|
|
||||||
{
|
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
|
|
||||||
|
|
||||||
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_ERROR("misc", "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
|
TC_LOG_DEBUG("scripts", "EscortAI::MovementInform: returned to before combat position");
|
||||||
|
me->SetWalk(!_running);
|
||||||
return;
|
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 (type == WAYPOINT_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI Waypoint %u reached", CurrentWP->id);
|
TC_LOG_DEBUG("scripts", "EscortAI::MovementInform: waypoint node %u reached", waypoint.id);
|
||||||
|
|
||||||
//Call WP function
|
// last point
|
||||||
WaypointReached(CurrentWP->id);
|
if (id == _path.nodes.size() - 1)
|
||||||
|
{
|
||||||
m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;
|
_started = false;
|
||||||
|
_ended = true;
|
||||||
++CurrentWP;
|
_pauseTimer = 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///@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);
|
Trinity::NormalizeMapCoord(x);
|
||||||
|
Trinity::NormalizeMapCoord(y);
|
||||||
|
|
||||||
WaypointList.push_back(t);
|
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));
|
||||||
|
|
||||||
// i think SD2 no longer uses this function
|
_manualPath = true;
|
||||||
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);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::FillPointMovementListForCreature()
|
void EscortAI::FillPointMovementListForCreature()
|
||||||
{
|
{
|
||||||
ScriptPointVector const* movePoints = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
|
WaypointPath const* path = sScriptSystemMgr->GetPath(me->GetEntry());
|
||||||
if (!movePoints)
|
if (!path)
|
||||||
return;
|
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);
|
WaypointNode node = value;
|
||||||
WaypointList.push_back(point);
|
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 (on && !_running)
|
||||||
{
|
me->SetWalk(false);
|
||||||
if (!m_bIsRunning)
|
else if (!on && _running)
|
||||||
me->SetWalk(false);
|
me->SetWalk(true);
|
||||||
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.");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bIsRunning = on;
|
_running = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo get rid of this many variables passed in function.
|
/// @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
|
// Queue respawn from the point it starts
|
||||||
if (Map* map = me->GetMap())
|
if (Map* map = me->GetMap())
|
||||||
@@ -472,151 +382,76 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
|
|||||||
|
|
||||||
if (me->GetVictim())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
|
if (!_manualPath && resetWaypoints)
|
||||||
{
|
|
||||||
if (!WaypointList.empty())
|
|
||||||
WaypointList.clear();
|
|
||||||
FillPointMovementListForCreature();
|
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).",
|
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);
|
||||||
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set variables
|
// set variables
|
||||||
m_bIsActiveAttacker = isActiveAttacker;
|
_activeAttacker = isActiveAttacker;
|
||||||
m_bIsRunning = run;
|
_running = run;
|
||||||
|
_playerGUID = playerGUID;
|
||||||
|
_escortQuest = quest;
|
||||||
|
_instantRespawn = instantRespawn;
|
||||||
|
_returnToStart = canLoopPath;
|
||||||
|
|
||||||
m_uiPlayerGUID = playerGUID;
|
if (_returnToStart && _instantRespawn)
|
||||||
m_pQuestForEscort = quest;
|
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());
|
||||||
|
|
||||||
m_bCanInstantRespawn = instantRespawn;
|
me->GetMotionMaster()->MoveIdle();
|
||||||
m_bCanReturnToStart = canLoopPath;
|
me->GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
|
||||||
|
|
||||||
if (m_bCanReturnToStart && m_bCanInstantRespawn)
|
// disable npcflags
|
||||||
TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
|
|
||||||
|
|
||||||
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
|
|
||||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|
||||||
{
|
{
|
||||||
HasImmuneToNPCFlags = true;
|
_hasImmuneToNPCFlags = true;
|
||||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
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());
|
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());
|
||||||
|
|
||||||
CurrentWP = WaypointList.begin();
|
// set initial speed
|
||||||
|
me->SetWalk(!_running);
|
||||||
|
|
||||||
//Set initial speed
|
_started = false;
|
||||||
if (m_bIsRunning)
|
|
||||||
me->SetWalk(false);
|
|
||||||
else
|
|
||||||
me->SetWalk(true);
|
|
||||||
|
|
||||||
AddEscortState(STATE_ESCORT_ESCORTING);
|
AddEscortState(STATE_ESCORT_ESCORTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void npc_escortAI::SetEscortPaused(bool on)
|
void EscortAI::SetEscortPaused(bool on)
|
||||||
{
|
{
|
||||||
if (!HasEscortState(STATE_ESCORT_ESCORTING))
|
if (!HasEscortState(STATE_ESCORT_ESCORTING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
|
{
|
||||||
AddEscortState(STATE_ESCORT_PAUSED);
|
AddEscortState(STATE_ESCORT_PAUSED);
|
||||||
|
if (MovementGenerator* movementGenerator = me->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
|
||||||
|
movementGenerator->Pause(0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RemoveEscortState(STATE_ESCORT_PAUSED);
|
RemoveEscortState(STATE_ESCORT_PAUSED);
|
||||||
|
_resume = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool npc_escortAI::SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation)
|
bool EscortAI::IsEscortNPC(bool onlyIfActive) const
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (itr->uiPointId == pointId)
|
|
||||||
{
|
|
||||||
x = itr->fX;
|
|
||||||
y = itr->fY;
|
|
||||||
z = itr->fZ;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool npc_escortAI::IsEscortNPC(bool onlyIfActive) const
|
|
||||||
{
|
{
|
||||||
if (!onlyIfActive)
|
if (!onlyIfActive)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -20,93 +20,59 @@
|
|||||||
#define SC_ESCORTAI_H
|
#define SC_ESCORTAI_H
|
||||||
|
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
#include "ScriptSystem.h"
|
#include "WaypointDefines.h"
|
||||||
|
|
||||||
class Quest;
|
class Quest;
|
||||||
|
|
||||||
#define DEFAULT_MAX_PLAYER_DISTANCE 50
|
#define DEFAULT_MAX_PLAYER_DISTANCE 50
|
||||||
|
|
||||||
struct Escort_Waypoint
|
enum EscortState : uint32
|
||||||
{
|
{
|
||||||
Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w)
|
STATE_ESCORT_NONE = 0x00, // nothing in progress
|
||||||
{
|
STATE_ESCORT_ESCORTING = 0x01, // escort is in progress
|
||||||
id = _id;
|
STATE_ESCORT_RETURNING = 0x02, // escort is returning after being in combat
|
||||||
x = _x;
|
STATE_ESCORT_PAUSED = 0x04 // escort is paused, wont continue with next waypoint
|
||||||
y = _y;
|
|
||||||
z = _z;
|
|
||||||
WaitTimeMs = _w;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 id;
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
uint32 WaitTimeMs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eEscortState
|
struct TC_GAME_API EscortAI : public ScriptedAI
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit npc_escortAI(Creature* creature);
|
explicit EscortAI(Creature* creature);
|
||||||
~npc_escortAI() { }
|
~EscortAI() { }
|
||||||
|
|
||||||
// CreatureAI functions
|
|
||||||
void AttackStart(Unit* who) override;
|
|
||||||
|
|
||||||
|
void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI()
|
||||||
void MoveInLineOfSight(Unit* who) override;
|
void MoveInLineOfSight(Unit* who) override;
|
||||||
|
|
||||||
void JustDied(Unit*) override;
|
void JustDied(Unit*) override;
|
||||||
|
|
||||||
void JustAppeared() override;
|
void JustAppeared() override;
|
||||||
|
|
||||||
void ReturnToLastPoint();
|
void ReturnToLastPoint();
|
||||||
|
|
||||||
void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override;
|
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;
|
void MovementInform(uint32, uint32) override;
|
||||||
|
|
||||||
// EscortAI functions
|
virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
|
||||||
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.
|
void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, uint32 waitTime = 0); // waitTime is in ms
|
||||||
bool SetNextWaypoint(uint32 pointId, float x, float y, float z, float orientation);
|
|
||||||
|
|
||||||
//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 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 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 SetRun(bool on = true);
|
||||||
|
|
||||||
void SetEscortPaused(bool on);
|
void SetEscortPaused(bool on);
|
||||||
|
void SetPauseTimer(uint32 Timer) { _pauseTimer = Timer; }
|
||||||
|
|
||||||
bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState) != 0; }
|
bool HasEscortState(uint32 escortState) { return (_escortState & escortState) != 0; }
|
||||||
virtual bool IsEscorted() const override { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
|
virtual bool IsEscorted() const override { return (_escortState & STATE_ESCORT_ESCORTING); }
|
||||||
|
|
||||||
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
|
void SetMaxPlayerDistance(float newMax) { _maxPlayerDistance = newMax; }
|
||||||
float GetMaxPlayerDistance() const { return MaxPlayerDistance; }
|
float GetMaxPlayerDistance() const { return _maxPlayerDistance; }
|
||||||
|
|
||||||
|
void SetDespawnAtEnd(bool despawn) { _despawnAtEnd = despawn; }
|
||||||
|
void SetDespawnAtFar(bool despawn) { _despawnAtFar = despawn; }
|
||||||
|
|
||||||
|
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;
|
virtual bool IsEscortNPC(bool isEscorting) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -117,27 +83,30 @@ struct TC_GAME_API npc_escortAI : public ScriptedAI
|
|||||||
bool IsPlayerOrGroupInRange();
|
bool IsPlayerOrGroupInRange();
|
||||||
void FillPointMovementListForCreature();
|
void FillPointMovementListForCreature();
|
||||||
|
|
||||||
void AddEscortState(uint32 escortState) { m_uiEscortState |= escortState; }
|
void AddEscortState(uint32 escortState) { _escortState |= escortState; }
|
||||||
void RemoveEscortState(uint32 escortState) { m_uiEscortState &= ~escortState; }
|
void RemoveEscortState(uint32 escortState) { _escortState &= ~escortState; }
|
||||||
|
|
||||||
ObjectGuid m_uiPlayerGUID;
|
ObjectGuid _playerGUID;
|
||||||
uint32 m_uiWPWaitTimer;
|
uint32 _pauseTimer;
|
||||||
uint32 m_uiPlayerCheckTimer;
|
uint32 _playerCheckTimer;
|
||||||
uint32 m_uiEscortState;
|
uint32 _escortState;
|
||||||
float MaxPlayerDistance;
|
float _maxPlayerDistance;
|
||||||
|
|
||||||
Quest const* m_pQuestForEscort; //generally passed in Start() when regular escort script.
|
Quest const* _escortQuest; // generally passed in Start() when regular escort script.
|
||||||
|
|
||||||
std::list<Escort_Waypoint> WaypointList;
|
WaypointPath _path;
|
||||||
std::list<Escort_Waypoint>::iterator CurrentWP;
|
|
||||||
|
|
||||||
bool m_bIsActiveAttacker; //obsolete, determined by faction.
|
bool _activeAttacker; // obsolete, determined by faction.
|
||||||
bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK)
|
bool _running; // 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 _instantRespawn; // 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 _returnToStart; // if creature can walk same path (loop) without despawn. Not for regular escort quests.
|
||||||
bool DespawnAtEnd;
|
bool _despawnAtEnd;
|
||||||
bool DespawnAtFar;
|
bool _despawnAtFar;
|
||||||
bool ScriptWP;
|
bool _manualPath;
|
||||||
bool HasImmuneToNPCFlags;
|
bool _hasImmuneToNPCFlags;
|
||||||
|
bool _started;
|
||||||
|
bool _ended;
|
||||||
|
bool _resume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -41,8 +41,6 @@ class TC_GAME_API FollowerAI : public ScriptedAI
|
|||||||
explicit FollowerAI(Creature* creature);
|
explicit FollowerAI(Creature* creature);
|
||||||
~FollowerAI() { }
|
~FollowerAI() { }
|
||||||
|
|
||||||
//virtual void WaypointReached(uint32 uiPointId) = 0;
|
|
||||||
|
|
||||||
void MovementInform(uint32 motionType, uint32 pointId) override;
|
void MovementInform(uint32 motionType, uint32 pointId) override;
|
||||||
|
|
||||||
void AttackStart(Unit*) override;
|
void AttackStart(Unit*) override;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "SmartAI.h"
|
#include "SmartAI.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
|
#include "CreatureGroups.h"
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
@@ -28,54 +29,12 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "Vehicle.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;
|
mHasConditions = sConditionMgr->HasConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, creature->GetEntry());
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SmartAI::IsAIControlled() const
|
bool SmartAI::IsAIControlled() const
|
||||||
@@ -101,62 +60,45 @@ void SmartAI::UpdateDespawn(uint32 diff)
|
|||||||
} else mDespawnTime -= 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())
|
if (me->IsInCombat()) // no wp movement in combat
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
mCurrentWPID++;
|
|
||||||
WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID);
|
|
||||||
if (itr != mWayPoints->end())
|
|
||||||
{
|
{
|
||||||
mLastWP = (*itr).second;
|
TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement (%u) while in combat, ignoring.", me->GetEntry(), pathId);
|
||||||
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());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
StopPath();
|
StopPath();
|
||||||
|
|
||||||
if (path)
|
SetRun(run);
|
||||||
|
|
||||||
|
if (pathId)
|
||||||
{
|
{
|
||||||
if (!LoadPath(path))
|
if (!LoadPath(pathId))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mWayPoints || mWayPoints->empty())
|
if (_path.nodes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (WayPoint* wp = GetNextWayPoint())
|
_currentWaypointNode = nodeId;
|
||||||
|
_waypointPathEnded = false;
|
||||||
|
|
||||||
|
_repeatWaypointPath = repeat;
|
||||||
|
|
||||||
|
// Do not use AddEscortState, removing everything from previous
|
||||||
|
_escortState = SMART_ESCORT_ESCORTING;
|
||||||
|
|
||||||
|
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
AddEscortState(SMART_ESCORT_ESCORTING);
|
_escortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||||
mCanRepeatPath = repeat;
|
me->SetFlag(UNIT_NPC_FLAGS, 0);
|
||||||
|
|
||||||
SetRun(run);
|
|
||||||
|
|
||||||
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
|
|
||||||
// me->SetUInt32Value(UNIT_NPC_FLAGS, 0); this is incorrect, it needs cp of wp rewrite from 3.3.5a
|
|
||||||
}
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, _currentWaypointNode, GetScript()->GetPathId());
|
||||||
|
|
||||||
|
me->GetMotionMaster()->MovePath(_path, _repeatWaypointPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SmartAI::LoadPath(uint32 entry)
|
bool SmartAI::LoadPath(uint32 entry)
|
||||||
@@ -164,74 +106,82 @@ bool SmartAI::LoadPath(uint32 entry)
|
|||||||
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mWayPoints = sSmartWaypointMgr->GetPath(entry);
|
WaypointPath const* path = sSmartWaypointMgr->GetPath(entry);
|
||||||
if (!mWayPoints)
|
if (!path || path->nodes.empty())
|
||||||
{
|
{
|
||||||
GetScript()->SetPathId(0);
|
GetScript()->SetPathId(0);
|
||||||
return false;
|
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);
|
GetScript()->SetPathId(entry);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::PausePath(uint32 delay, bool forced)
|
void SmartAI::PausePath(uint32 delay, bool forced)
|
||||||
{
|
{
|
||||||
|
if (!HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
|
return;
|
||||||
|
|
||||||
if (HasEscortState(SMART_ESCORT_PAUSED))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
mForcedPaused = forced;
|
|
||||||
mLastOOCPos = me->GetPosition();
|
_waypointPauseTimer = delay;
|
||||||
AddEscortState(SMART_ESCORT_PAUSED);
|
|
||||||
mWPPauseTimer = delay;
|
|
||||||
if (forced)
|
if (forced)
|
||||||
{
|
{
|
||||||
|
_waypointPauseForced = forced;
|
||||||
SetRun(mRun);
|
SetRun(mRun);
|
||||||
me->StopMoving();//force stop
|
me->PauseMovement();
|
||||||
me->GetMotionMaster()->MoveIdle();//force stop
|
|
||||||
}
|
}
|
||||||
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)
|
void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
|
||||||
{
|
{
|
||||||
|
if (!HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
|
return;
|
||||||
|
|
||||||
if (quest)
|
if (quest)
|
||||||
mEscortQuestID = quest;
|
mEscortQuestID = quest;
|
||||||
SetDespawnTime(DespawnTime);
|
|
||||||
//mDespawnTime = DespawnTime;
|
|
||||||
|
|
||||||
mLastOOCPos = me->GetPosition();
|
if (mDespawnState != 2)
|
||||||
me->StopMoving();//force stop
|
SetDespawnTime(DespawnTime);
|
||||||
|
|
||||||
me->GetMotionMaster()->MoveIdle();
|
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);
|
EndPath(fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::EndPath(bool 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);
|
RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
|
||||||
mWayPoints = nullptr;
|
_path.nodes.clear();
|
||||||
mCurrentWPID = 0;
|
_waypointPauseTimer = 0;
|
||||||
mWPPauseTimer = 0;
|
|
||||||
mLastWP = nullptr;
|
|
||||||
|
|
||||||
if (mEscortNPCFlags)
|
if (_escortNPCFlags)
|
||||||
{
|
{
|
||||||
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
|
me->SetFlag(UNIT_NPC_FLAGS, _escortNPCFlags);
|
||||||
mEscortNPCFlags = 0;
|
_escortNPCFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCanRepeatPath)
|
|
||||||
{
|
|
||||||
if (IsAIControlled())
|
|
||||||
StartPath(mRun, GetScript()->GetPathId(), true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetScript()->SetPathId(0);
|
|
||||||
|
|
||||||
ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS, *me);
|
ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS, *me);
|
||||||
if (targets && mEscortQuestID)
|
if (targets && mEscortQuestID)
|
||||||
{
|
{
|
||||||
@@ -275,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)
|
if (mDespawnState == 1)
|
||||||
StartDespawn();
|
StartDespawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::ResumePath()
|
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);
|
SetRun(mRun);
|
||||||
if (mLastWP)
|
me->ResumeMovement();
|
||||||
me->GetMotionMaster()->MovePoint(mLastWP->id, mLastWP->x, mLastWP->y, mLastWP->z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::ReturnToLastOOCPos()
|
void SmartAI::ReturnToLastOOCPos()
|
||||||
@@ -291,80 +262,57 @@ void SmartAI::ReturnToLastOOCPos()
|
|||||||
if (!IsAIControlled())
|
if (!IsAIControlled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetRun(mRun);
|
me->SetWalk(false);
|
||||||
me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, mLastOOCPos);
|
me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, me->GetHomePosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::UpdatePath(uint32 diff)
|
void SmartAI::UpdatePath(uint32 diff)
|
||||||
{
|
{
|
||||||
if (mEscortInvokerCheckTimer < diff)
|
if (!HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_escortInvokerCheckTimer < diff)
|
||||||
{
|
{
|
||||||
// Escort failed, no players in range
|
|
||||||
if (!IsEscortInvokerInRange())
|
if (!IsEscortInvokerInRange())
|
||||||
{
|
{
|
||||||
StopPath(0, mEscortQuestID, true);
|
StopPath(0, mEscortQuestID, true);
|
||||||
|
|
||||||
// allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
|
// 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);
|
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
|
||||||
me->DespawnOrUnsummon(1);
|
me->DespawnOrUnsummon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mEscortInvokerCheckTimer = 1000;
|
_escortInvokerCheckTimer = 1000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mEscortInvokerCheckTimer -= diff;
|
_escortInvokerCheckTimer -= diff;
|
||||||
|
|
||||||
// handle pause
|
// 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))
|
if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING))
|
||||||
{
|
ResumePath();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mWPPauseTimer -= diff;
|
_waypointPauseTimer -= diff;
|
||||||
|
}
|
||||||
|
else if (_waypointPathEnded) // end path
|
||||||
|
{
|
||||||
|
_waypointPathEnded = false;
|
||||||
|
StopPath();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasEscortState(SMART_ESCORT_RETURNING))
|
if (HasEscortState(SMART_ESCORT_RETURNING))
|
||||||
{
|
{
|
||||||
if (mWPReached)//reached OOC WP
|
if (_OOCReached) // reached OOC WP
|
||||||
{
|
{
|
||||||
|
_OOCReached = false;
|
||||||
RemoveEscortState(SMART_ESCORT_RETURNING);
|
RemoveEscortState(SMART_ESCORT_RETURNING);
|
||||||
if (!HasEscortState(SMART_ESCORT_PAUSED))
|
if (!HasEscortState(SMART_ESCORT_PAUSED))
|
||||||
ResumePath();
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,24 +392,43 @@ bool SmartAI::IsEscortInvokerInRange()
|
|||||||
return true;
|
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);
|
|
||||||
|
|
||||||
mLastWPIDReached = id;
|
|
||||||
mWPReached = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId)
|
||||||
{
|
{
|
||||||
if ((MovementType == POINT_MOTION_TYPE && Data == SMART_ESCORT_LAST_OOC_POINT) || MovementType == FOLLOW_MOTION_TYPE)
|
_currentWaypointNode = nodeId;
|
||||||
|
|
||||||
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, _currentWaypointNode, pathId);
|
||||||
|
|
||||||
|
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 type, uint32 id)
|
||||||
|
{
|
||||||
|
if (type == POINT_MOTION_TYPE && id == SMART_ESCORT_LAST_OOC_POINT)
|
||||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||||
|
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data);
|
GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, type, id);
|
||||||
if (MovementType != POINT_MOTION_TYPE || !HasEscortState(SMART_ESCORT_ESCORTING))
|
|
||||||
|
if (!HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
return;
|
return;
|
||||||
MovepointReached(Data);
|
|
||||||
|
if (type == POINT_MOTION_TYPE && id == SMART_ESCORT_LAST_OOC_POINT)
|
||||||
|
_OOCReached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
||||||
@@ -505,8 +472,8 @@ void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
|
|||||||
else
|
else
|
||||||
me->GetMotionMaster()->MoveTargetedHome();
|
me->GetMotionMaster()->MoveTargetedHome();
|
||||||
|
|
||||||
if (!HasEscortState(SMART_ESCORT_ESCORTING)) //dont mess up escort movement after combat
|
if (!me->HasUnitState(UNIT_STATE_EVADE))
|
||||||
SetRun(mRun);
|
GetScript()->OnReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||||
@@ -538,22 +505,22 @@ bool SmartAI::AssistPlayerInCombatAgainst(Unit* who)
|
|||||||
if (!who || !who->GetVictim())
|
if (!who || !who->GetVictim())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//experimental (unknown) flag not present
|
// experimental (unknown) flag not present
|
||||||
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST))
|
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//not a player
|
// not a player
|
||||||
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//never attack friendly
|
// never attack friendly
|
||||||
if (!me->IsValidAssistTarget(who->GetVictim()))
|
if (!me->IsValidAssistTarget(who->GetVictim()))
|
||||||
return false;
|
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))
|
if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who))
|
||||||
{
|
{
|
||||||
//already fighting someone?
|
// already fighting someone?
|
||||||
if (!me->GetVictim())
|
if (!me->GetVictim())
|
||||||
{
|
{
|
||||||
AttackStart(who);
|
AttackStart(who);
|
||||||
@@ -574,14 +541,14 @@ void SmartAI::JustAppeared()
|
|||||||
{
|
{
|
||||||
mDespawnTime = 0;
|
mDespawnTime = 0;
|
||||||
mDespawnState = 0;
|
mDespawnState = 0;
|
||||||
mEscortState = SMART_ESCORT_NONE;
|
_escortState = SMART_ESCORT_NONE;
|
||||||
me->SetVisible(true);
|
me->SetVisible(true);
|
||||||
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
|
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
|
||||||
me->RestoreFaction();
|
me->RestoreFaction();
|
||||||
mJustReset = true;
|
mJustReset = true;
|
||||||
JustReachedHome();
|
JustReachedHome();
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
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;
|
mFollowDist = 0;
|
||||||
mFollowAngle = 0;
|
mFollowAngle = 0;
|
||||||
mFollowCredit = 0;
|
mFollowCredit = 0;
|
||||||
@@ -598,8 +565,16 @@ void SmartAI::JustReachedHome()
|
|||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||||
|
|
||||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
CreatureGroup* formation = me->GetFormation();
|
||||||
me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
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;
|
mJustReset = false;
|
||||||
@@ -611,24 +586,14 @@ void SmartAI::JustEngagedWith(Unit* enemy)
|
|||||||
me->InterruptNonMeleeSpells(false); // must be before ProcessEvents
|
me->InterruptNonMeleeSpells(false); // must be before ProcessEvents
|
||||||
|
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy);
|
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)
|
void SmartAI::JustDied(Unit* killer)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, killer);
|
|
||||||
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
if (HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
{
|
|
||||||
EndPath(true);
|
EndPath(true);
|
||||||
me->StopMoving();//force stop
|
|
||||||
me->GetMotionMaster()->MoveIdle();
|
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, killer);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::KilledUnit(Unit* victim)
|
void SmartAI::KilledUnit(Unit* victim)
|
||||||
@@ -646,15 +611,21 @@ void SmartAI::AttackStart(Unit* who)
|
|||||||
// dont allow charmed npcs to act on their own
|
// dont allow charmed npcs to act on their own
|
||||||
if (!IsAIControlled())
|
if (!IsAIControlled())
|
||||||
{
|
{
|
||||||
if (who && mCanAutoAttack)
|
if (who)
|
||||||
me->Attack(who, true);
|
me->Attack(who, mCanAutoAttack);
|
||||||
return;
|
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)
|
if (mCanCombatMove)
|
||||||
|
{
|
||||||
|
SetRun(mRun);
|
||||||
me->GetMotionMaster()->MoveChase(who);
|
me->GetMotionMaster()->MoveChase(who);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,10 +688,10 @@ void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
|||||||
void SmartAI::InitializeAI()
|
void SmartAI::InitializeAI()
|
||||||
{
|
{
|
||||||
GetScript()->OnInitialize(me);
|
GetScript()->OnInitialize(me);
|
||||||
|
|
||||||
if (!me->isDead())
|
if (!me->isDead())
|
||||||
{
|
{
|
||||||
mJustReset = true;
|
GetScript()->OnReset();
|
||||||
JustReachedHome();
|
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,11 +704,12 @@ void SmartAI::OnCharmed(bool apply)
|
|||||||
EndPath(true);
|
EndPath(true);
|
||||||
me->StopMoving();
|
me->StopMoving();
|
||||||
}
|
}
|
||||||
|
|
||||||
mIsCharmed = apply;
|
mIsCharmed = apply;
|
||||||
|
|
||||||
if (!apply && !me->IsInEvadeMode())
|
if (!apply && !me->IsInEvadeMode())
|
||||||
{
|
{
|
||||||
if (mCanRepeatPath)
|
if (_repeatWaypointPath)
|
||||||
StartPath(mRun, GetScript()->GetPathId(), true);
|
StartPath(mRun, GetScript()->GetPathId(), true);
|
||||||
else
|
else
|
||||||
me->SetWalk(!mRun);
|
me->SetWalk(!mRun);
|
||||||
@@ -830,30 +802,21 @@ void SmartAI::SetCombatMove(bool on)
|
|||||||
{
|
{
|
||||||
if (mCanCombatMove == on)
|
if (mCanCombatMove == on)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCanCombatMove = on;
|
mCanCombatMove = on;
|
||||||
|
|
||||||
if (!IsAIControlled())
|
if (!IsAIControlled())
|
||||||
return;
|
return;
|
||||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))
|
|
||||||
{
|
|
||||||
if (on && me->GetVictim())
|
|
||||||
{
|
|
||||||
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();
|
if (me->IsInCombat())
|
||||||
me->GetMotionMaster()->Clear(true);
|
{
|
||||||
me->StopMoving();
|
if (on && !me->HasReactState(REACT_PASSIVE) && me->GetVictim() && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == MAX_MOTION_TYPE)
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -885,7 +848,6 @@ void SmartAI::StopFollow(bool complete)
|
|||||||
mFollowArrivedTimer = 1000;
|
mFollowArrivedTimer = 1000;
|
||||||
mFollowArrivedEntry = 0;
|
mFollowArrivedEntry = 0;
|
||||||
mFollowCreditType = 0;
|
mFollowCreditType = 0;
|
||||||
me->StopMoving();
|
|
||||||
me->GetMotionMaster()->MoveIdle();
|
me->GetMotionMaster()->MoveIdle();
|
||||||
|
|
||||||
if (!complete)
|
if (!complete)
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
#include "GameObjectAI.h"
|
#include "GameObjectAI.h"
|
||||||
#include "Position.h"
|
#include "Position.h"
|
||||||
#include "SmartScript.h"
|
#include "SmartScript.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
struct WayPoint;
|
|
||||||
|
|
||||||
enum SmartEscortState
|
enum SmartEscortState
|
||||||
{
|
{
|
||||||
@@ -43,32 +42,37 @@ enum SmartEscortVars
|
|||||||
class TC_GAME_API SmartAI : public CreatureAI
|
class TC_GAME_API SmartAI : public CreatureAI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~SmartAI(){ }
|
~SmartAI() { }
|
||||||
explicit SmartAI(Creature* c);
|
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
|
// Check whether we are currently permitted to make the creature take action
|
||||||
bool IsAIControlled() const;
|
bool IsAIControlled() const;
|
||||||
|
|
||||||
// Start moving to the desired MovePoint
|
// 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);
|
bool LoadPath(uint32 entry);
|
||||||
void PausePath(uint32 delay, bool forced = false);
|
void PausePath(uint32 delay, bool forced = false);
|
||||||
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
||||||
void EndPath(bool fail = false);
|
void EndPath(bool fail = false);
|
||||||
void ResumePath();
|
void ResumePath();
|
||||||
WayPoint* GetNextWayPoint();
|
bool HasEscortState(uint32 uiEscortState) const { return (_escortState & uiEscortState) != 0; }
|
||||||
bool HasEscortState(uint32 uiEscortState) const { return (mEscortState & uiEscortState) != 0; }
|
void AddEscortState(uint32 uiEscortState) { _escortState |= uiEscortState; }
|
||||||
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
|
void RemoveEscortState(uint32 uiEscortState) { _escortState &= ~uiEscortState; }
|
||||||
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
|
|
||||||
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
|
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
|
||||||
void SetCombatMove(bool on);
|
void SetCombatMove(bool on);
|
||||||
bool CanCombatMove() { return mCanCombatMove; }
|
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 SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0);
|
||||||
void StopFollow(bool complete);
|
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);
|
void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker);
|
||||||
SmartScript* GetScript() { return &mScript; }
|
SmartScript* GetScript() { return &mScript; }
|
||||||
bool IsEscortInvokerInRange();
|
|
||||||
|
|
||||||
// Called when creature is spawned or respawned
|
// Called when creature is spawned or respawned
|
||||||
void JustAppeared() override;
|
void JustAppeared() override;
|
||||||
@@ -157,12 +161,6 @@ class TC_GAME_API SmartAI : public CreatureAI
|
|||||||
// Used in scripts to share variables
|
// Used in scripts to share variables
|
||||||
ObjectGuid GetGUID(int32 id = 0) const override;
|
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
|
// Makes the creature run/walk
|
||||||
void SetRun(bool run = true);
|
void SetRun(bool run = true);
|
||||||
|
|
||||||
@@ -194,11 +192,20 @@ class TC_GAME_API SmartAI : public CreatureAI
|
|||||||
|
|
||||||
void OnSpellClick(Unit* clicker, bool& result) override;
|
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; }
|
void SetGossipReturn(bool val) { _gossipReturn = val; }
|
||||||
|
|
||||||
private:
|
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;
|
bool mIsCharmed;
|
||||||
uint32 mFollowCreditType;
|
uint32 mFollowCreditType;
|
||||||
uint32 mFollowArrivedTimer;
|
uint32 mFollowArrivedTimer;
|
||||||
@@ -208,36 +215,28 @@ class TC_GAME_API SmartAI : public CreatureAI
|
|||||||
float mFollowDist;
|
float mFollowDist;
|
||||||
float mFollowAngle;
|
float mFollowAngle;
|
||||||
|
|
||||||
void ReturnToLastOOCPos();
|
uint32 _escortState;
|
||||||
void UpdatePath(const uint32 diff);
|
uint32 _escortNPCFlags;
|
||||||
SmartScript mScript;
|
uint32 _escortInvokerCheckTimer;
|
||||||
WPPath* mWayPoints;
|
WaypointPath _path;
|
||||||
uint32 mEscortState;
|
uint32 _currentWaypointNode;
|
||||||
uint32 mCurrentWPID;
|
bool _waypointReached;
|
||||||
uint32 mLastWPIDReached;
|
uint32 _waypointPauseTimer;
|
||||||
bool mWPReached;
|
bool _waypointPauseForced;
|
||||||
uint32 mWPPauseTimer;
|
bool _repeatWaypointPath;
|
||||||
uint32 mEscortNPCFlags;
|
bool _OOCReached;
|
||||||
WayPoint* mLastWP;
|
bool _waypointPathEnded;
|
||||||
Position mLastOOCPos;//set on enter combat
|
|
||||||
uint32 GetWPCount() const { return mWayPoints ? uint32(mWayPoints->size()) : 0; }
|
|
||||||
bool mCanRepeatPath;
|
|
||||||
bool mRun;
|
bool mRun;
|
||||||
bool mEvadeDisabled;
|
bool mEvadeDisabled;
|
||||||
bool mCanAutoAttack;
|
bool mCanAutoAttack;
|
||||||
bool mCanCombatMove;
|
bool mCanCombatMove;
|
||||||
bool mForcedPaused;
|
|
||||||
uint32 mInvincibilityHpLevel;
|
uint32 mInvincibilityHpLevel;
|
||||||
bool AssistPlayerInCombatAgainst(Unit* who);
|
|
||||||
|
|
||||||
uint32 mDespawnTime;
|
uint32 mDespawnTime;
|
||||||
uint32 mDespawnState;
|
uint32 mDespawnState;
|
||||||
void UpdateDespawn(uint32 diff);
|
|
||||||
uint32 mEscortInvokerCheckTimer;
|
|
||||||
bool mJustReset;
|
bool mJustReset;
|
||||||
|
|
||||||
// Vehicle conditions
|
// Vehicle conditions
|
||||||
void CheckConditions(uint32 diff);
|
|
||||||
bool mHasConditions;
|
bool mHasConditions;
|
||||||
uint32 mConditionsTimer;
|
uint32 mConditionsTimer;
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "TemporarySummon.h"
|
#include "TemporarySummon.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
#include <G3D/Quat.h>
|
#include <G3D/Quat.h>
|
||||||
|
|
||||||
SmartScript::SmartScript()
|
SmartScript::SmartScript()
|
||||||
@@ -2057,7 +2058,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||||||
std::back_inserter(waypoints), [](uint32 wp) { return wp != 0; });
|
std::back_inserter(waypoints), [](uint32 wp) { return wp != 0; });
|
||||||
|
|
||||||
float distanceToClosest = std::numeric_limits<float>::max();
|
float distanceToClosest = std::numeric_limits<float>::max();
|
||||||
WayPoint* closestWp = nullptr;
|
std::pair<uint32, uint32> closest = { 0, 0 };
|
||||||
|
|
||||||
for (WorldObject* target : targets)
|
for (WorldObject* target : targets)
|
||||||
{
|
{
|
||||||
@@ -2065,29 +2066,27 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||||||
{
|
{
|
||||||
if (IsSmart(creature))
|
if (IsSmart(creature))
|
||||||
{
|
{
|
||||||
for (uint32 wp : waypoints)
|
for (uint32 pathId : waypoints)
|
||||||
{
|
{
|
||||||
WPPath* path = sSmartWaypointMgr->GetPath(wp);
|
WaypointPath const* path = sSmartWaypointMgr->GetPath(pathId);
|
||||||
if (!path || path->empty())
|
if (!path || path->nodes.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto itrWp = path->find(0);
|
for (auto itr = path->nodes.begin(); itr != path->nodes.end(); ++itr)
|
||||||
if (itrWp != path->end())
|
|
||||||
{
|
{
|
||||||
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);
|
distanceToClosest = distamceToThisNode;
|
||||||
if (distToThisPath < distanceToClosest)
|
closest.first = pathId;
|
||||||
{
|
closest.second = waypoint.id;
|
||||||
distanceToClosest = distToThisPath;
|
|
||||||
closestWp = wp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closestWp)
|
if (closest.first != 0)
|
||||||
CAST_AI(SmartAI, creature->AI())->StartPath(false, closestWp->id, true);
|
CAST_AI(SmartAI, creature->AI())->StartPath(false, closest.first, true, nullptr, closest.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "UnitDefines.h"
|
#include "UnitDefines.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
|
|
||||||
SmartWaypointMgr* SmartWaypointMgr::instance()
|
SmartWaypointMgr* SmartWaypointMgr::instance()
|
||||||
{
|
{
|
||||||
@@ -41,15 +42,7 @@ void SmartWaypointMgr::LoadFromDB()
|
|||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
for (std::unordered_map<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)
|
_waypointStore.clear();
|
||||||
{
|
|
||||||
for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
|
|
||||||
delete pathItr->second;
|
|
||||||
|
|
||||||
delete itr->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
waypoint_map.clear();
|
|
||||||
|
|
||||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);
|
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);
|
||||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||||
@@ -63,49 +56,47 @@ void SmartWaypointMgr::LoadFromDB()
|
|||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
uint32 total = 0;
|
uint32 total = 0;
|
||||||
uint32 last_entry = 0;
|
uint32 lastEntry = 0;
|
||||||
uint32 last_id = 1;
|
uint32 lastId = 1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 entry = fields[0].GetUInt32();
|
uint32 entry = fields[0].GetUInt32();
|
||||||
uint32 id = fields[1].GetUInt32();
|
uint32 id = fields[1].GetUInt32();
|
||||||
float x, y, z;
|
float x = fields[2].GetFloat();
|
||||||
x = fields[2].GetFloat();
|
float y = fields[3].GetFloat();
|
||||||
y = fields[3].GetFloat();
|
float z = fields[4].GetFloat();
|
||||||
z = fields[4].GetFloat();
|
|
||||||
|
|
||||||
if (last_entry != entry)
|
if (lastEntry != entry)
|
||||||
{
|
{
|
||||||
waypoint_map[entry] = new WPPath();
|
lastId = 1;
|
||||||
last_id = 1;
|
++count;
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_id != id)
|
if (lastId != id)
|
||||||
TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
|
TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, lastId);
|
||||||
|
|
||||||
last_id++;
|
++lastId;
|
||||||
(*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
|
|
||||||
|
|
||||||
last_entry = entry;
|
WaypointPath& path = _waypointStore[entry];
|
||||||
total++;
|
path.id = entry;
|
||||||
|
path.nodes.emplace_back(id, x, y, z);
|
||||||
|
|
||||||
|
lastEntry = entry;
|
||||||
|
++total;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
|
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)
|
auto itr = _waypointStore.find(id);
|
||||||
{
|
if (itr != _waypointStore.end())
|
||||||
for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)
|
return &itr->second;
|
||||||
delete pathItr->second;
|
return nullptr;
|
||||||
|
|
||||||
delete itr->second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SmartAIMgr* SmartAIMgr::instance()
|
SmartAIMgr* SmartAIMgr::instance()
|
||||||
@@ -1375,7 +1366,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
|||||||
break;
|
break;
|
||||||
case SMART_ACTION_WP_START:
|
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);
|
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;
|
return false;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -27,22 +28,6 @@
|
|||||||
class WorldObject;
|
class WorldObject;
|
||||||
enum SpellEffIndex : uint8;
|
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
|
enum eSmartAI
|
||||||
{
|
{
|
||||||
SMART_EVENT_PARAM_COUNT = 4,
|
SMART_EVENT_PARAM_COUNT = 4,
|
||||||
@@ -1546,8 +1531,6 @@ struct SmartScriptHolder
|
|||||||
operator bool() const { return entryOrGuid != 0; }
|
operator bool() const { return entryOrGuid != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::unordered_map<uint32, WayPoint*> WPPath;
|
|
||||||
|
|
||||||
typedef std::vector<WorldObject*> ObjectVector;
|
typedef std::vector<WorldObject*> ObjectVector;
|
||||||
|
|
||||||
class ObjectGuidVector
|
class ObjectGuidVector
|
||||||
@@ -1574,26 +1557,22 @@ typedef std::unordered_map<uint32, ObjectGuidVector> ObjectVectorMap;
|
|||||||
|
|
||||||
class TC_GAME_API SmartWaypointMgr
|
class TC_GAME_API SmartWaypointMgr
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
SmartWaypointMgr() { }
|
|
||||||
~SmartWaypointMgr();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SmartWaypointMgr* instance();
|
static SmartWaypointMgr* instance();
|
||||||
|
|
||||||
void LoadFromDB();
|
void LoadFromDB();
|
||||||
|
|
||||||
WPPath* GetPath(uint32 id)
|
WaypointPath const* GetPath(uint32 id);
|
||||||
{
|
|
||||||
if (waypoint_map.find(id) != waypoint_map.end())
|
|
||||||
return waypoint_map[id];
|
|
||||||
else return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
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
|
// all events for a single entry
|
||||||
typedef std::vector<SmartScriptHolder> SmartAIEventList;
|
typedef std::vector<SmartScriptHolder> SmartAIEventList;
|
||||||
typedef std::vector<SmartScriptHolder> SmartAIEventStoredList;
|
typedef std::vector<SmartScriptHolder> SmartAIEventStoredList;
|
||||||
@@ -1662,5 +1641,4 @@ class TC_GAME_API SmartAIMgr
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define sSmartScriptMgr SmartAIMgr::instance()
|
#define sSmartScriptMgr SmartAIMgr::instance()
|
||||||
#define sSmartWaypointMgr SmartWaypointMgr::instance()
|
|
||||||
#endif
|
#endif
|
||||||
@@ -268,6 +268,21 @@ void Creature::DisappearAndDie()
|
|||||||
RemoveCorpse(false);
|
RemoveCorpse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
void Creature::SearchFormation()
|
||||||
{
|
{
|
||||||
if (IsSummon())
|
if (IsSummon())
|
||||||
@@ -282,6 +297,33 @@ void Creature::SearchFormation()
|
|||||||
sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this);
|
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)
|
void Creature::RemoveCorpse(bool setSpawnTime)
|
||||||
{
|
{
|
||||||
if (getDeathState() != CORPSE)
|
if (getDeathState() != CORPSE)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class Quest;
|
|||||||
class Player;
|
class Player;
|
||||||
class SpellInfo;
|
class SpellInfo;
|
||||||
class WorldSession;
|
class WorldSession;
|
||||||
|
|
||||||
enum MovementGeneratorType : uint8;
|
enum MovementGeneratorType : uint8;
|
||||||
|
|
||||||
struct VendorItemCount
|
struct VendorItemCount
|
||||||
@@ -291,9 +292,15 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
|||||||
uint32 GetCurrentWaypointID() const { return m_waypointID; }
|
uint32 GetCurrentWaypointID() const { return m_waypointID; }
|
||||||
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
|
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
|
||||||
|
|
||||||
|
void PauseMovement(uint32 timer = 0, uint8 slot = 0) override; // timer in ms
|
||||||
|
bool IsReturningHome() const;
|
||||||
|
|
||||||
void SearchFormation();
|
void SearchFormation();
|
||||||
CreatureGroup* GetFormation() { return m_formation; }
|
CreatureGroup* GetFormation() { return m_formation; }
|
||||||
void SetFormation(CreatureGroup* formation) { m_formation = 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();
|
Unit* SelectVictim();
|
||||||
|
|
||||||
|
|||||||
@@ -265,3 +265,17 @@ void CreatureGroup::LeaderMoveTo(Position destination, uint32 id /*= 0*/, uint32
|
|||||||
member->SetHomePosition(dx, dy, dz, pathangle);
|
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->IsInCombat() || itr->first->IsReturningHome())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -83,6 +83,7 @@ class TC_GAME_API CreatureGroup
|
|||||||
uint32 GetId() const { return m_groupID; }
|
uint32 GetId() const { return m_groupID; }
|
||||||
bool isEmpty() const { return m_members.empty(); }
|
bool isEmpty() const { return m_members.empty(); }
|
||||||
bool isFormed() const { return m_Formed; }
|
bool isFormed() const { return m_Formed; }
|
||||||
|
bool IsLeader(Creature const* creature) const { return m_leader == creature; }
|
||||||
|
|
||||||
void AddMember(Creature* member);
|
void AddMember(Creature* member);
|
||||||
void RemoveMember(Creature* member);
|
void RemoveMember(Creature* member);
|
||||||
@@ -90,6 +91,7 @@ class TC_GAME_API CreatureGroup
|
|||||||
|
|
||||||
void LeaderMoveTo(Position destination, uint32 id = 0, uint32 moveType = 0, bool orientation = false);
|
void LeaderMoveTo(Position destination, uint32 id = 0, uint32 moveType = 0, bool orientation = false);
|
||||||
void MemberAttackStart(Creature* member, Unit* target);
|
void MemberAttackStart(Creature* member, Unit* target);
|
||||||
|
bool CanLeaderStartMoving() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sFormationMgr FormationMgr::instance()
|
#define sFormationMgr FormationMgr::instance()
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "LootMgr.h"
|
#include "LootMgr.h"
|
||||||
#include "MotionMaster.h"
|
#include "MotionMaster.h"
|
||||||
|
#include "MovementGenerator.h"
|
||||||
#include "MovementStructures.h"
|
#include "MovementStructures.h"
|
||||||
#include "MoveSpline.h"
|
#include "MoveSpline.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
@@ -10944,6 +10945,26 @@ void Unit::StopMoving()
|
|||||||
init.Stop();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
bool Unit::IsSitState() const
|
bool Unit::IsSitState() const
|
||||||
{
|
{
|
||||||
uint8 s = GetStandState();
|
uint8 s = GetStandState();
|
||||||
@@ -12113,8 +12134,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
|||||||
|
|
||||||
if (GetTypeId() == TYPEID_UNIT)
|
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);
|
ToCreature()->AI()->OnCharmed(true);
|
||||||
GetMotionMaster()->MoveIdle();
|
|
||||||
}
|
}
|
||||||
else if (Player* player = ToPlayer())
|
else if (Player* player = ToPlayer())
|
||||||
{
|
{
|
||||||
@@ -12230,6 +12257,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
|||||||
else
|
else
|
||||||
RestoreFaction();
|
RestoreFaction();
|
||||||
|
|
||||||
|
///@todo Handle SLOT_IDLE motion resume
|
||||||
GetMotionMaster()->InitDefault();
|
GetMotionMaster()->InitDefault();
|
||||||
|
|
||||||
if (Creature* creature = ToCreature())
|
if (Creature* creature = ToCreature())
|
||||||
|
|||||||
@@ -1771,6 +1771,8 @@ class TC_GAME_API Unit : public WorldObject
|
|||||||
|
|
||||||
bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); }
|
bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); }
|
||||||
void StopMoving();
|
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.AddMovementFlag(f); }
|
void AddUnitMovementFlag(uint32 f) { m_movementInfo.AddMovementFlag(f); }
|
||||||
void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.RemoveMovementFlag(f); }
|
void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.RemoveMovementFlag(f); }
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop the npc if moving
|
// Stop the npc if moving
|
||||||
unit->StopMoving();
|
unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
|
||||||
|
|
||||||
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(unit->GetEntry());
|
BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(unit->GetEntry());
|
||||||
|
|
||||||
|
|||||||
@@ -612,8 +612,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
|
|||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
// Stop the npc if moving
|
// Stop the npc if moving
|
||||||
if (vendor->HasUnitState(UNIT_STATE_MOVING))
|
vendor->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
|
||||||
vendor->StopMoving();
|
|
||||||
|
|
||||||
VendorItemData const* vendorItems = vendor->GetVendorItems();
|
VendorItemData const* vendorItems = vendor->GetVendorItems();
|
||||||
uint32 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;
|
uint32 rawItemCount = vendorItems ? vendorItems->GetItemCount() : 0;
|
||||||
|
|||||||
@@ -24,9 +24,10 @@
|
|||||||
#include "Corpse.h"
|
#include "Corpse.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
|
#include "MotionMaster.h"
|
||||||
|
#include "MovementGenerator.h"
|
||||||
#include "Transport.h"
|
#include "Transport.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
|
||||||
#include "InstanceSaveMgr.h"
|
#include "InstanceSaveMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "MovementStructures.h"
|
#include "MovementStructures.h"
|
||||||
@@ -135,8 +136,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
if (!_player->InBattleground())
|
if (!_player->InBattleground())
|
||||||
{
|
{
|
||||||
// short preparations to continue flight
|
// short preparations to continue flight
|
||||||
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
|
MovementGenerator* movementGenerator = GetPlayer()->GetMotionMaster()->top();
|
||||||
flight->Initialize(GetPlayer());
|
movementGenerator->Initialize(GetPlayer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
|
||||||
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
|
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
|
||||||
@@ -341,8 +342,8 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
|||||||
//if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
//if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||||
// GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
// GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
if (unit->IsArmorer() || unit->IsCivilian() || unit->IsQuestGiver() || unit->IsServiceProvider() || unit->IsGuard())
|
// Stop the npc if moving
|
||||||
unit->StopMoving();
|
unit->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
|
||||||
|
|
||||||
// If spiritguide, no need for gossip menu, just put player into resurrect queue
|
// If spiritguide, no need for gossip menu, just put player into resurrect queue
|
||||||
if (unit->IsSpiritGuide())
|
if (unit->IsSpiritGuide())
|
||||||
|
|||||||
@@ -90,8 +90,9 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
|
|||||||
// remove fake death
|
// remove fake death
|
||||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
// Stop the npc if moving
|
// Stop the npc if moving
|
||||||
creature->StopMoving();
|
creature->PauseMovement(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
|
||||||
|
|
||||||
_player->PlayerTalkClass->ClearMenus();
|
_player->PlayerTalkClass->ClearMenus();
|
||||||
if (creature->AI()->GossipHello(_player))
|
if (creature->AI()->GossipHello(_player))
|
||||||
|
|||||||
@@ -18,9 +18,11 @@
|
|||||||
|
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "Creature.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "MotionMaster.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
@@ -118,8 +120,7 @@ void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathN
|
|||||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
while (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
|
GetPlayer()->GetMotionMaster()->Clear(MOTION_SLOT_CONTROLLED);
|
||||||
GetPlayer()->GetMotionMaster()->MovementExpired(false);
|
|
||||||
|
|
||||||
if (mountDisplayId)
|
if (mountDisplayId)
|
||||||
GetPlayer()->Mount(mountDisplayId);
|
GetPlayer()->Mount(mountDisplayId);
|
||||||
|
|||||||
@@ -17,25 +17,28 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MotionMaster.h"
|
#include "MotionMaster.h"
|
||||||
|
#include "ConfusedMovementGenerator.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "CreatureAISelector.h"
|
#include "CreatureAISelector.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "Map.h"
|
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "ScriptSystem.h"
|
|
||||||
#include "ConfusedMovementGenerator.h"
|
|
||||||
#include "FleeingMovementGenerator.h"
|
#include "FleeingMovementGenerator.h"
|
||||||
|
#include "FormationMovementGenerator.h"
|
||||||
#include "HomeMovementGenerator.h"
|
#include "HomeMovementGenerator.h"
|
||||||
#include "IdleMovementGenerator.h"
|
#include "IdleMovementGenerator.h"
|
||||||
#include "PointMovementGenerator.h"
|
#include "Log.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
#include "Map.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
|
||||||
#include "RandomMovementGenerator.h"
|
|
||||||
#include "SplineChainMovementGenerator.h"
|
|
||||||
#include "FormationMovementGenerator.h"
|
|
||||||
#include "MoveSpline.h"
|
#include "MoveSpline.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
|
#include "PathGenerator.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "PointMovementGenerator.h"
|
||||||
|
#include "RandomMovementGenerator.h"
|
||||||
|
#include "ScriptSystem.h"
|
||||||
|
#include "SplineChainMovementGenerator.h"
|
||||||
|
#include "TargetedMovementGenerator.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
|
#include "WaypointMovementGenerator.h"
|
||||||
|
|
||||||
inline MovementGenerator* GetIdleMovementGenerator()
|
inline MovementGenerator* GetIdleMovementGenerator()
|
||||||
{
|
{
|
||||||
@@ -673,16 +676,21 @@ void MotionMaster::MoveDistract(uint32 timer)
|
|||||||
Mutate(mgen, MOTION_SLOT_CONTROLLED);
|
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;
|
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).",
|
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");
|
||||||
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
|
}
|
||||||
_owner->GetGUID().GetCounter(), path_id, 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) 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)
|
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class Unit;
|
|||||||
class PathGenerator;
|
class PathGenerator;
|
||||||
struct SplineChainLink;
|
struct SplineChainLink;
|
||||||
struct SplineChainResumeInfo;
|
struct SplineChainResumeInfo;
|
||||||
|
struct WaypointPath;
|
||||||
|
|
||||||
// Creature Entry ID used for waypoints show, visible only for GMs
|
// Creature Entry ID used for waypoints show, visible only for GMs
|
||||||
#define VISUAL_WAYPOINT 1
|
#define VISUAL_WAYPOINT 1
|
||||||
@@ -61,9 +62,9 @@ enum MovementGeneratorType : uint8
|
|||||||
MAX_MOTION_TYPE // limit
|
MAX_MOTION_TYPE // limit
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MovementSlot
|
enum MovementSlot : uint8
|
||||||
{
|
{
|
||||||
MOTION_SLOT_IDLE,
|
MOTION_SLOT_IDLE = 0,
|
||||||
MOTION_SLOT_ACTIVE,
|
MOTION_SLOT_ACTIVE,
|
||||||
MOTION_SLOT_CONTROLLED,
|
MOTION_SLOT_CONTROLLED,
|
||||||
MAX_MOTION_SLOT
|
MAX_MOTION_SLOT
|
||||||
@@ -161,7 +162,8 @@ class TC_GAME_API MotionMaster
|
|||||||
void MoveSeekAssistanceDistract(uint32 timer);
|
void MoveSeekAssistanceDistract(uint32 timer);
|
||||||
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
||||||
void MoveDistract(uint32 time);
|
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 MoveRotate(uint32 time, RotateDirection direction);
|
||||||
|
|
||||||
void MoveFormation(uint32 id, Position destination, uint32 moveType, bool forceRun = false, bool forceOrientation = false);
|
void MoveFormation(uint32 id, Position destination, uint32 moveType, bool forceRun = false, bool forceOrientation = false);
|
||||||
|
|||||||
@@ -36,10 +36,11 @@ class TC_GAME_API MovementGenerator
|
|||||||
virtual void Finalize(Unit*) = 0;
|
virtual void Finalize(Unit*) = 0;
|
||||||
virtual void Reset(Unit*) = 0;
|
virtual void Reset(Unit*) = 0;
|
||||||
virtual bool Update(Unit*, uint32 diff) = 0;
|
virtual bool Update(Unit*, uint32 diff) = 0;
|
||||||
|
|
||||||
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
|
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
|
||||||
|
|
||||||
virtual void UnitSpeedChanged() { }
|
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
|
// 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; }
|
virtual bool GetResetPosition(Unit*, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "CreatureGroups.h"
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
#include "MoveSpline.h"
|
#include "MoveSpline.h"
|
||||||
@@ -55,8 +54,7 @@ void PointMovementGenerator<T>::DoInitialize(T* owner)
|
|||||||
|
|
||||||
// Call for creature group update
|
// Call for creature group update
|
||||||
if (Creature* creature = owner->ToCreature())
|
if (Creature* creature = owner->ToCreature())
|
||||||
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
|
creature->SignalFormationMovement(Position(_x, _y, _z), _movementId);
|
||||||
creature->GetFormation()->LeaderMoveTo(Position(_x, _y, _z), _movementId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -89,8 +87,7 @@ bool PointMovementGenerator<T>::DoUpdate(T* owner, uint32 /*diff*/)
|
|||||||
|
|
||||||
// Call for creature group update
|
// Call for creature group update
|
||||||
if (Creature* creature = owner->ToCreature())
|
if (Creature* creature = owner->ToCreature())
|
||||||
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
|
creature->SignalFormationMovement(Position(_x, _y, _z), _movementId);
|
||||||
creature->GetFormation()->LeaderMoveTo(Position(_x, _y, _z), _movementId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !owner->movespline->Finalized();
|
return !owner->movespline->Finalized();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "RandomMovementGenerator.h"
|
#include "RandomMovementGenerator.h"
|
||||||
#include "Creature.h"
|
#include "Creature.h"
|
||||||
#include "CreatureGroups.h"
|
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
#include "MoveSpline.h"
|
#include "MoveSpline.h"
|
||||||
@@ -116,8 +115,7 @@ void RandomMovementGenerator<Creature>::SetRandomLocation(Creature* owner)
|
|||||||
_timer.Reset(traveltime + resetTimer);
|
_timer.Reset(traveltime + resetTimer);
|
||||||
|
|
||||||
// Call for creature group update
|
// Call for creature group update
|
||||||
if (owner->GetFormation() && owner->GetFormation()->getLeader() == owner)
|
owner->SignalFormationMovement(position);
|
||||||
owner->GetFormation()->LeaderMoveTo(position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -17,38 +17,58 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointMovementGenerator.h"
|
||||||
|
#include "Creature.h"
|
||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "CreatureGroups.h"
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
#include "MoveSpline.h"
|
#include "MoveSpline.h"
|
||||||
#include "MoveSplineInit.h"
|
#include "MoveSplineInit.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "Player.h"
|
||||||
#include "Transport.h"
|
#include "Transport.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
|
#include "WaypointManager.h"
|
||||||
#include "World.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)
|
void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
|
||||||
{
|
{
|
||||||
if (!path_id)
|
if (_loadedFromDB)
|
||||||
path_id = creature->GetWaypointPath();
|
{
|
||||||
|
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
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StartMoveNow(creature);
|
_nextMoveTime.Reset(3000);
|
||||||
|
|
||||||
|
if (CanMove(creature))
|
||||||
|
StartMoveNow(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature)
|
void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature)
|
||||||
{
|
{
|
||||||
LoadPath(creature);
|
LoadPath(creature);
|
||||||
creature->AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
|
void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
|
||||||
@@ -59,58 +79,67 @@ void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
|
|||||||
|
|
||||||
void WaypointMovementGenerator<Creature>::DoReset(Creature* creature)
|
void WaypointMovementGenerator<Creature>::DoReset(Creature* creature)
|
||||||
{
|
{
|
||||||
creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
|
if (CanMove(creature))
|
||||||
StartMoveNow(creature);
|
StartMoveNow(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
|
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
|
||||||
{
|
{
|
||||||
if (!i_path || i_path->empty())
|
if (!_path || _path->nodes.empty())
|
||||||
return;
|
|
||||||
if (m_isArrivalDone)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_isArrivalDone = true;
|
WaypointNode const &waypoint = _path->nodes.at(_currentNode);
|
||||||
|
if (waypoint.delay)
|
||||||
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inform script
|
|
||||||
MovementInform(creature);
|
|
||||||
creature->UpdateWaypointID(i_currentNode);
|
|
||||||
|
|
||||||
if (i_path->at(i_currentNode)->delay)
|
|
||||||
{
|
{
|
||||||
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||||
Stop(i_path->at(i_currentNode)->delay);
|
_nextMoveTime.Reset(waypoint.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);
|
||||||
|
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)
|
bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
||||||
{
|
{
|
||||||
if (!i_path || i_path->empty())
|
if (!creature || !creature->IsAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Dont allow dead creatures to move
|
if (!_path || _path->nodes.empty())
|
||||||
if (!creature->IsAlive())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Stopped())
|
// if the owner is the leader of its formation, check members status
|
||||||
return true;
|
if (creature->IsFormationLeader() && !creature->IsFormationLeaderMoveAllowed())
|
||||||
|
|
||||||
bool transportPath = creature->GetTransport() != nullptr;
|
|
||||||
|
|
||||||
if (m_isArrivalDone)
|
|
||||||
{
|
{
|
||||||
if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
|
_nextMoveTime.Reset(1000);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool transportPath = !creature->GetTransGUID().IsEmpty();
|
||||||
|
|
||||||
|
if (_isArrivalDone)
|
||||||
|
{
|
||||||
|
if ((_currentNode == _path->nodes.size() - 1) && !_repeating) // If that's our last waypoint
|
||||||
{
|
{
|
||||||
float x = i_path->at(i_currentNode)->x;
|
WaypointNode const &waypoint = _path->nodes.at(_currentNode);
|
||||||
float y = i_path->at(i_currentNode)->y;
|
|
||||||
float z = i_path->at(i_currentNode)->z;
|
float x = waypoint.x;
|
||||||
|
float y = waypoint.y;
|
||||||
|
float z = waypoint.z;
|
||||||
float o = creature->GetOrientation();
|
float o = creature->GetOrientation();
|
||||||
|
|
||||||
if (!transportPath)
|
if (!transportPath)
|
||||||
@@ -128,21 +157,27 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
|||||||
transportPath = false;
|
transportPath = false;
|
||||||
// else if (vehicle) - this should never happen, vehicle offsets are const
|
// else if (vehicle) - this should never happen, vehicle offsets are const
|
||||||
}
|
}
|
||||||
|
|
||||||
creature->GetMotionMaster()->Initialize();
|
|
||||||
return false;
|
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);
|
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);
|
Movement::MoveSplineInit init(creature);
|
||||||
|
|
||||||
//! If creature is on transport, we assume waypoints set in DB are already transport offsets
|
//! If creature is on transport, we assume waypoints set in DB are already transport offsets
|
||||||
@@ -159,13 +194,13 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
|||||||
|
|
||||||
//! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call
|
//! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call
|
||||||
//! but formationDest contains global coordinates
|
//! 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
|
//! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table
|
||||||
if (node->orientation && node->delay)
|
if (waypoint.orientation && waypoint.delay)
|
||||||
init.SetFacing(node->orientation);
|
init.SetFacing(waypoint.orientation);
|
||||||
|
|
||||||
switch (node->move_type)
|
switch (waypoint.moveType)
|
||||||
{
|
{
|
||||||
case WAYPOINT_MOVE_TYPE_LAND:
|
case WAYPOINT_MOVE_TYPE_LAND:
|
||||||
init.SetAnimation(Movement::ToGround);
|
init.SetAnimation(Movement::ToGround);
|
||||||
@@ -179,87 +214,122 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
|||||||
case WAYPOINT_MOVE_TYPE_WALK:
|
case WAYPOINT_MOVE_TYPE_WALK:
|
||||||
init.SetWalk(true);
|
init.SetWalk(true);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
init.Launch();
|
init.Launch();
|
||||||
|
|
||||||
// Call for creature group update
|
// inform formation
|
||||||
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
|
creature->SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation && waypoint.delay) ? true : false);
|
||||||
creature->GetFormation()->LeaderMoveTo(formationDest, node->id, node->move_type, (node->orientation && node->delay) ? true : false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 diff)
|
bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 diff)
|
||||||
{
|
{
|
||||||
// Waypoint movement can be switched on/off
|
if (!creature || !creature->IsAlive())
|
||||||
// This is quite handy for escort quests and other stuff
|
|
||||||
if (creature->HasUnitState(UNIT_STATE_NOT_MOVE))
|
|
||||||
{
|
|
||||||
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// prevent a crash at empty waypoint path.
|
|
||||||
if (!i_path || i_path->empty())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Stopped())
|
if (_stalled || creature->HasUnitState(UNIT_STATE_NOT_MOVE) || creature->IsMovementPreventedByCasting())
|
||||||
{
|
{
|
||||||
if (CanMove(diff))
|
creature->StopMoving();
|
||||||
return StartMove(creature);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prevent a crash at empty waypoint path.
|
||||||
|
if (!_path || _path->nodes.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!_nextMoveTime.Passed())
|
||||||
|
{
|
||||||
|
_nextMoveTime.Update(diff);
|
||||||
|
if (_nextMoveTime.Passed())
|
||||||
|
return StartMoveNow(creature);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set home position at place on waypoint movement.
|
// Set home position at place on waypoint movement.
|
||||||
if (!creature->GetTransGUID())
|
if (creature->GetTransGUID().IsEmpty())
|
||||||
creature->SetHomePosition(creature->GetPosition());
|
creature->SetHomePosition(creature->GetPosition());
|
||||||
|
|
||||||
if (creature->IsStopped())
|
if (creature->movespline->Finalized())
|
||||||
Stop(sWorld->getIntConfig(CONFIG_CREATURE_STOP_FOR_PLAYER));
|
|
||||||
else if (creature->movespline->Finalized())
|
|
||||||
{
|
{
|
||||||
OnArrived(creature);
|
OnArrived(creature);
|
||||||
return StartMove(creature);
|
_isArrivalDone = true;
|
||||||
|
|
||||||
|
if (_nextMoveTime.Passed())
|
||||||
|
return StartMove(creature);
|
||||||
|
}
|
||||||
|
else if (_recalculateSpeed)
|
||||||
|
{
|
||||||
|
if (_nextMoveTime.Passed())
|
||||||
|
StartMove(creature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
|
void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
|
||||||
{
|
{
|
||||||
if (creature->AI())
|
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)
|
bool WaypointMovementGenerator<Creature>::GetResetPos(Creature*, float& x, float& y, float& z)
|
||||||
{
|
{
|
||||||
// prevent a crash at empty waypoint path.
|
// prevent a crash at empty waypoint path.
|
||||||
if (!i_path || i_path->empty())
|
if (!_path || _path->nodes.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const WaypointData* node = i_path->at(i_currentNode);
|
WaypointNode const &waypoint = _path->nodes.at(_currentNode);
|
||||||
x = node->x; y = node->y; z = node->z;
|
|
||||||
|
x = waypoint.x;
|
||||||
|
y = waypoint.y;
|
||||||
|
z = waypoint.z;
|
||||||
return true;
|
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
|
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
|
||||||
{
|
{
|
||||||
if (i_currentNode >= i_path.size())
|
if (_currentNode >= _path.size())
|
||||||
return i_path.size();
|
return _path.size();
|
||||||
|
|
||||||
uint32 curMapId = i_path[i_currentNode]->MapID;
|
uint32 curMapId = _path[_currentNode]->MapID;
|
||||||
for (uint32 i = i_currentNode; i < i_path.size(); ++i)
|
for (uint32 itr = _currentNode; itr < _path.size(); ++itr)
|
||||||
if (i_path[i]->MapID != curMapId)
|
if (_path[itr]->MapID != curMapId)
|
||||||
return i;
|
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)
|
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;
|
return p1->MapID != p2->MapID || std::pow(p1->LocX - p2->LocX, 2) + std::pow(p1->LocY - p2->LocY, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ;
|
||||||
@@ -284,24 +354,24 @@ void FlightPathMovementGenerator::LoadPath(Player* player)
|
|||||||
bool passedPreviousSegmentProximityCheck = false;
|
bool passedPreviousSegmentProximityCheck = false;
|
||||||
for (uint32 i = 0; i < nodes.size(); ++i)
|
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)) &&
|
if ((!src || (IsNodeIncludedInShortenedPath(start, nodes[i]) && i >= 2)) &&
|
||||||
(dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1)))
|
(dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1)))
|
||||||
{
|
{
|
||||||
passedPreviousSegmentProximityCheck = true;
|
passedPreviousSegmentProximityCheck = true;
|
||||||
i_path.push_back(nodes[i]);
|
_path.push_back(nodes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i_path.pop_back();
|
_path.pop_back();
|
||||||
--_pointsForPathSwitch.back().PathIndex;
|
--_pointsForPathSwitch.back().PathIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_pointsForPathSwitch.push_back({ uint32(i_path.size() - 1), int32(cost) });
|
_pointsForPathSwitch.push_back({ uint32(_path.size() - 1), int32(cost) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,8 +402,6 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
|
|||||||
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
|
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PLAYER_FLIGHT_SPEED 32.0f
|
|
||||||
|
|
||||||
void FlightPathMovementGenerator::DoReset(Player* player)
|
void FlightPathMovementGenerator::DoReset(Player* player)
|
||||||
{
|
{
|
||||||
player->getHostileRefManager().setOnlineOfflineState(false);
|
player->getHostileRefManager().setOnlineOfflineState(false);
|
||||||
@@ -344,7 +412,7 @@ void FlightPathMovementGenerator::DoReset(Player* player)
|
|||||||
uint32 end = GetPathAtMapEnd();
|
uint32 end = GetPathAtMapEnd();
|
||||||
for (uint32 i = GetCurrentNode(); i != end; ++i)
|
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.Path().push_back(vertice);
|
||||||
}
|
}
|
||||||
init.SetFirstPointId(GetCurrentNode());
|
init.SetFirstPointId(GetCurrentNode());
|
||||||
@@ -359,13 +427,13 @@ void FlightPathMovementGenerator::DoReset(Player* player)
|
|||||||
bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
|
bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
uint32 pointId = (uint32)player->movespline->currentPathIdx();
|
uint32 pointId = (uint32)player->movespline->currentPathIdx();
|
||||||
if (pointId > i_currentNode)
|
if (pointId > _currentNode)
|
||||||
{
|
{
|
||||||
bool departureEvent = true;
|
bool departureEvent = true;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DoEventIfAny(player, i_path[i_currentNode], departureEvent);
|
DoEventIfAny(player, _path[_currentNode], departureEvent);
|
||||||
while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= i_currentNode)
|
while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= _currentNode)
|
||||||
{
|
{
|
||||||
_pointsForPathSwitch.pop_front();
|
_pointsForPathSwitch.pop_front();
|
||||||
player->m_taxi.NextTaxiDestination();
|
player->m_taxi.NextTaxiDestination();
|
||||||
@@ -376,31 +444,30 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointId == i_currentNode)
|
if (pointId == _currentNode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i_currentNode == _preloadTargetNode)
|
if (_currentNode == _preloadTargetNode)
|
||||||
PreloadEndGrid();
|
PreloadEndGrid();
|
||||||
i_currentNode += (uint32)departureEvent;
|
_currentNode += departureEvent ? 1 : 0;
|
||||||
departureEvent = !departureEvent;
|
departureEvent = !departureEvent;
|
||||||
}
|
} while (true);
|
||||||
while (true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i_currentNode < (i_path.size() - 1);
|
return _currentNode < (_path.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
|
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
|
||||||
{
|
{
|
||||||
if (i_path.empty() || i_currentNode >= i_path.size())
|
if (_path.empty() || _currentNode >= _path.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 map0 = i_path[i_currentNode]->MapID;
|
uint32 map0 = _path[_currentNode]->MapID;
|
||||||
for (size_t i = i_currentNode + 1; i < i_path.size(); ++i)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,7 +484,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry
|
|||||||
|
|
||||||
bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float& z)
|
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;
|
x = node->LocX;
|
||||||
y = node->LocY;
|
y = node->LocY;
|
||||||
z = node->LocZ;
|
z = node->LocZ;
|
||||||
@@ -427,12 +494,12 @@ bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float
|
|||||||
void FlightPathMovementGenerator::InitEndGridInfo()
|
void FlightPathMovementGenerator::InitEndGridInfo()
|
||||||
{
|
{
|
||||||
/*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
|
/*! 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. */
|
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.
|
uint32 nodeCount = _path.size(); //! Number of nodes in path.
|
||||||
_endMapId = i_path[nodeCount - 1]->MapID; //! MapId of last node
|
_endMapId = _path[nodeCount - 1]->MapID; //! MapId of last node
|
||||||
_preloadTargetNode = nodeCount - 3;
|
_preloadTargetNode = nodeCount - 3;
|
||||||
_endGridX = i_path[nodeCount - 1]->LocX;
|
_endGridX = _path[nodeCount - 1]->LocX;
|
||||||
_endGridY = i_path[nodeCount - 1]->LocY;
|
_endGridY = _path[nodeCount - 1]->LocY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightPathMovementGenerator::PreloadEndGrid()
|
void FlightPathMovementGenerator::PreloadEndGrid()
|
||||||
@@ -443,7 +510,7 @@ void FlightPathMovementGenerator::PreloadEndGrid()
|
|||||||
// Load the grid
|
// Load the grid
|
||||||
if (endMap)
|
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);
|
endMap->LoadGrid(_endGridX, _endGridY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -19,99 +19,91 @@
|
|||||||
#ifndef TRINITY_WAYPOINTMOVEMENTGENERATOR_H
|
#ifndef TRINITY_WAYPOINTMOVEMENTGENERATOR_H
|
||||||
#define 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 waypoints and flight paths. Each serves the purpose
|
||||||
* of generate activities so that it generates updated
|
* of generate activities so that it generates updated
|
||||||
* packets for the players.
|
* packets for the players.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MovementGenerator.h"
|
|
||||||
#include "Creature.h"
|
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "Player.h"
|
#include "MovementGenerator.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "WaypointManager.h"
|
|
||||||
|
|
||||||
#define FLIGHT_TRAVEL_UPDATE 100
|
class Creature;
|
||||||
#define TIMEDIFF_NEXT_WP 250
|
class Player;
|
||||||
|
struct WaypointPath;
|
||||||
|
|
||||||
template<class T, class P>
|
template<class Entity, class BasePath>
|
||||||
class PathMovementBase
|
class PathMovementBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PathMovementBase() : i_path(), i_currentNode(0) { }
|
PathMovementBase() : _path(), _currentNode(0) { }
|
||||||
virtual ~PathMovementBase() { };
|
virtual ~PathMovementBase() { };
|
||||||
|
|
||||||
uint32 GetCurrentNode() const { return i_currentNode; }
|
uint32 GetCurrentNode() const { return _currentNode; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
P i_path;
|
BasePath _path;
|
||||||
uint32 i_currentNode;
|
uint32 _currentNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class WaypointMovementGenerator;
|
class WaypointMovementGenerator;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium<Creature, WaypointMovementGenerator<Creature>>, public PathMovementBase<Creature, WaypointPath const*>
|
||||||
public PathMovementBase<Creature, WaypointPath const*>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
|
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; }
|
||||||
|
|
||||||
: i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) { }
|
|
||||||
~WaypointMovementGenerator() { i_path = nullptr; }
|
|
||||||
void DoInitialize(Creature*);
|
void DoInitialize(Creature*);
|
||||||
void DoFinalize(Creature*);
|
void DoFinalize(Creature*);
|
||||||
void DoReset(Creature*);
|
void DoReset(Creature*);
|
||||||
bool DoUpdate(Creature*, uint32 diff);
|
bool DoUpdate(Creature*, uint32 diff);
|
||||||
|
|
||||||
void MovementInform(Creature*);
|
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() const override { return WAYPOINT_MOTION_TYPE; }
|
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 MovementInform(Creature*);
|
||||||
void LoadPath(Creature*);
|
|
||||||
|
|
||||||
bool GetResetPos(Creature*, float& x, float& y, float& z);
|
bool GetResetPos(Creature*, float& x, float& y, float& z);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void LoadPath(Creature*);
|
||||||
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 OnArrived(Creature*);
|
void OnArrived(Creature*);
|
||||||
bool StartMove(Creature*);
|
bool StartMove(Creature*);
|
||||||
|
bool CanMove(Creature*);
|
||||||
void StartMoveNow(Creature* creature)
|
bool StartMoveNow(Creature* creature)
|
||||||
{
|
{
|
||||||
i_nextMoveTime.Reset(0);
|
_nextMoveTime.Reset(0);
|
||||||
StartMove(creature);
|
return StartMove(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeTrackerSmall i_nextMoveTime;
|
TimeTrackerSmall _nextMoveTime;
|
||||||
bool m_isArrivalDone;
|
bool _recalculateSpeed;
|
||||||
uint32 path_id;
|
bool _isArrivalDone;
|
||||||
bool repeating;
|
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.
|
* and hence generates ground and activities for the player.
|
||||||
*/
|
*/
|
||||||
class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
class FlightPathMovementGenerator : public MovementGeneratorMedium<Player, FlightPathMovementGenerator>, public PathMovementBase<Player, TaxiPathNodeList>
|
||||||
public PathMovementBase<Player, TaxiPathNodeList>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FlightPathMovementGenerator(uint32 startNode = 0)
|
explicit FlightPathMovementGenerator(uint32 startNode = 0)
|
||||||
{
|
{
|
||||||
i_currentNode = startNode;
|
_currentNode = startNode;
|
||||||
_endGridX = 0.0f;
|
_endGridX = 0.0f;
|
||||||
_endGridY = 0.0f;
|
_endGridY = 0.0f;
|
||||||
_endMapId = 0;
|
_endMapId = 0;
|
||||||
@@ -124,15 +116,14 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig
|
|||||||
bool DoUpdate(Player*, uint32);
|
bool DoUpdate(Player*, uint32);
|
||||||
MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
|
||||||
|
|
||||||
TaxiPathNodeList const& GetPath() { return i_path; }
|
TaxiPathNodeList const& GetPath() { return _path; }
|
||||||
uint32 GetPathAtMapEnd() const;
|
uint32 GetPathAtMapEnd() const;
|
||||||
bool HasArrived() const { return (i_currentNode >= i_path.size()); }
|
bool HasArrived() const { return (_currentNode >= _path.size()); }
|
||||||
void SetCurrentNodeAfterTeleport();
|
void SetCurrentNodeAfterTeleport();
|
||||||
void SkipCurrentNode() { ++i_currentNode; }
|
void SkipCurrentNode() { ++_currentNode; }
|
||||||
void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure);
|
void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure);
|
||||||
|
|
||||||
bool GetResetPos(Player*, float& x, float& y, float& z);
|
bool GetResetPos(Player*, float& x, float& y, float& z);
|
||||||
|
|
||||||
void InitEndGridInfo();
|
void InitEndGridInfo();
|
||||||
void PreloadEndGrid();
|
void PreloadEndGrid();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008-2018 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
|
||||||
@@ -16,27 +16,12 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "WaypointManager.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
#include "GridDefines.h"
|
#include "GridDefines.h"
|
||||||
#include "WaypointManager.h"
|
|
||||||
#include "MapManager.h"
|
#include "MapManager.h"
|
||||||
#include "Log.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()
|
void WaypointMgr::Load()
|
||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
@@ -55,11 +40,7 @@ void WaypointMgr::Load()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
WaypointData* wp = new WaypointData();
|
|
||||||
|
|
||||||
uint32 pathId = fields[0].GetUInt32();
|
uint32 pathId = fields[0].GetUInt32();
|
||||||
WaypointPath& path = _waypointStore[pathId];
|
|
||||||
|
|
||||||
float x = fields[2].GetFloat();
|
float x = fields[2].GetFloat();
|
||||||
float y = fields[3].GetFloat();
|
float y = fields[3].GetFloat();
|
||||||
float z = fields[4].GetFloat();
|
float z = fields[4].GetFloat();
|
||||||
@@ -68,25 +49,27 @@ void WaypointMgr::Load()
|
|||||||
Trinity::NormalizeMapCoord(x);
|
Trinity::NormalizeMapCoord(x);
|
||||||
Trinity::NormalizeMapCoord(y);
|
Trinity::NormalizeMapCoord(y);
|
||||||
|
|
||||||
wp->id = fields[1].GetUInt32();
|
WaypointNode waypoint;
|
||||||
wp->x = x;
|
waypoint.id = fields[1].GetUInt32();
|
||||||
wp->y = y;
|
waypoint.x = x;
|
||||||
wp->z = z;
|
waypoint.y = y;
|
||||||
wp->orientation = o;
|
waypoint.z = z;
|
||||||
wp->move_type = fields[6].GetUInt32();
|
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);
|
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", waypoint.id);
|
||||||
delete wp;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->delay = fields[7].GetUInt32();
|
waypoint.delay = fields[7].GetUInt32();
|
||||||
wp->event_id = fields[8].GetUInt32();
|
waypoint.eventId = fields[8].GetUInt32();
|
||||||
wp->event_chance = fields[9].GetInt16();
|
waypoint.eventChance = fields[9].GetInt16();
|
||||||
|
|
||||||
path.push_back(wp);
|
WaypointPath& path = _waypointStore[pathId];
|
||||||
|
path.id = pathId;
|
||||||
|
path.nodes.push_back(std::move(waypoint));
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
@@ -102,14 +85,9 @@ WaypointMgr* WaypointMgr::instance()
|
|||||||
|
|
||||||
void WaypointMgr::ReloadPath(uint32 id)
|
void WaypointMgr::ReloadPath(uint32 id)
|
||||||
{
|
{
|
||||||
WaypointPathContainer::iterator itr = _waypointStore.find(id);
|
auto itr = _waypointStore.find(id);
|
||||||
if (itr != _waypointStore.end())
|
if (itr != _waypointStore.end())
|
||||||
{
|
|
||||||
for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
|
|
||||||
delete *it;
|
|
||||||
|
|
||||||
_waypointStore.erase(itr);
|
_waypointStore.erase(itr);
|
||||||
}
|
|
||||||
|
|
||||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID);
|
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID);
|
||||||
|
|
||||||
@@ -120,13 +98,10 @@ void WaypointMgr::ReloadPath(uint32 id)
|
|||||||
if (!result)
|
if (!result)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WaypointPath& path = _waypointStore[id];
|
std::vector<WaypointNode> values;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
WaypointData* wp = new WaypointData();
|
|
||||||
|
|
||||||
float x = fields[1].GetFloat();
|
float x = fields[1].GetFloat();
|
||||||
float y = fields[2].GetFloat();
|
float y = fields[2].GetFloat();
|
||||||
float z = fields[3].GetFloat();
|
float z = fields[3].GetFloat();
|
||||||
@@ -135,26 +110,36 @@ void WaypointMgr::ReloadPath(uint32 id)
|
|||||||
Trinity::NormalizeMapCoord(x);
|
Trinity::NormalizeMapCoord(x);
|
||||||
Trinity::NormalizeMapCoord(y);
|
Trinity::NormalizeMapCoord(y);
|
||||||
|
|
||||||
wp->id = fields[0].GetUInt32();
|
WaypointNode waypoint;
|
||||||
wp->x = x;
|
waypoint.id = fields[0].GetUInt32();
|
||||||
wp->y = y;
|
waypoint.x = x;
|
||||||
wp->z = z;
|
waypoint.y = y;
|
||||||
wp->orientation = o;
|
waypoint.z = z;
|
||||||
wp->move_type = fields[5].GetUInt32();
|
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);
|
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", waypoint.id);
|
||||||
delete wp;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->delay = fields[6].GetUInt32();
|
waypoint.delay = fields[6].GetUInt32();
|
||||||
wp->event_id = fields[7].GetUInt32();
|
waypoint.eventId = fields[7].GetUInt32();
|
||||||
wp->event_chance = fields[8].GetUInt8();
|
waypoint.eventChance = fields[8].GetUInt8();
|
||||||
|
|
||||||
path.push_back(wp);
|
|
||||||
|
|
||||||
|
values.push_back(std::move(waypoint));
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
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;
|
||||||
}
|
}
|
||||||
@@ -19,31 +19,9 @@
|
|||||||
#ifndef TRINITY_WAYPOINTMANAGER_H
|
#ifndef TRINITY_WAYPOINTMANAGER_H
|
||||||
#define TRINITY_WAYPOINTMANAGER_H
|
#define TRINITY_WAYPOINTMANAGER_H
|
||||||
|
|
||||||
|
#include "WaypointDefines.h"
|
||||||
#include <vector>
|
#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 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
|
class TC_GAME_API WaypointMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -56,20 +34,12 @@ class TC_GAME_API WaypointMgr
|
|||||||
void Load();
|
void Load();
|
||||||
|
|
||||||
// Returns the path from a given id
|
// Returns the path from a given id
|
||||||
WaypointPath const* GetPath(uint32 id) const
|
WaypointPath const* GetPath(uint32 id) const;
|
||||||
{
|
|
||||||
WaypointPathContainer::const_iterator itr = _waypointStore.find(id);
|
|
||||||
if (itr != _waypointStore.end())
|
|
||||||
return &itr->second;
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WaypointMgr();
|
WaypointMgr() { }
|
||||||
~WaypointMgr();
|
|
||||||
|
|
||||||
WaypointPathContainer _waypointStore;
|
std::unordered_map<uint32, WaypointPath> _waypointStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sWaypointMgr WaypointMgr::instance()
|
#define sWaypointMgr WaypointMgr::instance()
|
||||||
|
|||||||
@@ -37,17 +37,17 @@ void SystemMgr::LoadScriptWaypoints()
|
|||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
// Drop Existing Waypoint list
|
// drop Existing Waypoint list
|
||||||
m_mPointMoveMap.clear();
|
_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");
|
QueryResult result = WorldDatabase.Query("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
|
||||||
if (result)
|
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
|
// 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");
|
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
|
do
|
||||||
{
|
{
|
||||||
Field* pFields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
ScriptPointMove temp;
|
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();
|
||||||
|
|
||||||
temp.uiCreatureEntry = pFields[0].GetUInt32();
|
CreatureTemplate const* info = sObjectMgr->GetCreatureTemplate(entry);
|
||||||
uint32 uiEntry = temp.uiCreatureEntry;
|
if (!info)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pCInfo->ScriptID)
|
if (!info->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);
|
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;
|
++count;
|
||||||
} while (result->NextRow());
|
} 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
|
std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(uint32 entry, uint16 chainId) const
|
||||||
{
|
{
|
||||||
auto it = m_mSplineChainsMap.find({ entry, chainId });
|
auto it = m_mSplineChainsMap.find({ entry, chainId });
|
||||||
|
|||||||
@@ -21,55 +21,34 @@
|
|||||||
|
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Creature;
|
class Creature;
|
||||||
struct SplineChainLink;
|
struct SplineChainLink;
|
||||||
|
|
||||||
struct ScriptPointMove
|
|
||||||
{
|
|
||||||
uint32 uiCreatureEntry;
|
|
||||||
uint32 uiPointId;
|
|
||||||
float fX;
|
|
||||||
float fY;
|
|
||||||
float fZ;
|
|
||||||
uint32 uiWaitTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<ScriptPointMove> ScriptPointVector;
|
|
||||||
|
|
||||||
class TC_GAME_API SystemMgr
|
class TC_GAME_API SystemMgr
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
SystemMgr();
|
|
||||||
~SystemMgr();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SystemMgr* instance();
|
static SystemMgr* instance();
|
||||||
|
|
||||||
typedef std::unordered_map<uint32, ScriptPointVector> PointMoveMap;
|
// database
|
||||||
|
|
||||||
//Database
|
|
||||||
void LoadScriptWaypoints();
|
void LoadScriptWaypoints();
|
||||||
void LoadScriptSplineChains();
|
void LoadScriptSplineChains();
|
||||||
|
|
||||||
ScriptPointVector const* GetPointMoveList(uint32 creatureEntry) const
|
WaypointPath const* GetPath(uint32 creatureEntry) const;
|
||||||
{
|
|
||||||
PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry);
|
|
||||||
|
|
||||||
if (itr == m_mPointMoveMap.end())
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return &itr->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const;
|
std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const;
|
||||||
std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const;
|
std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
|
|
||||||
typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
|
typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
|
||||||
|
|
||||||
|
SystemMgr();
|
||||||
|
~SystemMgr();
|
||||||
|
|
||||||
|
std::unordered_map<uint32, WaypointPath> _waypointStore;
|
||||||
std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains
|
std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
#include "VMapFactory.h"
|
#include "VMapFactory.h"
|
||||||
#include "VMapManager2.h"
|
#include "VMapManager2.h"
|
||||||
#include "WardenCheckMgr.h"
|
#include "WardenCheckMgr.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointManager.h"
|
||||||
#include "WeatherMgr.h"
|
#include "WeatherMgr.h"
|
||||||
#include "WhoListStorage.h"
|
#include "WhoListStorage.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ EndScriptData */
|
|||||||
#include "PhasingHandler.h"
|
#include "PhasingHandler.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "RBAC.h"
|
#include "RBAC.h"
|
||||||
|
#include "WaypointDefines.h"
|
||||||
#include "WaypointManager.h"
|
#include "WaypointManager.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -571,9 +571,9 @@ Position const RazPathCorla[] =
|
|||||||
{ 273.4479f, 816.1007f, 95.95034f }
|
{ 273.4479f, 816.1007f, 95.95034f }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct npc_raz_the_crazed : public npc_escortAI
|
struct npc_raz_the_crazed : public EscortAI
|
||||||
{
|
{
|
||||||
npc_raz_the_crazed(Creature* creature) : npc_escortAI(creature), _instance(creature->GetInstanceScript())
|
npc_raz_the_crazed(Creature* creature) : EscortAI(creature), _instance(creature->GetInstanceScript())
|
||||||
{
|
{
|
||||||
SetCombatMovement(false);
|
SetCombatMovement(false);
|
||||||
}
|
}
|
||||||
@@ -627,7 +627,7 @@ struct npc_raz_the_crazed : public npc_escortAI
|
|||||||
AddWaypoint(i, RazPathCorla[i].GetPositionX(), RazPathCorla[i].GetPositionY(), RazPathCorla[i].GetPositionZ());
|
AddWaypoint(i, RazPathCorla[i].GetPositionX(), RazPathCorla[i].GetPositionY(), RazPathCorla[i].GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 id) override
|
void WaypointReached(uint32 id, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (id == 10 && _instance->GetData(DATA_RAZ_LAST_AREA_INDEX) == RAZ_AREA_INDEX_ROMOGG)
|
if (id == 10 && _instance->GetData(DATA_RAZ_LAST_AREA_INDEX) == RAZ_AREA_INDEX_ROMOGG)
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-10
@@ -129,9 +129,9 @@ class npc_grimstone : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_grimstone() : CreatureScript("npc_grimstone") { }
|
npc_grimstone() : CreatureScript("npc_grimstone") { }
|
||||||
|
|
||||||
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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
MobDeath_Timer = 2500;
|
MobDeath_Timer = 2500;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -343,7 +343,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CanWalk)
|
if (CanWalk)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -509,9 +509,9 @@ class npc_rocknot : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_rocknot() : CreatureScript("npc_rocknot") { }
|
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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -542,7 +542,7 @@ class npc_rocknot : public CreatureScript
|
|||||||
go->SetGoState((GOState)state);
|
go->SetGoState((GOState)state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -598,7 +598,7 @@ class npc_rocknot : public CreatureScript
|
|||||||
else BreakDoor_Timer -= diff;
|
else BreakDoor_Timer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestReward(Player* /*player*/, Quest const* quest, uint32 /*opt*/) override
|
void QuestReward(Player* /*player*/, Quest const* quest, uint32 /*opt*/) override
|
||||||
@@ -623,8 +623,7 @@ class npc_rocknot : public CreatureScript
|
|||||||
me->AI()->Talk(SAY_GOT_BEER);
|
me->AI()->Talk(SAY_GOT_BEER);
|
||||||
me->CastSpell(me, SPELL_DRUNKEN_RAGE, false);
|
me->CastSpell(me, SPELL_DRUNKEN_RAGE, false);
|
||||||
|
|
||||||
if (npc_escortAI* escortAI = CAST_AI(npc_rocknot::npc_rocknotAI, me->AI()))
|
Start(false, false);
|
||||||
escortAI->Start(false, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ class npc_blastmaster_emi_shortfuse : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_blastmaster_emi_shortfuse() : CreatureScript("npc_blastmaster_emi_shortfuse") { }
|
npc_blastmaster_emi_shortfuse() : CreatureScript("npc_blastmaster_emi_shortfuse") { }
|
||||||
|
|
||||||
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();
|
instance = creature->GetInstanceScript();
|
||||||
creature->RestoreFaction();
|
creature->RestoreFaction();
|
||||||
@@ -221,7 +221,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
//just in case
|
//just in case
|
||||||
if (GetPlayerForEscort())
|
if (GetPlayerForEscort())
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ class npc_barnes : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_barnes() : CreatureScript("npc_barnes") { }
|
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();
|
Initialize();
|
||||||
RaidWiped = false;
|
RaidWiped = false;
|
||||||
@@ -184,7 +184,7 @@ public:
|
|||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override { }
|
void JustEngagedWith(Unit* /*who*/) override { }
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -288,7 +288,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (HasEscortState(STATE_ESCORT_PAUSED))
|
if (HasEscortState(STATE_ESCORT_PAUSED))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1110,9 +1110,9 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { }
|
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();
|
Initialize();
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
@@ -1141,7 +1141,7 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
|
|
||||||
void InitWaypoint()
|
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(2, 2341.812012f, -5900.484863f, 102.619743f);
|
||||||
AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
|
AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
|
||||||
AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
|
AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
|
||||||
@@ -1160,7 +1160,7 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
|
AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
|
||||||
AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
|
AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
|
||||||
AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f);
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -1168,7 +1168,7 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
|
AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
|
||||||
AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
|
AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
|
||||||
AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,7 +1179,7 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
SetDespawnAtFar(false);
|
SetDespawnAtFar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -1229,7 +1229,7 @@ class npc_scarlet_miner : public CreatureScript
|
|||||||
else
|
else
|
||||||
IntroTimer -= diff;
|
IntroTimer -= diff;
|
||||||
}
|
}
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ class npc_koltira_deathweaver : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_koltira_deathweaver() : CreatureScript("npc_koltira_deathweaver") { }
|
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();
|
Initialize();
|
||||||
me->SetReactState(REACT_DEFENSIVE);
|
me->SetReactState(REACT_DEFENSIVE);
|
||||||
@@ -228,7 +228,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -281,7 +281,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (HasEscortState(STATE_ESCORT_PAUSED))
|
if (HasEscortState(STATE_ESCORT_PAUSED))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -278,9 +278,9 @@ public:
|
|||||||
return new npc_highlord_darion_mograineAI(creature);
|
return new npc_highlord_darion_mograineAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
Reset();
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ public:
|
|||||||
SetEscortPaused(bOnHold);
|
SetEscortPaused(bOnHold);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -575,12 +575,12 @@ public:
|
|||||||
void EnterEvadeMode(EvadeReason why) override
|
void EnterEvadeMode(EvadeReason why) override
|
||||||
{
|
{
|
||||||
if (!bIsBattle)//do not reset self if we are in battle
|
if (!bIsBattle)//do not reset self if we are in battle
|
||||||
npc_escortAI::EnterEvadeMode(why);
|
EscortAI::EnterEvadeMode(why);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!bIsBattle)
|
if (!bIsBattle)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -149,9 +149,9 @@ public:
|
|||||||
return new npc_scarlet_traineeAI(creature);
|
return new 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);
|
Start_Timer = urand(1000, 6000);
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,6 @@ public:
|
|||||||
uint32 Start_Timer;
|
uint32 Start_Timer;
|
||||||
|
|
||||||
void Reset() override { }
|
void Reset() override { }
|
||||||
void WaypointReached(uint32 /*waypointId*/) override { }
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override { }
|
void JustEngagedWith(Unit* /*who*/) override { }
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
@@ -173,7 +172,7 @@ public:
|
|||||||
} else Start_Timer -= diff;
|
} else Start_Timer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ class npc_professor_phizzlethorpe : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_professor_phizzlethorpe() : CreatureScript("npc_professor_phizzlethorpe") { }
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -112,7 +112,7 @@ class npc_professor_phizzlethorpe : public CreatureScript
|
|||||||
if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE)
|
if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE)
|
||||||
{
|
{
|
||||||
Talk(SAY_PROGRESS_1, player);
|
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);
|
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ class npc_professor_phizzlethorpe : public CreatureScript
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMap events;
|
EventMap events;
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ class npc_ranger_lilatha : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { }
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ class npc_oox09hl : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_oox09hl() : CreatureScript("npc_oox09hl") { }
|
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 { }
|
void Reset() override { }
|
||||||
|
|
||||||
@@ -79,11 +79,11 @@ public:
|
|||||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
me->SetFaction(player->GetTeam() == ALLIANCE ? FACTION_ESCORTEE_A_PASSIVE : FACTION_ESCORTEE_H_PASSIVE);
|
me->SetFaction(player->GetTeam() == ALLIANCE ? FACTION_ESCORTEE_A_PASSIVE : FACTION_ESCORTEE_H_PASSIVE);
|
||||||
Talk(SAY_OOX_START, player);
|
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)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointStart(uint32 pointId) override
|
void WaypointStarted(uint32 pointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (pointId)
|
switch (pointId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ class npc_deathstalker_erland : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_deathstalker_erland() : CreatureScript("npc_deathstalker_erland") { }
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ public:
|
|||||||
return new npc_tapoke_slim_jahnAI(creature);
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -222,16 +222,16 @@ class npc_morridune : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_morridune() : CreatureScript("npc_morridune") { }
|
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);
|
Talk(SAY_MORRIDUNE_1);
|
||||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||||
Start(false);
|
Start(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
Talk(SAY_ONSLAY);
|
Talk(SAY_ONSLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7)
|
if (waypointId == 7)
|
||||||
{
|
{
|
||||||
@@ -115,8 +115,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
//Must update npc_escortAI
|
//Must update EscortAI
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
go = true;
|
go = true;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
Talk(SAY_ONSLAY);
|
Talk(SAY_ONSLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && instance)
|
if (waypointId == 7 && instance)
|
||||||
{
|
{
|
||||||
@@ -119,8 +119,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
//Must update npc_escortAI
|
//Must update EscortAI
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
go = true;
|
go = true;
|
||||||
@@ -219,10 +219,6 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit* who) override
|
void MoveInLineOfSight(Unit* who) override
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
Talk(SAY_ONSLAY);
|
Talk(SAY_ONSLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && instance)
|
if (waypointId == 7 && instance)
|
||||||
{
|
{
|
||||||
@@ -114,8 +114,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
//Must update npc_escortAI
|
//Must update EscortAI
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
go = true;
|
go = true;
|
||||||
|
|||||||
+3
-3
@@ -86,7 +86,7 @@ public:
|
|||||||
Talk(SAY_ONSLAY);
|
Talk(SAY_ONSLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && instance)
|
if (waypointId == 7 && instance)
|
||||||
{
|
{
|
||||||
@@ -108,8 +108,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
//Must update npc_escortAI
|
//Must update EscortAI
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
go = true;
|
go = true;
|
||||||
|
|||||||
@@ -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}
|
{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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -448,7 +448,7 @@ void hyjalAI::MoveInLineOfSight(Unit* who)
|
|||||||
if (IsDummy)
|
if (IsDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
npc_escortAI::MoveInLineOfSight(who);
|
EscortAI::MoveInLineOfSight(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
|
void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
|
||||||
@@ -932,7 +932,7 @@ void hyjalAI::RespawnNearPos(float x, float y)
|
|||||||
Cell::VisitGridObjects(x, y, me->GetMap(), worker, me->GetGridActivationRange());
|
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))
|
if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
|
||||||
{
|
{
|
||||||
@@ -981,7 +981,7 @@ void hyjalAI::WaypointReached(uint32 waypointId)
|
|||||||
}
|
}
|
||||||
void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
|
void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (WaitForTeleport)
|
if (WaitForTeleport)
|
||||||
{
|
{
|
||||||
if (TeleportTimer <= diff)
|
if (TeleportTimer <= diff)
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ enum YellId
|
|||||||
DEATH = 6, // Used on death
|
DEATH = 6, // Used on death
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hyjalAI : public npc_escortAI
|
struct hyjalAI : public EscortAI
|
||||||
{
|
{
|
||||||
hyjalAI(Creature* creature);
|
hyjalAI(Creature* creature);
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ struct hyjalAI : public npc_escortAI
|
|||||||
void SummonedCreatureDespawn(Creature* summoned) override;
|
void SummonedCreatureDespawn(Creature* summoned) override;
|
||||||
void HideNearPos(float x, float y);
|
void HideNearPos(float x, float y);
|
||||||
void RespawnNearPos(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 DoOverrun(uint32 faction, const uint32 diff);
|
||||||
void MoveInLineOfSight(Unit* who) override;
|
void MoveInLineOfSight(Unit* who) override;
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,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
|
{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();
|
instance = creature->GetInstanceScript();
|
||||||
IsEvent = false;
|
IsEvent = false;
|
||||||
@@ -442,7 +442,7 @@ public:
|
|||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override { }
|
void JustEngagedWith(Unit* /*who*/) override { }
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 0 && !IsOverrun)
|
if (waypointId == 0 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -495,7 +495,7 @@ public:
|
|||||||
if (!CanMove)return;
|
if (!CanMove)return;
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -550,7 +550,7 @@ public:
|
|||||||
KnockDownTimer = 10000;
|
KnockDownTimer = 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -583,7 +583,7 @@ public:
|
|||||||
{
|
{
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -648,7 +648,7 @@ public:
|
|||||||
RandomMove = false;
|
RandomMove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -682,7 +682,7 @@ public:
|
|||||||
{
|
{
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -758,7 +758,7 @@ public:
|
|||||||
summons.Despawn(summon);
|
summons.Despawn(summon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -802,7 +802,7 @@ public:
|
|||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
@@ -870,7 +870,7 @@ public:
|
|||||||
ShellTimer = 50000 + rand32() % 10000;
|
ShellTimer = 50000 + rand32() % 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -895,7 +895,7 @@ public:
|
|||||||
{
|
{
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -965,7 +965,7 @@ public:
|
|||||||
WebTimer = 20000 + rand32() % 5000;
|
WebTimer = 20000 + rand32() % 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -990,7 +990,7 @@ public:
|
|||||||
{
|
{
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -1050,7 +1050,7 @@ public:
|
|||||||
ManaBurnTimer = 9000 + rand32() % 5000;
|
ManaBurnTimer = 9000 + rand32() % 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 7 && !IsOverrun)
|
if (waypointId == 7 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -1075,7 +1075,7 @@ public:
|
|||||||
{
|
{
|
||||||
hyjal_trashAI::UpdateAI(diff);
|
hyjal_trashAI::UpdateAI(diff);
|
||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
{
|
{
|
||||||
if (!go)
|
if (!go)
|
||||||
@@ -1143,7 +1143,7 @@ public:
|
|||||||
me->SetDisableGravity(true);
|
me->SetDisableGravity(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 2 && !IsOverrun)
|
if (waypointId == 2 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -1177,7 +1177,7 @@ public:
|
|||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
{
|
{
|
||||||
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
|
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
@@ -1264,7 +1264,7 @@ public:
|
|||||||
me->SetDisableGravity(true);
|
me->SetDisableGravity(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 2 && !IsOverrun)
|
if (waypointId == 2 && !IsOverrun)
|
||||||
{
|
{
|
||||||
@@ -1294,7 +1294,7 @@ public:
|
|||||||
if (IsEvent || IsOverrun)
|
if (IsEvent || IsOverrun)
|
||||||
{
|
{
|
||||||
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
|
ENSURE_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEvent)
|
if (IsEvent)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "hyjal.h"
|
#include "hyjal.h"
|
||||||
#include "ScriptedEscortAI.h"
|
#include "ScriptedEscortAI.h"
|
||||||
|
|
||||||
struct hyjal_trashAI : public npc_escortAI
|
struct hyjal_trashAI : public EscortAI
|
||||||
{
|
{
|
||||||
hyjal_trashAI(Creature* creature);
|
hyjal_trashAI(Creature* creature);
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -258,9 +258,9 @@ class npc_arthas : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_arthas() : CreatureScript("npc_arthas") { }
|
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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -336,7 +336,7 @@ public:
|
|||||||
void AttackStart(Unit* who) override
|
void AttackStart(Unit* who) override
|
||||||
{
|
{
|
||||||
if (who && !who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
|
if (who && !who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
|
||||||
npc_escortAI::AttackStart(who);
|
EscortAI::AttackStart(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
@@ -391,7 +391,7 @@ public:
|
|||||||
++step;
|
++step;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -511,7 +511,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (bStepping)
|
if (bStepping)
|
||||||
{
|
{
|
||||||
@@ -901,7 +901,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (instance->GetBossState(bossEvent) == FAIL)
|
else if (instance->GetBossState(bossEvent) == FAIL)
|
||||||
npc_escortAI::EnterEvadeMode();
|
EscortAI::EnterEvadeMode();
|
||||||
else
|
else
|
||||||
phaseTimer = 10000;
|
phaseTimer = 10000;
|
||||||
break;
|
break;
|
||||||
@@ -1061,7 +1061,7 @@ public:
|
|||||||
JumpToNextStep(15000);
|
JumpToNextStep(15000);
|
||||||
}
|
}
|
||||||
else if (instance->GetBossState(DATA_EPOCH) == FAIL)
|
else if (instance->GetBossState(DATA_EPOCH) == FAIL)
|
||||||
npc_escortAI::EnterEvadeMode();
|
EscortAI::EnterEvadeMode();
|
||||||
else
|
else
|
||||||
phaseTimer = 10000;
|
phaseTimer = 10000;
|
||||||
break;
|
break;
|
||||||
@@ -1106,7 +1106,7 @@ public:
|
|||||||
JumpToNextStep(1000);
|
JumpToNextStep(1000);
|
||||||
}
|
}
|
||||||
else if (instance->GetBossState(DATA_MAL_GANIS) == FAIL)
|
else if (instance->GetBossState(DATA_MAL_GANIS) == FAIL)
|
||||||
npc_escortAI::EnterEvadeMode();
|
EscortAI::EnterEvadeMode();
|
||||||
else
|
else
|
||||||
phaseTimer = 10000;
|
phaseTimer = 10000;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -198,9 +198,9 @@ class npc_thrall_old_hillsbrad : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_thrall_old_hillsbrad() : CreatureScript("npc_thrall_old_hillsbrad") { }
|
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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -438,7 +438,7 @@ public:
|
|||||||
if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA)))
|
if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TARETHA)))
|
||||||
{
|
{
|
||||||
if (Player* player = GetPlayerForEscort())
|
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
|
//kill credit Creature for quest
|
||||||
@@ -539,7 +539,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -576,9 +576,9 @@ class npc_taretha : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_taretha() : CreatureScript("npc_taretha") { }
|
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();
|
instance = creature->GetInstanceScript();
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -641,7 +641,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ class npc_willix : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_willix() : CreatureScript("npc_willix") { }
|
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
|
void QuestAccept(Player* player, Quest const* quest) override
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 pathId) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ class npc_disciple_of_naralex : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { }
|
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();
|
instance = creature->GetInstanceScript();
|
||||||
eventTimer = 0;
|
eventTimer = 0;
|
||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -185,7 +185,7 @@ public:
|
|||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (currentEvent != DATA_NARALEX_PART3)
|
if (currentEvent != DATA_NARALEX_PART3)
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (eventTimer <= diff)
|
if (eventTimer <= diff)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class npc_ruul_snowhoof : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
|
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
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -85,11 +85,11 @@ public:
|
|||||||
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
|
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
|
||||||
{
|
{
|
||||||
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -180,9 +180,9 @@ class npc_muglash : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_muglash() : CreatureScript("npc_muglash") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -228,11 +228,11 @@ public:
|
|||||||
{
|
{
|
||||||
Talk(SAY_MUG_START1);
|
Talk(SAY_MUG_START1);
|
||||||
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
|
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())
|
if (Player* player = GetPlayerForEscort())
|
||||||
{
|
{
|
||||||
@@ -290,7 +290,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!me->GetVictim())
|
if (!me->GetVictim())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -347,9 +347,9 @@ class npc_magwin : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_magwin() : CreatureScript("npc_magwin") { }
|
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
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -370,7 +370,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (Player* player = GetPlayerForEscort())
|
if (Player* player = GetPlayerForEscort())
|
||||||
{
|
{
|
||||||
@@ -409,7 +409,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case EVENT_START_ESCORT:
|
case EVENT_START_ESCORT:
|
||||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
|
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));
|
_events.ScheduleEvent(EVENT_STAND, Seconds(2));
|
||||||
break;
|
break;
|
||||||
case EVENT_STAND: // Remove kneel standstate. Using a separate delayed event because it causes unwanted delay before starting waypoint movement.
|
case EVENT_STAND: // Remove kneel standstate. Using a separate delayed event because it causes unwanted delay before starting waypoint movement.
|
||||||
@@ -427,7 +427,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
npc_escortAI::UpdateEscortAI(diff);
|
EscortAI::UpdateEscortAI(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -362,9 +362,9 @@ class npc_demolitionist_legoso : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_demolitionist_legoso() : CreatureScript("npc_demolitionist_legoso") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -473,7 +473,7 @@ public:
|
|||||||
if (HasEscortState(STATE_ESCORT_NONE))
|
if (HasEscortState(STATE_ESCORT_NONE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (_phase)
|
if (_phase)
|
||||||
{
|
{
|
||||||
@@ -717,7 +717,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -72,11 +72,11 @@ public:
|
|||||||
return new npc_custodian_of_timeAI(creature);
|
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 /*override*/) override
|
||||||
{
|
{
|
||||||
if (Player* player = GetPlayerForEscort())
|
if (Player* player = GetPlayerForEscort())
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,9 +200,9 @@ public:
|
|||||||
return new npc_OOX17AI(creature);
|
return new npc_OOX17AI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 QuestAccept(Player* player, Quest const* quest) override
|
void QuestAccept(Player* player, Quest const* quest) override
|
||||||
{
|
{
|
||||||
@@ -217,7 +217,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (Player* player = GetPlayerForEscort())
|
if (Player* player = GetPlayerForEscort())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ public:
|
|||||||
return new npc_giltharesAI(creature);
|
return new npc_giltharesAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 QuestAccept(Player* player, const Quest* quest) override
|
void QuestAccept(Player* player, const Quest* quest) override
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
|
|
||||||
void Reset() override { }
|
void Reset() override { }
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -530,9 +530,9 @@ class npc_wizzlecrank_shredder : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_wizzlecrank_shredder() : CreatureScript("npc_wizzlecrank_shredder") { }
|
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;
|
IsPostEvent = false;
|
||||||
PostEventTimer = 1000;
|
PostEventTimer = 1000;
|
||||||
@@ -544,7 +544,7 @@ public:
|
|||||||
uint32 PostEventTimer;
|
uint32 PostEventTimer;
|
||||||
uint32 PostEventCount;
|
uint32 PostEventCount;
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -567,7 +567,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointStart(uint32 PointId) override
|
void WaypointStarted(uint32 PointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
|
|
||||||
|
|||||||
@@ -268,9 +268,9 @@ public:
|
|||||||
return new npc_ranshallaAI(creature);
|
return new npc_ranshallaAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct npc_ranshallaAI : public npc_escortAI, private DialogueHelper
|
struct npc_ranshallaAI : public EscortAI, private DialogueHelper
|
||||||
{
|
{
|
||||||
npc_ranshallaAI(Creature* creature) : npc_escortAI(creature),
|
npc_ranshallaAI(Creature* creature) : EscortAI(creature),
|
||||||
DialogueHelper(introDialogue)
|
DialogueHelper(introDialogue)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
@@ -365,7 +365,7 @@ public:
|
|||||||
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
|
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 pointId) override
|
void WaypointReached(uint32 pointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (pointId)
|
switch (pointId)
|
||||||
{
|
{
|
||||||
@@ -552,7 +552,7 @@ public:
|
|||||||
if (events.ExecuteEvent() == EVENT_RESUME)
|
if (events.ExecuteEvent() == EVENT_RESUME)
|
||||||
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
|
StartNextDialogueText(SAY_PRIESTESS_ALTAR_3);
|
||||||
|
|
||||||
npc_escortAI::UpdateEscortAI(diff);
|
EscortAI::UpdateEscortAI(diff);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
EventMap events;
|
EventMap events;
|
||||||
|
|||||||
+4
-4
@@ -505,9 +505,9 @@ public:
|
|||||||
npc_argent_soldier() : CreatureScript("npc_argent_soldier") { }
|
npc_argent_soldier() : CreatureScript("npc_argent_soldier") { }
|
||||||
|
|
||||||
// THIS AI NEEDS MORE IMPROVEMENTS
|
// 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();
|
instance = creature->GetInstanceScript();
|
||||||
me->SetReactState(REACT_DEFENSIVE);
|
me->SetReactState(REACT_DEFENSIVE);
|
||||||
@@ -519,7 +519,7 @@ public:
|
|||||||
|
|
||||||
uint8 uiWaypoint;
|
uint8 uiWaypoint;
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*path*/) override
|
||||||
{
|
{
|
||||||
if (waypointId == 0)
|
if (waypointId == 0)
|
||||||
{
|
{
|
||||||
@@ -592,7 +592,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|||||||
+4
-4
@@ -354,18 +354,18 @@ class npc_black_knight_skeletal_gryphon : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") { }
|
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);
|
Start(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override { }
|
void WaypointReached(uint32 /*waypointId*/, uint32 /*pathId*/) override { }
|
||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
UpdateVictim();
|
UpdateVictim();
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -152,9 +152,9 @@ class generic_vehicleAI_toc5 : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
generic_vehicleAI_toc5() : CreatureScript("generic_vehicleAI_toc5") { }
|
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();
|
Initialize();
|
||||||
SetDespawnAtEnd(false);
|
SetDespawnAtEnd(false);
|
||||||
@@ -212,7 +212,7 @@ public:
|
|||||||
Start(false, true);
|
Start(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -964,9 +964,9 @@ class npc_crok_scourgebane : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_crok_scourgebane() : CreatureScript("npc_crok_scourgebane") { }
|
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()),
|
_instance(creature->GetInstanceScript()), _respawnTime(creature->GetRespawnDelay()),
|
||||||
_corpseDelay(creature->GetCorpseDelay())
|
_corpseDelay(creature->GetCorpseDelay())
|
||||||
{
|
{
|
||||||
@@ -1048,7 +1048,7 @@ class npc_crok_scourgebane : public CreatureScript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -1080,7 +1080,7 @@ class npc_crok_scourgebane : public CreatureScript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointStart(uint32 waypointId) override
|
void WaypointStarted(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
_currentWPid = waypointId;
|
_currentWPid = waypointId;
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
|
|||||||
@@ -271,9 +271,9 @@ class npc_brann_hos : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_brann_hos() : CreatureScript("npc_brann_hos") { }
|
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();
|
Initialize();
|
||||||
instance = creature->GetInstanceScript();
|
instance = creature->GetInstanceScript();
|
||||||
@@ -350,7 +350,7 @@ public:
|
|||||||
lDwarfGUIDList.clear();
|
lDwarfGUIDList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -973,9 +973,9 @@ class npc_mimirons_inferno : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_mimirons_inferno() : CreatureScript("npc_mimirons_inferno") { }
|
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();
|
Initialize();
|
||||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||||
@@ -988,7 +988,7 @@ public:
|
|||||||
infernoTimer = 2000;
|
infernoTimer = 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override
|
void WaypointReached(uint32 /*waypointId*/, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1002,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!HasEscortState(STATE_ESCORT_ESCORTING))
|
if (!HasEscortState(STATE_ESCORT_ESCORTING))
|
||||||
Start(false, true, ObjectGuid::Empty, nullptr, false, true);
|
Start(false, true, ObjectGuid::Empty, nullptr, false, true);
|
||||||
|
|||||||
@@ -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();
|
_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)
|
if (waypointId == _lastWaypointId)
|
||||||
CreatureStartAttackDoor();
|
CreatureStartAttackDoor();
|
||||||
@@ -906,7 +906,7 @@ struct violet_hold_trashAI : public npc_escortAI
|
|||||||
|
|
||||||
void JustEngagedWith(Unit* who) override
|
void JustEngagedWith(Unit* who) override
|
||||||
{
|
{
|
||||||
npc_escortAI::JustEngagedWith(who);
|
EscortAI::JustEngagedWith(who);
|
||||||
ScheduledTasks();
|
ScheduledTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,7 +919,7 @@ struct violet_hold_trashAI : public npc_escortAI
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_scheduler.Update(diff,
|
_scheduler.Update(diff,
|
||||||
std::bind(&npc_escortAI::DoMeleeAttackIfReady, this));
|
std::bind(&EscortAI::DoMeleeAttackIfReady, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ScheduledTasks() { }
|
virtual void ScheduledTasks() { }
|
||||||
|
|||||||
@@ -573,9 +573,9 @@ class npc_lurgglbr : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_lurgglbr() : CreatureScript("npc_lurgglbr") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -595,7 +595,7 @@ class npc_lurgglbr : public CreatureScript
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -660,7 +660,7 @@ class npc_lurgglbr : public CreatureScript
|
|||||||
}
|
}
|
||||||
} else IntroTimer -= diff;
|
} else IntroTimer -= diff;
|
||||||
}
|
}
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -794,9 +794,9 @@ class npc_thassarian : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_thassarian() : CreatureScript("npc_thassarian") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -838,7 +838,7 @@ public:
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -873,7 +873,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (arthasInPosition && talbotInPosition)
|
if (arthasInPosition && talbotInPosition)
|
||||||
{
|
{
|
||||||
@@ -1642,9 +1642,9 @@ class npc_mootoo_the_younger : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_mootoo_the_younger() : CreatureScript("npc_mootoo_the_younger") { }
|
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 QuestAccept(Player* player, Quest const* quest) override
|
void QuestAccept(Player* player, Quest const* quest) override
|
||||||
{
|
{
|
||||||
@@ -1676,7 +1676,7 @@ public:
|
|||||||
player->FailQuest(QUEST_ESCAPING_THE_MIST);
|
player->FailQuest(QUEST_ESCAPING_THE_MIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -1731,9 +1731,9 @@ class npc_bonker_togglevolt : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_bonker_togglevolt() : CreatureScript("npc_bonker_togglevolt") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -1781,7 +1781,7 @@ public:
|
|||||||
else Bonker_agro=0;
|
else Bonker_agro=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class npc_emily : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_emily() : CreatureScript("npc_emily") { }
|
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
|
void JustSummoned(Creature* summoned) override
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
summoned->AI()->AttackStart(me->GetVictim());
|
summoned->AI()->AttackStart(me->GetVictim());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ class npc_apothecary_hanes : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_apothecary_hanes() : CreatureScript("npc_apothecary_hanes") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public:
|
|||||||
if (GetAttack() && UpdateVictim())
|
if (GetAttack() && UpdateVictim())
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
|
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (me->IsInCombat())
|
if (me->IsInCombat())
|
||||||
return;
|
return;
|
||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
events.Reset();
|
events.Reset();
|
||||||
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
|
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
ENSURE_AI(npc_escortAI, (me->AI()))->Start(true, true, _player);
|
ENSURE_AI(EscortAI, (me->AI()))->Start(true, true, _player);
|
||||||
break;
|
break;
|
||||||
case EVENT_TALK_1:
|
case EVENT_TALK_1:
|
||||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
|
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
|
||||||
@@ -207,7 +207,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -271,9 +271,9 @@ class npc_plaguehound_tracker : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_plaguehound_tracker() : CreatureScript("npc_plaguehound_tracker") { }
|
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
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -291,7 +291,7 @@ public:
|
|||||||
Start(false, false, summonerGUID);
|
Start(false, false, summonerGUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
if (waypointId != 26)
|
if (waypointId != 26)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ class npc_engineer_helice : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_engineer_helice() : CreatureScript("npc_engineer_helice") { }
|
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
uint32 m_uiChatTimer;
|
uint32 m_uiChatTimer;
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ class npc_injured_goblin : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_injured_goblin() : CreatureScript("npc_injured_goblin") { }
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -81,7 +81,7 @@ class npc_injured_goblin : public CreatureScript
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
@@ -345,9 +345,9 @@ class npc_icefang : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_icefang() : CreatureScript("npc_icefang") { }
|
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 AttackStart(Unit* /*who*/) override { }
|
||||||
void JustEngagedWith(Unit* /*who*/) override { }
|
void JustEngagedWith(Unit* /*who*/) override { }
|
||||||
@@ -362,13 +362,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override { }
|
void WaypointReached(uint32 /*waypointId*/, uint32 /*pathId*/) override { }
|
||||||
void JustDied(Unit* /*killer*/) override { }
|
void JustDied(Unit* /*killer*/) override { }
|
||||||
void OnCharmed(bool /*apply*/) override { }
|
void OnCharmed(bool /*apply*/) override { }
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ class boss_ambassador_hellmaw : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
boss_ambassador_hellmaw() : CreatureScript("boss_ambassador_hellmaw") { }
|
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();
|
_instance = creature->GetInstanceScript();
|
||||||
_intro = false;
|
_intro = false;
|
||||||
@@ -86,10 +86,10 @@ class boss_ambassador_hellmaw : public CreatureScript
|
|||||||
if (me->HasAura(SPELL_BANISH))
|
if (me->HasAura(SPELL_BANISH))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
npc_escortAI::MoveInLineOfSight(who);
|
EscortAI::MoveInLineOfSight(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override
|
void WaypointReached(uint32 /*waypointId*/, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,9 +152,9 @@ class npc_ancestral_wolf : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_ancestral_wolf() : CreatureScript("npc_ancestral_wolf") { }
|
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)
|
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||||
Start(false, false, creature->GetOwner()->GetGUID());
|
Start(false, false, creature->GetOwner()->GetGUID());
|
||||||
@@ -172,11 +172,11 @@ public:
|
|||||||
// Override Evade Mode event, recast buff that was removed by standard handler
|
// Override Evade Mode event, recast buff that was removed by standard handler
|
||||||
void EnterEvadeMode(EvadeReason why) override
|
void EnterEvadeMode(EvadeReason why) override
|
||||||
{
|
{
|
||||||
npc_escortAI::EnterEvadeMode(why);
|
EscortAI::EnterEvadeMode(why);
|
||||||
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
|
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -260,9 +260,9 @@ class npc_wounded_blood_elf : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_wounded_blood_elf() : CreatureScript("npc_wounded_blood_elf") { }
|
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 { }
|
void Reset() override { }
|
||||||
|
|
||||||
@@ -282,11 +282,11 @@ public:
|
|||||||
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
|
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
|
||||||
{
|
{
|
||||||
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ public:
|
|||||||
return new npc_maghar_captiveAI(creature);
|
return new npc_maghar_captiveAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ChainLightningTimer;
|
||||||
uint32 HealTimer;
|
uint32 HealTimer;
|
||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -177,7 +177,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -438,9 +438,9 @@ public:
|
|||||||
return new npc_kurenai_captiveAI(creature);
|
return new npc_kurenai_captiveAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
switch (waypointId)
|
switch (waypointId)
|
||||||
{
|
{
|
||||||
@@ -557,7 +557,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -500,9 +500,9 @@ class npc_bessy : public CreatureScript
|
|||||||
return new npc_bessyAI(creature);
|
return new npc_bessyAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 QuestAccept(Player* player, Quest const* quest) override
|
void QuestAccept(Player* player, Quest const* quest) override
|
||||||
{
|
{
|
||||||
@@ -520,7 +520,7 @@ class npc_bessy : public CreatureScript
|
|||||||
player->FailQuest(Q_ALMABTRIEB);
|
player->FailQuest(Q_ALMABTRIEB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -581,9 +581,9 @@ public:
|
|||||||
return new npc_maxx_a_million_escortAI(creature);
|
return new npc_maxx_a_million_escortAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ public:
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -636,7 +636,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (bTake)
|
if (bTake)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -601,9 +601,9 @@ public:
|
|||||||
return new npc_earthmender_wildaAI(creature);
|
return new npc_earthmender_wildaAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
Initialize();
|
||||||
}
|
}
|
||||||
@@ -630,7 +630,7 @@ public:
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
@@ -723,7 +723,7 @@ public:
|
|||||||
|
|
||||||
void UpdateAI(uint32 uiDiff) override
|
void UpdateAI(uint32 uiDiff) override
|
||||||
{
|
{
|
||||||
npc_escortAI::UpdateAI(uiDiff);
|
EscortAI::UpdateAI(uiDiff);
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ public:
|
|||||||
return new npc_kservantAI(creature);
|
return new npc_kservantAI(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct npc_kservantAI : public npc_escortAI
|
struct npc_kservantAI : public EscortAI
|
||||||
{
|
{
|
||||||
public:
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -376,11 +376,11 @@ class npc_isla_starmane : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_isla_starmane() : CreatureScript("npc_isla_starmane") { }
|
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();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -179,13 +179,13 @@ class npc_kayra_longmane : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_kayra_longmane() : CreatureScript("npc_kayra_longmane") { }
|
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 Reset() override { }
|
||||||
|
|
||||||
void WaypointReached(uint32 waypointId) override
|
void WaypointReached(uint32 waypointId, uint32 /*override*/) override
|
||||||
{
|
{
|
||||||
Player* player = GetPlayerForEscort();
|
Player* player = GetPlayerForEscort();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
@@ -1034,9 +1034,9 @@ class npc_garments_of_quests : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_garments_of_quests() : CreatureScript("npc_garments_of_quests") { }
|
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())
|
switch (me->GetEntry())
|
||||||
{
|
{
|
||||||
@@ -1124,7 +1124,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointReached(uint32 /*waypointId*/) override
|
void WaypointReached(uint32 /*waypointId*/, uint32 /*pathId*/) override
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1159,7 +1159,7 @@ public:
|
|||||||
RunAwayTimer -= diff;
|
RunAwayTimer -= diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
npc_escortAI::UpdateAI(diff);
|
EscortAI::UpdateAI(diff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user