Core/AI: ported charm updates from 335
This commit is contained in:
1 parent
346ffe6e91
commit
949f92e0a1
125 files changed
+691
-720
No files matched your search
@@ -287,13 +287,14 @@ void VehicleAI::UpdateAI(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleAI::OnCharmed(bool apply)
|
||||
void VehicleAI::OnCharmed(bool /*isNew*/)
|
||||
{
|
||||
if (!me->GetVehicleKit()->IsVehicleInUse() && !apply && m_HasConditions) // was used and has conditions
|
||||
bool const charmed = me->IsCharmed();
|
||||
if (!me->GetVehicleKit()->IsVehicleInUse() && !charmed && m_HasConditions) // was used and has conditions
|
||||
{
|
||||
m_DoDismiss = true; // needs reset
|
||||
}
|
||||
else if (apply)
|
||||
else if (charmed)
|
||||
m_DoDismiss = false; // in use again
|
||||
|
||||
m_DismissTimer = VEHICLE_DISMISS_TIME; // reset timer
|
||||
|
||||
@@ -102,7 +102,7 @@ struct TC_GAME_API VehicleAI : public CreatureAI
|
||||
void UpdateAI(uint32 diff) override;
|
||||
void MoveInLineOfSight(Unit*) override { }
|
||||
void AttackStart(Unit*) override { }
|
||||
void OnCharmed(bool apply) override;
|
||||
void OnCharmed(bool isNew) override;
|
||||
|
||||
static int32 Permissible(Creature const* creature);
|
||||
|
||||
|
||||
@@ -69,12 +69,6 @@ void PossessedAI::KilledUnit(Unit* victim)
|
||||
victim->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
|
||||
void PossessedAI::OnCharmed(bool /*apply*/)
|
||||
{
|
||||
me->NeedChangeAI = true;
|
||||
me->IsAIEnabled = false;
|
||||
}
|
||||
|
||||
void CritterAI::JustEngagedWith(Unit* /*who*/)
|
||||
{
|
||||
if (!me->HasUnitState(UNIT_STATE_FLEEING))
|
||||
|
||||
@@ -48,8 +48,6 @@ class TC_GAME_API PossessedAI : public CreatureAI
|
||||
void JustDied(Unit*) override;
|
||||
void KilledUnit(Unit* victim) override;
|
||||
|
||||
void OnCharmed(bool /*apply*/) override;
|
||||
|
||||
static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
|
||||
};
|
||||
|
||||
@@ -65,7 +63,7 @@ class TC_GAME_API NullCreatureAI : public CreatureAI
|
||||
void UpdateAI(uint32) override { }
|
||||
void JustAppeared() override { }
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override { }
|
||||
void OnCharmed(bool /*apply*/) override { }
|
||||
void OnCharmed(bool /*isNew*/) override { }
|
||||
|
||||
static int32 Permissible(Creature const* creature);
|
||||
};
|
||||
|
||||
@@ -429,6 +429,12 @@ void PetAI::HandleReturnMovement()
|
||||
if (me->IsCharmed())
|
||||
return;
|
||||
|
||||
if (!me->GetCharmInfo())
|
||||
{
|
||||
TC_LOG_WARN("scripts.ai.petai", "me->GetCharmInfo() is NULL in PetAI::HandleReturnMovement()");
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY) || me->GetCharmInfo()->HasCommandState(COMMAND_MOVE_TO))
|
||||
{
|
||||
if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning())
|
||||
@@ -545,6 +551,12 @@ bool PetAI::CanAttack(Unit* target)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!me->GetCharmInfo())
|
||||
{
|
||||
TC_LOG_ERROR("scripts.ai.petai", "me->GetCharmInfo() is NULL in PetAI::CanAttack()");
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(me->GetCharmInfo());
|
||||
|
||||
// Passive - passive pets can attack if told to
|
||||
@@ -609,10 +621,12 @@ void PetAI::ReceiveEmote(Player* player, uint32 emote)
|
||||
}
|
||||
}
|
||||
|
||||
void PetAI::OnCharmed(bool /*apply*/)
|
||||
void PetAI::OnCharmed(bool isNew)
|
||||
{
|
||||
me->NeedChangeAI = true;
|
||||
me->IsAIEnabled = false;
|
||||
if (me->IsCharmed())
|
||||
me->FollowTarget(me->GetCharmer());
|
||||
|
||||
CreatureAI::OnCharmed(isNew);
|
||||
}
|
||||
|
||||
void PetAI::ClearCharmInfoFlags()
|
||||
|
||||
@@ -43,6 +43,7 @@ class TC_GAME_API PetAI : public CreatureAI
|
||||
void OwnerAttacked(Unit* target) override;
|
||||
void DamageTaken(Unit* attacker, uint32& /*damage*/) override { AttackStart(attacker); }
|
||||
void ReceiveEmote(Player* player, uint32 textEmote) override;
|
||||
void OnCharmed(bool isNew) override;
|
||||
|
||||
// The following aren't used by the PetAI but need to be defined to override
|
||||
// default CreatureAI functions which interfere with the PetAI
|
||||
@@ -52,8 +53,6 @@ class TC_GAME_API PetAI : public CreatureAI
|
||||
void JustAppeared() override { } // we will control following manually
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override { } // For fleeing, pets don't use this type of Evade mechanic
|
||||
|
||||
void OnCharmed(bool /*apply*/) override;
|
||||
|
||||
private:
|
||||
bool _needToStop(void);
|
||||
void _stopAttack(void);
|
||||
|
||||
@@ -46,6 +46,12 @@ void UnitAI::InitializeAI()
|
||||
Reset();
|
||||
}
|
||||
|
||||
void UnitAI::OnCharmed(bool isNew)
|
||||
{
|
||||
if (!isNew)
|
||||
me->ScheduleAIChange();
|
||||
}
|
||||
|
||||
void UnitAI::AttackStartCaster(Unit* victim, float dist)
|
||||
{
|
||||
if (victim && me->Attack(victim, false))
|
||||
|
||||
@@ -143,8 +143,11 @@ class TC_GAME_API UnitAI
|
||||
|
||||
virtual void Reset() { }
|
||||
|
||||
// Called when unit is charmed
|
||||
virtual void OnCharmed(bool apply) = 0;
|
||||
// Called when unit's charm state changes with isNew = false
|
||||
// Implementation should call me->ScheduleAIChange() if AI replacement is desired
|
||||
// If this call is made, AI will be replaced on the next tick
|
||||
// When replacement is made, OnCharmed is called with isNew = true
|
||||
virtual void OnCharmed(bool isNew);
|
||||
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param*/) { }
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Map.h"
|
||||
#include "MapReference.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellHistory.h"
|
||||
@@ -34,13 +35,22 @@
|
||||
#include "World.h"
|
||||
|
||||
//Disable CreatureAI when charmed
|
||||
void CreatureAI::OnCharmed(bool apply)
|
||||
void CreatureAI::OnCharmed(bool isNew)
|
||||
{
|
||||
if (apply)
|
||||
if (isNew && !me->IsCharmed() && me->LastCharmerGUID)
|
||||
{
|
||||
me->NeedChangeAI = true;
|
||||
me->IsAIEnabled = false;
|
||||
if (!me->HasReactState(REACT_PASSIVE))
|
||||
{
|
||||
if (Unit* lastCharmer = ObjectAccessor::GetUnit(*me, me->LastCharmerGUID))
|
||||
me->EngageWithTarget(lastCharmer);
|
||||
}
|
||||
|
||||
me->LastCharmerGUID.Clear();
|
||||
|
||||
if (!me->IsInCombat())
|
||||
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
|
||||
}
|
||||
UnitAI::OnCharmed(isNew);
|
||||
}
|
||||
|
||||
AISpellInfoType* UnitAI::AISpellInfo;
|
||||
|
||||
@@ -156,7 +156,7 @@ class TC_GAME_API CreatureAI : public UnitAI
|
||||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { }
|
||||
|
||||
void OnCharmed(bool apply) override;
|
||||
void OnCharmed(bool isNew) override;
|
||||
|
||||
virtual void OnSpellCastFinished(SpellInfo const* /*spell*/, SpellFinishReason /*reason*/) { }
|
||||
|
||||
|
||||
@@ -722,7 +722,11 @@ bool SimpleCharmedPlayerAI::CanAIAttack(Unit const* who) const
|
||||
Unit* SimpleCharmedPlayerAI::SelectAttackTarget() const
|
||||
{
|
||||
if (Unit* charmer = me->GetCharmer())
|
||||
return charmer->IsAIEnabled ? charmer->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, ValidTargetSelectPredicate(this)) : charmer->GetVictim();
|
||||
{
|
||||
if (UnitAI* charmerAI = charmer->GetAI())
|
||||
return charmerAI->SelectTarget(SELECT_TARGET_RANDOM, 0, ValidTargetSelectPredicate(this));
|
||||
return charmer->GetVictim();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1336,9 +1340,9 @@ void SimpleCharmedPlayerAI::UpdateAI(const uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleCharmedPlayerAI::OnCharmed(bool apply)
|
||||
void SimpleCharmedPlayerAI::OnCharmed(bool isNew)
|
||||
{
|
||||
if (apply)
|
||||
if (me->IsCharmed())
|
||||
{
|
||||
me->CastStop();
|
||||
me->AttackStop();
|
||||
@@ -1354,4 +1358,5 @@ void SimpleCharmedPlayerAI::OnCharmed(bool apply)
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->StopMoving();
|
||||
}
|
||||
PlayerAI::OnCharmed(isNew);
|
||||
}
|
||||
@@ -29,8 +29,6 @@ class TC_GAME_API PlayerAI : public UnitAI
|
||||
public:
|
||||
explicit PlayerAI(Player* player);
|
||||
|
||||
void OnCharmed(bool /*apply*/) override { } // charm AI application for players is handled by Unit::SetCharmedBy / Unit::RemoveCharmedBy
|
||||
|
||||
Creature* GetCharmer() const;
|
||||
|
||||
// helper functions to determine player info
|
||||
@@ -100,7 +98,7 @@ class TC_GAME_API SimpleCharmedPlayerAI : public PlayerAI
|
||||
public:
|
||||
SimpleCharmedPlayerAI(Player* player) : PlayerAI(player), _castCheckTimer(2500), _chaseCloser(false), _forceFacing(true), _isFollowing(false) { }
|
||||
void UpdateAI(uint32 diff) override;
|
||||
void OnCharmed(bool apply) override;
|
||||
void OnCharmed(bool isNew) override;
|
||||
|
||||
protected:
|
||||
bool CanAIAttack(Unit const* who) const override;
|
||||
|
||||
@@ -53,7 +53,7 @@ void SummonList::DoZoneInCombat(uint32 entry)
|
||||
{
|
||||
Creature* summon = ObjectAccessor::GetCreature(*me, *i);
|
||||
++i;
|
||||
if (summon && summon->IsAIEnabled
|
||||
if (summon && summon->IsAIEnabled()
|
||||
&& (!entry || summon->GetEntry() == entry))
|
||||
{
|
||||
summon->AI()->DoZoneInCombat(nullptr);
|
||||
@@ -117,7 +117,7 @@ void SummonList::DoActionImpl(int32 action, StorageType const& summons)
|
||||
for (auto const& guid : summons)
|
||||
{
|
||||
Creature* summon = ObjectAccessor::GetCreature(*me, guid);
|
||||
if (summon && summon->IsAIEnabled)
|
||||
if (summon && summon->IsAIEnabled())
|
||||
summon->AI()->DoAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,13 +310,6 @@ void EscortAI::MovementInform(uint32 type, uint32 id)
|
||||
}
|
||||
}
|
||||
|
||||
///@todo investigate whether if its necessary to handle anything on charm
|
||||
/*
|
||||
void EscortAI::OnCharmed(bool apply)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, uint32 waitTime/* = 0*/)
|
||||
{
|
||||
Trinity::NormalizeMapCoord(x);
|
||||
|
||||
@@ -736,29 +736,41 @@ void SmartAI::InitializeAI()
|
||||
_followCreditType = 0;
|
||||
}
|
||||
|
||||
void SmartAI::OnCharmed(bool apply)
|
||||
void SmartAI::OnCharmed(bool /*isNew*/)
|
||||
{
|
||||
if (apply) // do this before we change charmed state, as charmed state might prevent these things from processing
|
||||
bool const charmed = me->IsCharmed();
|
||||
if (charmed) // do this before we change charmed state, as charmed state might prevent these things from processing
|
||||
{
|
||||
if (HasEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING))
|
||||
EndPath(true);
|
||||
me->StopMoving();
|
||||
}
|
||||
|
||||
_isCharmed = apply;
|
||||
_isCharmed = charmed;
|
||||
|
||||
if (!apply && !me->IsInEvadeMode())
|
||||
if (charmed && !me->isPossessed() && !me->IsVehicle())
|
||||
me->FollowTarget(me->GetCharmer());
|
||||
|
||||
if (!charmed && !me->IsInEvadeMode())
|
||||
{
|
||||
if (_repeatWaypointPath)
|
||||
StartPath(_run, GetScript()->GetPathId(), true);
|
||||
else
|
||||
me->SetWalk(!_run);
|
||||
|
||||
if (Unit* charmer = me->GetCharmer())
|
||||
AttackStart(charmer);
|
||||
if (me->LastCharmerGUID)
|
||||
{
|
||||
if (!me->HasReactState(REACT_PASSIVE))
|
||||
if (Unit* lastCharmer = ObjectAccessor::GetUnit(*me, me->LastCharmerGUID))
|
||||
me->EngageWithTarget(lastCharmer);
|
||||
me->LastCharmerGUID.Clear();
|
||||
|
||||
if (!me->IsInCombat())
|
||||
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
|
||||
}
|
||||
}
|
||||
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, nullptr, 0, 0, apply);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, nullptr, 0, 0, charmed);
|
||||
}
|
||||
|
||||
void SmartAI::DoAction(int32 param)
|
||||
|
||||
@@ -143,7 +143,7 @@ class TC_GAME_API SmartAI : public CreatureAI
|
||||
void InitializeAI() override;
|
||||
|
||||
// Called when creature gets charmed by another unit
|
||||
void OnCharmed(bool apply) override;
|
||||
void OnCharmed(bool isNew) override;
|
||||
|
||||
// Used in scripts to share variables
|
||||
void DoAction(int32 param = 0) override;
|
||||
|
||||
@@ -1058,7 +1058,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE:
|
||||
{
|
||||
if (me && me->IsAIEnabled)
|
||||
if (me && me->IsAIEnabled())
|
||||
{
|
||||
me->AI()->DoZoneInCombat();
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature %u", me->GetGUID().GetCounter());
|
||||
|
||||
@@ -1426,7 +1426,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
|
||||
error = LFG_TELEPORT_RESULT_EXHAUSTION;
|
||||
else if (player->GetVehicle())
|
||||
error = LFG_TELEPORT_RESULT_ON_TRANSPORT;
|
||||
else if (player->GetCharmGUID())
|
||||
else if (player->GetCharmedGUID())
|
||||
error = LFG_TELEPORT_RESULT_IMMUNE_TO_SUMMONS;
|
||||
else if (player->HasAura(9454)) // check Freeze debuff
|
||||
error = LFG_TELEPORT_RESULT_NO_RETURN_LOCATION;
|
||||
|
||||
@@ -270,7 +270,7 @@ m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0),
|
||||
m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
|
||||
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_boundaryCheckTime(2500), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(REACT_AGGRESSIVE),
|
||||
m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_cannotReachTarget(false), m_cannotReachTimer(0), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_cannotReachTarget(false), m_cannotReachTimer(0), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), _waypointPathId(0), _currentWaypointNodeInfo(0, 0), _cyclicSplinePathId(0),
|
||||
m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(false), _isMissingSwimmingFlagOutOfCombat(false), _noNpcDamageBelowPctHealth(0.f)
|
||||
{
|
||||
@@ -288,15 +288,6 @@ m_formation(nullptr), m_triggerJustAppeared(true), m_respawnCompatibilityMode(fa
|
||||
m_isTempWorldObject = false;
|
||||
}
|
||||
|
||||
Creature::~Creature()
|
||||
{
|
||||
delete i_AI;
|
||||
i_AI = nullptr;
|
||||
|
||||
//if (m_uint32Values)
|
||||
// TC_LOG_ERROR("entities.unit", "Deconstruct Creature Entry = %u", GetEntry());
|
||||
}
|
||||
|
||||
void Creature::AddToWorld()
|
||||
{
|
||||
///- Register the creature for guid lookup
|
||||
@@ -413,8 +404,8 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
|
||||
loot.clear();
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
if (IsAIEnabled)
|
||||
AI()->CorpseRemoved(respawnDelay);
|
||||
if (CreatureAI* ai = AI())
|
||||
ai->CorpseRemoved(respawnDelay);
|
||||
|
||||
// Should get removed later, just keep "compatibility" with scripts
|
||||
if (setSpawnTime)
|
||||
@@ -672,7 +663,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
|
||||
|
||||
void Creature::Update(uint32 diff)
|
||||
{
|
||||
if (IsAIEnabled && m_triggerJustAppeared && m_deathState != DEAD)
|
||||
if (IsAIEnabled() && m_triggerJustAppeared && m_deathState != DEAD)
|
||||
{
|
||||
if (m_respawnCompatibilityMode && m_vehicleKit)
|
||||
m_vehicleKit->Reset();
|
||||
@@ -743,12 +734,8 @@ void Creature::Update(uint32 diff)
|
||||
if (m_deathState != CORPSE)
|
||||
break;
|
||||
|
||||
if (IsEngaged() && IsAIEnabled)
|
||||
{
|
||||
m_AI_locked = true;
|
||||
i_AI->UpdateAI(diff);
|
||||
m_AI_locked = false;
|
||||
}
|
||||
if (IsEngaged())
|
||||
Unit::AIUpdateTick(diff);
|
||||
|
||||
if (m_groupLootTimer && lootingGroupLowGUID)
|
||||
{
|
||||
@@ -787,22 +774,8 @@ void Creature::Update(uint32 diff)
|
||||
_spellFocusInfo.delay -= diff;
|
||||
}
|
||||
|
||||
// if creature is charmed, switch to charmed AI (and back)
|
||||
if (NeedChangeAI)
|
||||
{
|
||||
UpdateCharmAI();
|
||||
NeedChangeAI = false;
|
||||
IsAIEnabled = true;
|
||||
if (!IsInEvadeMode() && LastCharmerGUID)
|
||||
if (Unit* charmer = ObjectAccessor::GetUnit(*this, LastCharmerGUID))
|
||||
if (CanStartAttack(charmer, true))
|
||||
i_AI->AttackStart(charmer);
|
||||
|
||||
LastCharmerGUID.Clear();
|
||||
}
|
||||
|
||||
// periodic check to see if the creature has passed an evade boundary
|
||||
if (IsAIEnabled && !IsInEvadeMode() && IsEngaged())
|
||||
if (IsAIEnabled() && !IsInEvadeMode() && IsEngaged())
|
||||
{
|
||||
if (diff >= m_boundaryCheckTime)
|
||||
{
|
||||
@@ -840,12 +813,8 @@ void Creature::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
m_AI_locked = true;
|
||||
i_AI->UpdateAI(diff);
|
||||
m_AI_locked = false;
|
||||
}
|
||||
// do not allow the AI to be changed during update
|
||||
Unit::AIUpdateTick(diff);
|
||||
|
||||
// creature can be dead after UpdateAI call
|
||||
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
|
||||
@@ -863,8 +832,8 @@ void Creature::Update(uint32 diff)
|
||||
{
|
||||
m_cannotReachTimer += diff;
|
||||
if (m_cannotReachTimer >= CREATURE_NOPATH_EVADE_TIME)
|
||||
if (IsAIEnabled)
|
||||
AI()->EnterEvadeMode(CreatureAI::EVADE_REASON_NO_PATH);
|
||||
if (CreatureAI* ai = AI())
|
||||
ai->EnterEvadeMode(CreatureAI::EVADE_REASON_NO_PATH);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -934,46 +903,18 @@ void Creature::DoFleeToGetAssistance()
|
||||
|
||||
bool Creature::AIM_Destroy()
|
||||
{
|
||||
if (m_AI_locked)
|
||||
{
|
||||
TC_LOG_DEBUG("scripts", "AIM_Destroy: failed to destroy, locked.");
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(!i_disabledAI,
|
||||
"The disabled AI wasn't cleared!");
|
||||
|
||||
delete i_AI;
|
||||
i_AI = nullptr;
|
||||
|
||||
IsAIEnabled = false;
|
||||
PopAI();
|
||||
RefreshAI();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Creature::AIM_Create(CreatureAI* ai /*= nullptr*/)
|
||||
{
|
||||
// make sure nothing can change the AI during AI update
|
||||
if (m_AI_locked)
|
||||
{
|
||||
TC_LOG_DEBUG("scripts", "AIM_Initialize: failed to init, locked.");
|
||||
return false;
|
||||
}
|
||||
|
||||
AIM_Destroy();
|
||||
|
||||
Motion_Initialize();
|
||||
|
||||
i_AI = ai ? ai : FactorySelector::SelectAI(this);
|
||||
return true;
|
||||
}
|
||||
SetAI(ai ? ai : FactorySelector::SelectAI(this));
|
||||
|
||||
void Creature::AI_InitializeAndEnable()
|
||||
{
|
||||
IsAIEnabled = true;
|
||||
i_AI->InitializeAI();
|
||||
// Initialize vehicle
|
||||
if (GetVehicleKit())
|
||||
GetVehicleKit()->Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Creature::AIM_Initialize(CreatureAI* ai)
|
||||
@@ -981,7 +922,9 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
|
||||
if (!AIM_Create(ai))
|
||||
return false;
|
||||
|
||||
AI_InitializeAndEnable();
|
||||
AI()->InitializeAI();
|
||||
if (GetVehicleKit())
|
||||
GetVehicleKit()->Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1825,7 +1768,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
||||
|
||||
bool Creature::CanAlwaysSee(WorldObject const* obj) const
|
||||
{
|
||||
if (IsAIEnabled && AI()->CanSeeAlways(obj))
|
||||
if (IsAIEnabled() && AI()->CanSeeAlways(obj))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -2061,8 +2004,8 @@ void Creature::Respawn(bool force)
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
|
||||
if (IsAIEnabled) // reset the AI to be sure no dirty or uninitialized values will be used till next tick
|
||||
AI()->Reset();
|
||||
if (UnitAI* ai = AI()) // reset the AI to be sure no dirty or uninitialized values will be used till next tick
|
||||
ai->Reset();
|
||||
|
||||
m_triggerJustAppeared = true;
|
||||
|
||||
@@ -2949,7 +2892,7 @@ std::string const & Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
|
||||
|
||||
uint32 Creature::GetPetAutoSpellOnPos(uint8 pos) const
|
||||
{
|
||||
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
if (pos >= MAX_SPELL_CHARM || !m_charmInfo || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
return 0;
|
||||
else
|
||||
return m_charmInfo->GetCharmSpell(pos)->GetAction();
|
||||
@@ -3331,7 +3274,7 @@ void Creature::AtEngage(Unit* target)
|
||||
RefreshSwimmingFlag();
|
||||
|
||||
MovementGeneratorType const movetype = GetMotionMaster()->GetCurrentMovementGeneratorType();
|
||||
if (movetype == WAYPOINT_MOTION_TYPE || movetype == CYCLIC_SPLINE_MOTION_TYPE || movetype == POINT_MOTION_TYPE || (IsAIEnabled && AI()->IsEscorted()))
|
||||
if (movetype == WAYPOINT_MOTION_TYPE || movetype == CYCLIC_SPLINE_MOTION_TYPE || movetype == POINT_MOTION_TYPE || (IsAIEnabled() && AI()->IsEscorted()))
|
||||
SetHomePosition(GetPosition());
|
||||
|
||||
if (CreatureAI* ai = AI())
|
||||
@@ -3354,8 +3297,8 @@ void Creature::AtDisengage()
|
||||
|
||||
bool Creature::IsEscorted() const
|
||||
{
|
||||
if (IsAIEnabled)
|
||||
return AI()->IsEscorted();
|
||||
if (CreatureAI* ai = AI())
|
||||
return ai->IsEscorted();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
{
|
||||
public:
|
||||
explicit Creature(bool isWorldObject = false);
|
||||
virtual ~Creature();
|
||||
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
@@ -141,11 +140,10 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
|
||||
bool AIM_Destroy();
|
||||
bool AIM_Create(CreatureAI* ai = nullptr);
|
||||
void AI_InitializeAndEnable();
|
||||
bool AIM_Initialize(CreatureAI* ai = nullptr);
|
||||
void Motion_Initialize();
|
||||
|
||||
CreatureAI* AI() const { return reinterpret_cast<CreatureAI*>(i_AI); }
|
||||
CreatureAI* AI() const { return reinterpret_cast<CreatureAI*>(GetAI()); }
|
||||
|
||||
SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
|
||||
void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
|
||||
@@ -414,7 +412,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
bool m_regenHealth;
|
||||
bool m_cannotReachTarget;
|
||||
uint32 m_cannotReachTimer;
|
||||
bool m_AI_locked;
|
||||
|
||||
SpellSchoolMask m_meleeDamageSchoolMask;
|
||||
uint32 m_originalEntry;
|
||||
|
||||
@@ -227,9 +227,9 @@ void TempSummon::InitSummon()
|
||||
{
|
||||
if (Unit* owner = GetSummoner())
|
||||
{
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
|
||||
owner->ToCreature()->AI()->JustSummoned(this);
|
||||
if (IsAIEnabled)
|
||||
if (IsAIEnabled())
|
||||
AI()->IsSummonedBy(owner);
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void TempSummon::UnSummon(uint32 msTime)
|
||||
Unit* owner = GetSummoner();
|
||||
if (owner)
|
||||
{
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
|
||||
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ void Guardian::InitSummon()
|
||||
|
||||
if (GetOwner()->GetTypeId() == TYPEID_PLAYER
|
||||
&& GetOwner()->GetMinionGUID() == GetGUID()
|
||||
&& !GetOwner()->GetCharmGUID())
|
||||
&& !GetOwner()->GetCharmedGUID())
|
||||
{
|
||||
GetOwner()->ToPlayer()->CharmSpellInitialize();
|
||||
}
|
||||
|
||||
@@ -1021,14 +1021,7 @@ void Player::Update(uint32 p_time)
|
||||
|
||||
UpdateAfkReport(now);
|
||||
|
||||
if (IsAIEnabled && GetAI())
|
||||
GetAI()->UpdateAI(p_time);
|
||||
else if (NeedChangeAI)
|
||||
{
|
||||
UpdateCharmAI();
|
||||
NeedChangeAI = false;
|
||||
IsAIEnabled = (GetAI() != nullptr);
|
||||
}
|
||||
Unit::AIUpdateTick(p_time);
|
||||
|
||||
// Update items that have just a limited lifetime
|
||||
if (now > m_Last_tick)
|
||||
@@ -20897,7 +20890,7 @@ void Player::RemovePetAura(PetAura const* petSpell)
|
||||
|
||||
void Player::StopCastingCharm()
|
||||
{
|
||||
Unit* charm = GetCharm();
|
||||
Unit* charm = GetCharmed();
|
||||
if (!charm)
|
||||
return;
|
||||
|
||||
@@ -20908,12 +20901,12 @@ void Player::StopCastingCharm()
|
||||
else if (charm->IsVehicle())
|
||||
ExitVehicle();
|
||||
}
|
||||
if (GetCharmGUID())
|
||||
if (GetCharmedGUID())
|
||||
charm->RemoveCharmAuras();
|
||||
|
||||
if (GetCharmGUID())
|
||||
if (GetCharmedGUID())
|
||||
{
|
||||
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Player '%s' (%s) is not able to uncharm unit (%s)", GetName().c_str(), GetGUID().ToString().c_str(), GetCharmGUID().ToString().c_str());
|
||||
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Player '%s' (%s) is not able to uncharm unit (%s)", GetName().c_str(), GetGUID().ToString().c_str(), GetCharmedGUID().ToString().c_str());
|
||||
if (!charm->GetCharmerGUID().IsEmpty())
|
||||
{
|
||||
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Charmed unit has charmer %s", charm->GetCharmerGUID().ToString().c_str());
|
||||
@@ -21143,7 +21136,7 @@ void Player::PetSpellInitialize()
|
||||
|
||||
void Player::PossessSpellInitialize()
|
||||
{
|
||||
Unit* charm = GetCharm();
|
||||
Unit* charm = GetCharmed();
|
||||
if (!charm)
|
||||
return;
|
||||
|
||||
@@ -24768,7 +24761,11 @@ void Player::SetClientControl(Unit* target, bool allowMove)
|
||||
{
|
||||
// still affected by some aura that shouldn't allow control, only allow on last such aura to be removed
|
||||
if (allowMove && target->HasUnitState(UNIT_STATE_CANT_CLIENT_CONTROL))
|
||||
{
|
||||
// this should never happen, otherwise m_unitBeingMoved might be left dangling!
|
||||
ASSERT(GetUnitBeingMoved() == target);
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size()+1);
|
||||
data << target->GetPackGUID();
|
||||
|
||||
@@ -1008,7 +1008,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
explicit Player(WorldSession* session);
|
||||
~Player();
|
||||
|
||||
PlayerAI* AI() const { return reinterpret_cast<PlayerAI*>(i_AI); }
|
||||
PlayerAI* AI() const { return reinterpret_cast<PlayerAI*>(GetAI()); }
|
||||
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true) override;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include "TemporarySummon.h"
|
||||
#include "Totem.h"
|
||||
#include "Transport.h"
|
||||
#include "UnitAI.h"
|
||||
#include "UpdateFieldFlags.h"
|
||||
#include "Util.h"
|
||||
#include "Vehicle.h"
|
||||
@@ -325,13 +326,14 @@ bool DispelableAura::RollDispel() const
|
||||
|
||||
Unit::Unit(bool isWorldObject) :
|
||||
WorldObject(isWorldObject), m_playerMovingMe(nullptr), m_lastSanctuaryTime(0),
|
||||
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(),
|
||||
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
|
||||
i_AI(nullptr), i_disabledAI(nullptr), m_AutoRepeatFirstCast(false), m_procDeep(0),
|
||||
m_removedAurasCount(0), m_interruptMask(SpellAuraInterruptFlags::None), m_interruptMask2(SpellAuraInterruptFlags2::None),
|
||||
LastCharmerGUID(), m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
|
||||
m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0),
|
||||
m_interruptMask(SpellAuraInterruptFlags::None), m_interruptMask2(SpellAuraInterruptFlags2::None),
|
||||
m_charmer(nullptr), m_charmed(nullptr),
|
||||
i_motionMaster(new MotionMaster(this)), m_vehicle(nullptr),
|
||||
m_vehicleKit(nullptr), m_unitTypeMask(UNIT_MASK_NONE), m_Diminishing(),
|
||||
m_isEngaged(false), m_combatManager(this), m_threatManager(this), _lastDamagedTime(0),
|
||||
m_isEngaged(false), m_combatManager(this), m_threatManager(this),
|
||||
i_AI(nullptr), m_aiLocked(false), _lastDamagedTime(0),
|
||||
m_spellHistory(new SpellHistory(this)), _isIgnoringCombat(false)
|
||||
{
|
||||
m_objectType |= TYPEMASK_UNIT;
|
||||
@@ -515,6 +517,9 @@ void Unit::Update(uint32 p_time)
|
||||
UpdateSplineMovement(p_time);
|
||||
i_motionMaster->UpdateMotion(p_time);
|
||||
|
||||
if (!i_AI && (GetTypeId() != TYPEID_PLAYER || IsCharmed()))
|
||||
UpdateCharmAI();
|
||||
|
||||
// Wait with the aura interrupts until we have updated our movement generators and position6
|
||||
if (IsPlayer())
|
||||
InterruptMovementBasedAuras();
|
||||
@@ -531,6 +536,10 @@ void Unit::Update(uint32 p_time)
|
||||
RegenerateHealth();
|
||||
_healthRegenerationTimer += UNIT_HEALTH_REGENERATION_INTERVAL;
|
||||
}
|
||||
|
||||
if (!GetAI() && (GetTypeId() != TYPEID_PLAYER || IsCharmed()))
|
||||
UpdateCharmAI();
|
||||
RefreshAI();
|
||||
}
|
||||
|
||||
bool Unit::haveOffhandWeapon() const
|
||||
@@ -775,11 +784,11 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
}
|
||||
}
|
||||
|
||||
if (victim->IsAIEnabled)
|
||||
victim->GetAI()->DamageTaken(this, damage);
|
||||
if (UnitAI* victimAI = victim->GetAI())
|
||||
victimAI->DamageTaken(this, damage);
|
||||
|
||||
if (IsAIEnabled)
|
||||
GetAI()->DamageDealt(victim, damage, damagetype);
|
||||
if (UnitAI* attackerAI = GetAI())
|
||||
attackerAI->DamageDealt(victim, damage, damagetype);
|
||||
|
||||
// Hook for OnDamage Event
|
||||
sScriptMgr->OnDamage(this, victim, damage);
|
||||
@@ -791,8 +800,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
{
|
||||
for (Unit* controlled : victim->m_Controlled)
|
||||
if (Creature* cControlled = controlled->ToCreature())
|
||||
if (cControlled->IsAIEnabled)
|
||||
cControlled->AI()->OwnerAttackedBy(this);
|
||||
if (CreatureAI* controlledAI = cControlled->AI())
|
||||
controlledAI->OwnerAttackedBy(this);
|
||||
}
|
||||
|
||||
if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
|
||||
@@ -879,7 +888,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->duel && damage >= (health-1))
|
||||
{
|
||||
// prevent kill only if killed in duel and killed by opponent or opponent controlled creature
|
||||
if (victim->ToPlayer()->duel->opponent == this || victim->ToPlayer()->duel->opponent->GetGUID() == GetOwnerOrCreatorGUID())
|
||||
if (victim->ToPlayer()->duel->opponent == GetControllingPlayer())
|
||||
damage = health - 1;
|
||||
|
||||
duel_hasEnded = true;
|
||||
@@ -891,7 +900,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
if (victimRider && victimRider->duel && victimRider->duel->isMounted)
|
||||
{
|
||||
// prevent kill only if killed in duel and killed by opponent or opponent controlled creature
|
||||
if (victimRider->duel->opponent == this || victimRider->duel->opponent->GetGUID() == GetCharmerGUID())
|
||||
if (victimRider->duel->opponent == GetControllingPlayer())
|
||||
damage = health - 1;
|
||||
|
||||
duel_wasMounted = true;
|
||||
@@ -3075,7 +3084,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
|
||||
spell->SetReferencedFromCurrent(false);
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
|
||||
ToCreature()->AI()->OnSpellCastFinished(spell->GetSpellInfo(), SPELL_FINISHED_CANCELED);
|
||||
}
|
||||
}
|
||||
@@ -4977,14 +4986,14 @@ void Unit::ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
|
||||
void Unit::_RegisterDynObject(DynamicObject* dynObj)
|
||||
{
|
||||
m_dynObj.push_back(dynObj);
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
|
||||
ToCreature()->AI()->JustRegisteredDynObject(dynObj);
|
||||
}
|
||||
|
||||
void Unit::_UnregisterDynObject(DynamicObject* dynObj)
|
||||
{
|
||||
m_dynObj.remove(dynObj);
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled())
|
||||
ToCreature()->AI()->JustUnregisteredDynObject(dynObj);
|
||||
}
|
||||
|
||||
@@ -5060,7 +5069,7 @@ void Unit::AddGameObject(GameObject* gameObj)
|
||||
GetSpellHistory()->StartCooldown(createBySpell, 0, nullptr, true);
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsAIEnabled)
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsAIEnabled())
|
||||
ToCreature()->AI()->JustSummonedGameobject(gameObj);
|
||||
}
|
||||
|
||||
@@ -5094,7 +5103,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
|
||||
|
||||
m_gameObj.remove(gameObj);
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsAIEnabled)
|
||||
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsAIEnabled())
|
||||
ToCreature()->AI()->SummonedGameobjectDespawn(gameObj);
|
||||
|
||||
if (del)
|
||||
@@ -5720,8 +5729,8 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
{
|
||||
for (Unit* controlled : m_Controlled)
|
||||
if (Creature* cControlled = controlled->ToCreature())
|
||||
if (cControlled->IsAIEnabled)
|
||||
cControlled->AI()->OwnerAttacked(victim);
|
||||
if (CreatureAI* controlledAI = cControlled->AI())
|
||||
controlledAI->OwnerAttacked(victim);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -5956,14 +5965,6 @@ Unit* Unit::GetOwner() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharmer() const
|
||||
{
|
||||
if (ObjectGuid charmerGUID = GetCharmerGUID())
|
||||
return ObjectAccessor::GetUnit(*this, charmerGUID);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const
|
||||
{
|
||||
ObjectGuid guid = GetCharmerOrOwnerGUID();
|
||||
@@ -5984,6 +5985,18 @@ Player* Unit::GetAffectingPlayer() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Player* Unit::GetControllingPlayer() const
|
||||
{
|
||||
if (ObjectGuid guid = GetCharmerOrOwnerGUID())
|
||||
{
|
||||
if (Unit* master = ObjectAccessor::GetUnit(*this, guid))
|
||||
return master->GetControllingPlayer();
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
return const_cast<Player*>(ToPlayer());
|
||||
}
|
||||
|
||||
Minion* Unit::GetFirstMinion() const
|
||||
{
|
||||
if (ObjectGuid pet_guid = GetMinionGUID())
|
||||
@@ -6014,25 +6027,6 @@ Guardian* Unit::GetGuardianPet() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharm() const
|
||||
{
|
||||
if (ObjectGuid charm_guid = GetCharmGUID())
|
||||
{
|
||||
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
|
||||
return pet;
|
||||
|
||||
TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %s not exist.", charm_guid.ToString().c_str());
|
||||
const_cast<Unit*>(this)->SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharmerOrOwner() const
|
||||
{
|
||||
return GetCharmerGUID() ? GetCharmer() : GetOwner();
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharmerOrOwnerOrSelf() const
|
||||
{
|
||||
if (Unit* u = GetCharmerOrOwner())
|
||||
@@ -6141,7 +6135,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
||||
for (Unit const* controlled : m_Controlled)
|
||||
{
|
||||
// do not use this check, creature do not have charm guid
|
||||
//if (GetCharmGUID() == (*itr)->GetGUID())
|
||||
//if (GetCharmedGUID() == (*itr)->GetGUID())
|
||||
if (GetGUID() == controlled->GetCharmerGUID())
|
||||
continue;
|
||||
|
||||
@@ -6160,7 +6154,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
||||
if (AddGuidValue(UNIT_FIELD_SUMMON, controlled->GetGUID()))
|
||||
{
|
||||
// show another pet bar if there is no charm bar
|
||||
if (IsPlayer() && !GetCharmGUID())
|
||||
if (IsPlayer() && !GetCharmedGUID())
|
||||
{
|
||||
if (controlled->IsPet())
|
||||
ToPlayer()->PetSpellInitialize();
|
||||
@@ -6207,8 +6201,9 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
|
||||
TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str());
|
||||
ASSERT(AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()),
|
||||
"Player %s is trying to charm unit %u, but it already has a charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmedGUID().ToString().c_str());
|
||||
m_charmed = charm;
|
||||
|
||||
charm->m_ControlledByPlayer = true;
|
||||
/// @todo maybe we can use this flag to check if controlled by player
|
||||
@@ -6220,8 +6215,9 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
// PvP, FFAPvP
|
||||
charm->SetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG, GetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PVP_FLAG));
|
||||
|
||||
if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
|
||||
ASSERT(charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()),
|
||||
"Unit %u is being charmed, but it already has a charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
|
||||
charm->m_charmer = this;
|
||||
|
||||
_isWalkingBeforeCharm = charm->IsWalking();
|
||||
if (_isWalkingBeforeCharm)
|
||||
@@ -6235,12 +6231,14 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
|
||||
TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmGUID().ToString().c_str());
|
||||
ASSERT(RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()),
|
||||
"Player %s is trying to uncharm unit %u, but it has another charmed unit %s", GetName().c_str(), charm->GetEntry(), GetCharmedGUID().ToString().c_str());
|
||||
m_charmed = nullptr;
|
||||
}
|
||||
|
||||
if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
|
||||
ASSERT(charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()),
|
||||
"Unit %u is being uncharmed, but it has another charmer %s", charm->GetEntry(), charm->GetCharmerGUID().ToString().c_str());
|
||||
charm->m_charmer = nullptr;
|
||||
|
||||
if (charm->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -6280,11 +6278,11 @@ void Unit::DealHeal(HealInfo& healInfo)
|
||||
Unit* victim = healInfo.GetTarget();
|
||||
uint32 addhealth = healInfo.GetHeal();
|
||||
|
||||
if (victim->IsAIEnabled)
|
||||
victim->GetAI()->HealReceived(this, addhealth);
|
||||
if (UnitAI* victimAI = victim->GetAI())
|
||||
victimAI->HealReceived(this, addhealth);
|
||||
|
||||
if (IsAIEnabled)
|
||||
GetAI()->HealDone(victim, addhealth);
|
||||
if (UnitAI* healerAI = GetAI())
|
||||
healerAI->HealDone(victim, addhealth);
|
||||
|
||||
if (addhealth)
|
||||
gain = victim->ModifyHealth(int32(addhealth));
|
||||
@@ -6379,7 +6377,7 @@ Unit* Unit::GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
|
||||
Unit* Unit::GetFirstControlled() const
|
||||
{
|
||||
// Sequence: charmed, pet, other guardians
|
||||
Unit* unit = GetCharm();
|
||||
Unit* unit = GetCharmed();
|
||||
if (!unit)
|
||||
if (ObjectGuid guid = GetMinionGUID())
|
||||
unit = ObjectAccessor::GetUnit(*this, guid);
|
||||
@@ -6408,8 +6406,8 @@ void Unit::RemoveAllControlled()
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet %s", GetEntry(), GetPetGUID().ToString().c_str());
|
||||
if (GetMinionGUID())
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion %s", GetEntry(), GetMinionGUID().ToString().c_str());
|
||||
if (GetCharmGUID())
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm %s", GetEntry(), GetCharmGUID().ToString().c_str());
|
||||
if (GetCharmedGUID())
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm %s", GetEntry(), GetCharmedGUID().ToString().c_str());
|
||||
if (!IsPet()) // pets don't use the flag for this
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); // m_controlled is now empty, so we know none of our minions are in combat
|
||||
}
|
||||
@@ -6421,12 +6419,12 @@ bool Unit::isPossessedByPlayer() const
|
||||
|
||||
bool Unit::isPossessing(Unit* u) const
|
||||
{
|
||||
return u->isPossessed() && GetCharmGUID() == u->GetGUID();
|
||||
return u->isPossessed() && GetCharmedGUID() == u->GetGUID();
|
||||
}
|
||||
|
||||
bool Unit::isPossessing() const
|
||||
{
|
||||
if (Unit* u = GetCharm())
|
||||
if (Unit* u = GetCharmed())
|
||||
return u->isPossessed();
|
||||
else
|
||||
return false;
|
||||
@@ -8214,7 +8212,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
}
|
||||
|
||||
// if we have charmed npc, stun him also (everywhere)
|
||||
if (Unit* charm = player->GetCharm())
|
||||
if (Unit* charm = player->GetCharmed())
|
||||
if (charm->GetTypeId() == TYPEID_UNIT)
|
||||
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
|
||||
@@ -8259,7 +8257,7 @@ void Unit::Dismount()
|
||||
player->ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
// if we have charmed npc, remove stun also
|
||||
if (Unit* charm = player->GetCharm())
|
||||
if (Unit* charm = player->GetCharmed())
|
||||
if (charm->GetTypeId() == TYPEID_UNIT && charm->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !charm->HasUnitState(UNIT_STATE_STUNNED))
|
||||
charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
}
|
||||
@@ -9111,6 +9109,8 @@ void Unit::FollowTarget(Unit* target)
|
||||
if (summon->IsPet())
|
||||
joinFormation = true;
|
||||
}
|
||||
else if (IsCharmed())
|
||||
joinFormation = true;
|
||||
|
||||
// Unit is already following its target
|
||||
if (joinFormation && target->HasFormationFollower(this))
|
||||
@@ -10133,6 +10133,68 @@ void Unit::Regenerate(Powers powerType, uint32 diff)
|
||||
UpdateUInt32Value(UNIT_FIELD_POWER1 + powerIndex, curValue);
|
||||
}
|
||||
|
||||
void Unit::AIUpdateTick(uint32 diff)
|
||||
{
|
||||
if (UnitAI* ai = GetAI())
|
||||
{
|
||||
m_aiLocked = true;
|
||||
ai->UpdateAI(diff);
|
||||
m_aiLocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::PushAI(UnitAI* newAI)
|
||||
{
|
||||
i_AIs.emplace(newAI);
|
||||
}
|
||||
|
||||
void Unit::SetAI(UnitAI* newAI)
|
||||
{
|
||||
PushAI(newAI);
|
||||
RefreshAI();
|
||||
}
|
||||
|
||||
bool Unit::PopAI()
|
||||
{
|
||||
if (!i_AIs.empty())
|
||||
{
|
||||
i_AIs.pop();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::RefreshAI()
|
||||
{
|
||||
ASSERT(!m_aiLocked, "Tried to change current AI during UpdateAI()");
|
||||
if (i_AIs.empty())
|
||||
i_AI = nullptr;
|
||||
else
|
||||
i_AI = i_AIs.top();
|
||||
}
|
||||
|
||||
void Unit::ScheduleAIChange()
|
||||
{
|
||||
bool const charmed = IsCharmed();
|
||||
|
||||
if (charmed)
|
||||
PushAI(nullptr);
|
||||
else
|
||||
{
|
||||
RestoreDisabledAI();
|
||||
PushAI(nullptr); //This could actually be PopAI() to get the previous AI but it's required atm to trigger UpdateCharmAI()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RestoreDisabledAI()
|
||||
{
|
||||
// Keep popping the stack until we either reach the bottom or find a valid AI
|
||||
while (PopAI())
|
||||
if (GetTopAI())
|
||||
return;
|
||||
}
|
||||
|
||||
void Unit::AddToWorld()
|
||||
{
|
||||
WorldObject::AddToWorld();
|
||||
@@ -10148,8 +10210,8 @@ void Unit::RemoveFromWorld()
|
||||
if (IsInWorld())
|
||||
{
|
||||
m_duringRemoveFromWorld = true;
|
||||
if (IsAIEnabled)
|
||||
GetAI()->LeavingWorld();
|
||||
if (UnitAI* ai = GetAI())
|
||||
ai->LeavingWorld();
|
||||
|
||||
if (IsVehicle())
|
||||
RemoveVehicleKit(true);
|
||||
@@ -10172,11 +10234,11 @@ void Unit::RemoveFromWorld()
|
||||
GetMotionMaster()->Clear(MOTION_SLOT_IDLE);
|
||||
RemoveAllPursuers();
|
||||
|
||||
if (GetCharmerGUID())
|
||||
{
|
||||
TC_LOG_FATAL("entities.unit", "Unit %u has charmer guid when removed from world", GetEntry());
|
||||
ABORT();
|
||||
}
|
||||
if (IsCharmed())
|
||||
RemoveCharmedBy(nullptr);
|
||||
|
||||
ASSERT(!GetCharmedGUID(), "Unit %u has charmed guid when removed from world", GetEntry());
|
||||
ASSERT(!GetCharmerGUID(), "Unit %u has charmer guid when removed from world", GetEntry());
|
||||
|
||||
if (Unit* owner = GetOwner())
|
||||
{
|
||||
@@ -10224,80 +10286,45 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
||||
|
||||
void Unit::UpdateCharmAI()
|
||||
{
|
||||
switch (GetTypeId())
|
||||
if (IsCharmed())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if (i_disabledAI) // disabled AI must be primary AI
|
||||
{
|
||||
if (!IsCharmed())
|
||||
{
|
||||
delete i_AI;
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = nullptr;
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
ToCreature()->AI()->OnCharmed(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsCharmed())
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
if (isPossessed() || IsVehicle())
|
||||
i_AI = new PossessedAI(ToCreature());
|
||||
else
|
||||
i_AI = new PetAI(ToCreature());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
UnitAI* newAI = nullptr;
|
||||
if (IsPlayer())
|
||||
{
|
||||
if (IsCharmed()) // if we are currently being charmed, then we should apply charm AI
|
||||
if (Unit* charmer = GetCharmer())
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
|
||||
UnitAI* newAI = nullptr;
|
||||
// first, we check if the creature's own AI specifies an override playerai for its owned players
|
||||
if (Unit* charmer = GetCharmer())
|
||||
if (Creature* creatureCharmer = charmer->ToCreature())
|
||||
{
|
||||
if (Creature* creatureCharmer = charmer->ToCreature())
|
||||
{
|
||||
if (PlayerAI* charmAI = creatureCharmer->IsAIEnabled ? creatureCharmer->AI()->GetAIForCharmedPlayer(ToPlayer()) : nullptr)
|
||||
newAI = charmAI;
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("misc", "Attempt to assign charm AI to player %s who is charmed by non-creature %s.", GetGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
if (!newAI) // otherwise, we default to the generic one
|
||||
newAI = new SimpleCharmedPlayerAI(ToPlayer());
|
||||
i_AI = newAI;
|
||||
newAI->OnCharmed(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i_AI)
|
||||
{
|
||||
// we allow the charmed PlayerAI to clean up
|
||||
i_AI->OnCharmed(false);
|
||||
// then delete it
|
||||
delete i_AI;
|
||||
if (CreatureAI* charmerAI = creatureCharmer->AI())
|
||||
newAI = charmerAI->GetAIForCharmedPlayer(ToPlayer());
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("misc", "Attempt to remove charm AI from player %s who doesn't currently have charm AI.", GetGUID().ToString().c_str());
|
||||
}
|
||||
// and restore our previous PlayerAI (if we had one)
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = nullptr;
|
||||
// IsAIEnabled gets handled in the caller
|
||||
TC_LOG_ERROR("misc", "Attempt to assign charm AI to player %s who is charmed by non-creature %s.", GetGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str());
|
||||
}
|
||||
break;
|
||||
if (!newAI) // otherwise, we default to the generic one
|
||||
newAI = new SimpleCharmedPlayerAI(ToPlayer());
|
||||
}
|
||||
default:
|
||||
TC_LOG_ERROR("misc", "Attempt to update charm AI for unit %s, which is neither player nor creature.", GetGUID().ToString().c_str());
|
||||
else
|
||||
{
|
||||
ASSERT(IsCreature());
|
||||
if (isPossessed() || IsVehicle())
|
||||
newAI = new PossessedAI(ToCreature());
|
||||
else
|
||||
newAI = new PetAI(ToCreature());
|
||||
}
|
||||
|
||||
ASSERT(newAI);
|
||||
SetAI(newAI);
|
||||
newAI->OnCharmed(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
RestoreDisabledAI();
|
||||
// Hack: this is required because we want to call OnCharmed(true) on the restored AI
|
||||
RefreshAI();
|
||||
if (UnitAI* ai = GetAI())
|
||||
ai->OnCharmed(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10327,10 +10354,10 @@ CharmInfo::CharmInfo(Unit* unit)
|
||||
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
|
||||
_charmspells[i].SetActionAndType(0, ACT_DISABLED);
|
||||
|
||||
if (_unit->GetTypeId() == TYPEID_UNIT)
|
||||
if (Creature* creature = _unit->ToCreature())
|
||||
{
|
||||
_oldReactState = _unit->ToCreature()->GetReactState();
|
||||
_unit->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
_oldReactState = creature->GetReactState();
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10841,11 +10868,6 @@ SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
|
||||
return SPELL_SCHOOL_MASK_NORMAL;
|
||||
}
|
||||
|
||||
ObjectGuid Unit::GetCharmerOrOwnerGUID() const
|
||||
{
|
||||
return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerOrCreatorGUID();
|
||||
}
|
||||
|
||||
ObjectGuid Unit::GetCharmerOrOwnerOrOwnGUID() const
|
||||
{
|
||||
if (ObjectGuid guid = GetCharmerOrOwnerGUID())
|
||||
@@ -11649,7 +11671,12 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
{
|
||||
Pet* pet = player->GetPet();
|
||||
if (pet && pet->IsAlive() && pet->isControlled())
|
||||
pet->AI()->KilledUnit(victim);
|
||||
{
|
||||
if (pet->IsAIEnabled())
|
||||
pet->AI()->KilledUnit(victim);
|
||||
else
|
||||
TC_LOG_ERROR("entities.unit", "Pet doesn't have any AI in Unit::Kill(). %s", pet->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// 10% durability loss on death
|
||||
@@ -11671,7 +11698,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
SendDurabilityLoss(plrVictim, loss);
|
||||
}
|
||||
// Call KilledUnit for creatures
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
if (IsCreature() && IsAIEnabled())
|
||||
ToCreature()->AI()->KilledUnit(victim);
|
||||
|
||||
// last damage from non duel opponent or opponent controlled creature
|
||||
@@ -11696,16 +11723,16 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
}
|
||||
|
||||
// Call KilledUnit for creatures, this needs to be called after the lootable flag is set
|
||||
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
|
||||
if (IsCreature() && IsAIEnabled())
|
||||
ToCreature()->AI()->KilledUnit(victim);
|
||||
|
||||
// Call creature just died function
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->JustDied(this);
|
||||
if (CreatureAI* ai = creature->AI())
|
||||
ai->JustDied(this);
|
||||
|
||||
if (TempSummon* summon = creature->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (summoner->ToCreature() && summoner->IsAIEnabled)
|
||||
if (summoner->ToCreature() && summoner->IsAIEnabled())
|
||||
summoner->ToCreature()->AI()->SummonedCreatureDies(creature, this);
|
||||
|
||||
// Dungeon specific stuff, only applies to players killing creatures
|
||||
@@ -11793,12 +11820,14 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
if (HasUnitState(state))
|
||||
return;
|
||||
|
||||
if (state & UNIT_STATE_CONTROLLED)
|
||||
CastStop();
|
||||
|
||||
AddUnitState(state);
|
||||
switch (state)
|
||||
{
|
||||
case UNIT_STATE_STUNNED:
|
||||
SetStunned(true);
|
||||
CastStop();
|
||||
break;
|
||||
case UNIT_STATE_ROOT:
|
||||
if (!HasUnitState(UNIT_STATE_STUNNED))
|
||||
@@ -11811,7 +11840,6 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SendMeleeAttackStop();
|
||||
// SendAutoRepeatCancel ?
|
||||
SetConfused(true);
|
||||
CastStop();
|
||||
}
|
||||
break;
|
||||
case UNIT_STATE_FLEEING:
|
||||
@@ -11821,7 +11849,6 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SendMeleeAttackStop();
|
||||
// SendAutoRepeatCancel ?
|
||||
SetFeared(true);
|
||||
CastStop();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -12081,23 +12108,13 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
{
|
||||
GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
|
||||
PauseMovement(0, MOTION_SLOT_IDLE);
|
||||
ToCreature()->AI()->OnCharmed(true);
|
||||
StopMoving();
|
||||
}
|
||||
else if (Player* player = ToPlayer())
|
||||
{
|
||||
if (player->isAFK())
|
||||
player->ToggleAFK();
|
||||
|
||||
if (charmer->GetTypeId() == TYPEID_UNIT) // we are charmed by a creature
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
IsAIEnabled = false;
|
||||
player->AI()->OnCharmed(true);
|
||||
}
|
||||
}
|
||||
player->SetClientControl(this, false);
|
||||
}
|
||||
|
||||
@@ -12160,6 +12177,15 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
}
|
||||
|
||||
AddUnitState(UNIT_STATE_CHARMED);
|
||||
|
||||
if ((GetTypeId() != TYPEID_PLAYER) || (charmer->GetTypeId() != TYPEID_PLAYER))
|
||||
{
|
||||
// AI will schedule its own change if appropriate
|
||||
if (UnitAI* ai = GetAI())
|
||||
ai->OnCharmed(false);
|
||||
else
|
||||
ScheduleAIChange();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12168,15 +12194,12 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
if (!IsCharmed())
|
||||
return;
|
||||
|
||||
if (!charmer)
|
||||
if (charmer)
|
||||
ASSERT(charmer == GetCharmer());
|
||||
else
|
||||
charmer = GetCharmer();
|
||||
if (charmer != GetCharmer()) // one aura overrides another?
|
||||
{
|
||||
// TC_LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
|
||||
// GetGUID(), GetCharmerGUID(), charmer->GetGUID());
|
||||
// ABORT();
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(charmer);
|
||||
|
||||
CharmType type;
|
||||
if (HasUnitState(UNIT_STATE_POSSESSED))
|
||||
@@ -12199,20 +12222,9 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
|
||||
GetMotionMaster()->InitDefault();
|
||||
|
||||
if (Creature* creature = ToCreature())
|
||||
{
|
||||
// Creature will restore its old AI on next update
|
||||
if (creature->AI())
|
||||
creature->AI()->OnCharmed(false);
|
||||
|
||||
// Vehicle should not attack its passenger after he exists the seat
|
||||
if (type != CHARM_TYPE_VEHICLE)
|
||||
LastCharmerGUID = ASSERT_NOTNULL(charmer)->GetGUID();
|
||||
}
|
||||
|
||||
// If charmer still exists
|
||||
if (!charmer)
|
||||
return;
|
||||
// Vehicle should not attack its passenger after he exists the seat
|
||||
if (type != CHARM_TYPE_VEHICLE)
|
||||
LastCharmerGUID = charmer->GetGUID();
|
||||
|
||||
ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
|
||||
ASSERT(type != CHARM_TYPE_VEHICLE || (GetTypeId() == TYPEID_UNIT && IsVehicle()));
|
||||
@@ -12257,26 +12269,27 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
}
|
||||
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (charmer->GetTypeId() == TYPEID_UNIT) // charmed by a creature, this means we had PlayerAI
|
||||
{
|
||||
NeedChangeAI = true;
|
||||
IsAIEnabled = false;
|
||||
}
|
||||
|
||||
player->SetClientControl(this, true);
|
||||
}
|
||||
|
||||
EngageWithTarget(charmer);
|
||||
|
||||
// a guardian should always have charminfo
|
||||
if (playerCharmer && this != charmer->GetFirstControlled())
|
||||
playerCharmer->SendRemoveControlBar();
|
||||
else if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !IsGuardian()))
|
||||
|
||||
// a guardian should always have charminfo
|
||||
if (!IsGuardian())
|
||||
DeleteCharmInfo();
|
||||
|
||||
// reset confused movement for example
|
||||
ApplyControlStatesIfNeeded();
|
||||
|
||||
if (GetTypeId() != TYPEID_PLAYER || charmer->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (UnitAI* charmedAI = GetAI())
|
||||
charmedAI->OnCharmed(false); // AI will potentially schedule a charm ai update
|
||||
else
|
||||
ScheduleAIChange();
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RestoreFaction()
|
||||
@@ -13260,7 +13273,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
|
||||
}
|
||||
|
||||
Creature* creature = ToCreature();
|
||||
if (creature && creature->IsAIEnabled)
|
||||
if (creature && creature->IsAIEnabled())
|
||||
creature->AI()->OnSpellClick(clicker, result);
|
||||
|
||||
return result;
|
||||
@@ -13871,7 +13884,7 @@ void Unit::OutDebugInfo() const
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
|
||||
TC_LOG_DEBUG("entities.unit", "%s name %s", GetGUID().ToString().c_str(), GetName().c_str());
|
||||
TC_LOG_DEBUG("entities.unit", "Owner %s, Minion %s, Charmer %s, Charmed %s", GetOwnerOrCreatorGUID().ToString().c_str(), GetMinionGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str(), GetCharmGUID().ToString().c_str());
|
||||
TC_LOG_DEBUG("entities.unit", "Owner %s, Minion %s, Charmer %s, Charmed %s", GetOwnerOrCreatorGUID().ToString().c_str(), GetMinionGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str(), GetCharmedGUID().ToString().c_str());
|
||||
TC_LOG_DEBUG("entities.unit", "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
|
||||
if (IsInWorld())
|
||||
TC_LOG_DEBUG("entities.unit", "Mapid %u", GetMapId());
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "Util.h"
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
|
||||
#define WORLD_TRIGGER 12999
|
||||
|
||||
@@ -789,9 +791,18 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
virtual ~Unit();
|
||||
|
||||
UnitAI* GetAI() { return i_AI; }
|
||||
void SetAI(UnitAI* newAI) { i_AI = newAI; }
|
||||
bool IsAIEnabled() const { return (i_AI != nullptr); }
|
||||
void AIUpdateTick(uint32 diff);
|
||||
UnitAI* GetAI() const { return i_AI.get(); }
|
||||
void ScheduleAIChange();
|
||||
void PushAI(UnitAI* newAI);
|
||||
bool PopAI();
|
||||
protected:
|
||||
void SetAI(UnitAI* newAI);
|
||||
UnitAI* GetTopAI() const { return i_AIs.empty() ? nullptr : i_AIs.top().get(); }
|
||||
void RefreshAI();
|
||||
|
||||
public:
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
@@ -1204,32 +1215,35 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void SetCreatorGUID(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); }
|
||||
ObjectGuid GetMinionGUID() const { return GetGuidValue(UNIT_FIELD_SUMMON); }
|
||||
void SetMinionGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_SUMMON, guid); }
|
||||
ObjectGuid GetCharmerGUID() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); }
|
||||
void SetCharmerGUID(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); }
|
||||
ObjectGuid GetCharmGUID() const { return GetGuidValue(UNIT_FIELD_CHARM); }
|
||||
void SetPetGUID(ObjectGuid guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; }
|
||||
ObjectGuid GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; }
|
||||
void SetCritterGUID(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CRITTER, guid); }
|
||||
ObjectGuid GetCritterGUID() const { return GetGuidValue(UNIT_FIELD_CRITTER); }
|
||||
ObjectGuid GetOwnerOrCreatorGUID() const { return GetOwnerGUID() ? GetOwnerGUID() : GetCreatorGUID(); }
|
||||
|
||||
ObjectGuid GetCharmerGUID() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); }
|
||||
Unit* GetCharmer() const { return m_charmer; }
|
||||
|
||||
ObjectGuid GetCharmedGUID() const { return GetGuidValue(UNIT_FIELD_CHARM); }
|
||||
Unit* GetCharmed() const { return m_charmed; }
|
||||
|
||||
bool IsControlledByPlayer() const { return m_ControlledByPlayer; }
|
||||
ObjectGuid GetCharmerOrOwnerGUID() const;
|
||||
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const;
|
||||
Player* GetControllingPlayer() const;
|
||||
ObjectGuid GetCharmerOrOwnerGUID() const { return IsCharmed() ? GetCharmerGUID() : GetOwnerGUID(); }
|
||||
bool IsCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); }
|
||||
|
||||
Player* GetSpellModOwner() const;
|
||||
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const;
|
||||
|
||||
Unit* GetOwner() const;
|
||||
Guardian* GetGuardianPet() const;
|
||||
Minion* GetFirstMinion() const;
|
||||
Unit* GetCharmer() const;
|
||||
Unit* GetCharm() const;
|
||||
Unit* GetCharmerOrOwner() const;
|
||||
Unit* GetCharmerOrOwner() const { return IsCharmed() ? GetCharmer() : GetOwner(); }
|
||||
Unit* GetCharmerOrOwnerOrSelf() const;
|
||||
Player* GetCharmerOrOwnerPlayerOrPlayerItself() const;
|
||||
Player* GetAffectingPlayer() const;
|
||||
|
||||
Player* GetSpellModOwner() const;
|
||||
|
||||
void SetMinion(Minion *minion, bool apply);
|
||||
void GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry);
|
||||
void RemoveAllMinionsByEntry(uint32 entry);
|
||||
@@ -1252,7 +1266,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
CharmInfo* GetCharmInfo() { return m_charmInfo; }
|
||||
CharmInfo* InitCharmInfo();
|
||||
void DeleteCharmInfo();
|
||||
void UpdateCharmAI();
|
||||
// returns the unit that this player IS CONTROLLING
|
||||
Unit* GetUnitBeingMoved() const;
|
||||
// returns the player that this player IS CONTROLLING
|
||||
@@ -1675,7 +1688,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
uint32 GetModelForTotem(PlayerTotemType totemType);
|
||||
|
||||
friend class VehicleJoinEvent;
|
||||
bool IsAIEnabled, NeedChangeAI;
|
||||
ObjectGuid LastCharmerGUID;
|
||||
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading = false);
|
||||
void RemoveVehicleKit(bool onRemoveFromWorld = false);
|
||||
@@ -1774,8 +1786,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const override;
|
||||
void DestroyForPlayer(Player* target, bool onDeath = false) const override;
|
||||
|
||||
UnitAI* i_AI, *i_disabledAI;
|
||||
|
||||
void _UpdateSpells(uint32 time);
|
||||
void _DeleteRemovedAuras();
|
||||
|
||||
@@ -1824,6 +1834,8 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
float m_speed_rate[MAX_MOVE_TYPE];
|
||||
|
||||
Unit* m_charmer; // Unit that is charming ME
|
||||
Unit* m_charmed; // Unit that is being charmed BY ME
|
||||
CharmInfo* m_charmInfo;
|
||||
SharedVisionList m_sharedVision;
|
||||
|
||||
@@ -1893,6 +1905,13 @@ class TC_GAME_API Unit : public WorldObject
|
||||
friend class ThreatManager;
|
||||
ThreatManager m_threatManager;
|
||||
|
||||
void UpdateCharmAI();
|
||||
void RestoreDisabledAI();
|
||||
typedef std::stack<std::shared_ptr<UnitAI>> UnitAIStack;
|
||||
UnitAIStack i_AIs;
|
||||
std::shared_ptr<UnitAI> i_AI;
|
||||
bool m_aiLocked;
|
||||
|
||||
GuidSet m_ComboPointHolders;
|
||||
|
||||
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
|
||||
|
||||
@@ -562,7 +562,7 @@ Vehicle* Vehicle::RemovePassenger(Unit* unit)
|
||||
unit->m_movementInfo.transport = _me->m_movementInfo.transport;
|
||||
}
|
||||
|
||||
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled)
|
||||
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled())
|
||||
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
|
||||
|
||||
if (GetBase()->GetTypeId() == TYPEID_UNIT)
|
||||
@@ -940,8 +940,8 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
|
||||
if (Creature* creature = Target->GetBase()->ToCreature())
|
||||
{
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->PassengerBoarded(Passenger, Seat->first, true);
|
||||
if (CreatureAI* ai = creature->AI())
|
||||
ai->PassengerBoarded(Passenger, Seat->first, true);
|
||||
|
||||
sScriptMgr->OnAddPassenger(Target, Passenger, Seat->first);
|
||||
|
||||
|
||||
@@ -1717,7 +1717,7 @@ class GameEventAIHookWorker
|
||||
void Visit(std::unordered_map<ObjectGuid, Creature*>& creatureMap)
|
||||
{
|
||||
for (auto const& p : creatureMap)
|
||||
if (p.second->IsInWorld() && p.second->IsAIEnabled)
|
||||
if (p.second->IsInWorld() && p.second->IsAIEnabled())
|
||||
p.second->AI()->OnGameEvent(_activate, _eventId);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
|
||||
|
||||
if (!c->HasUnitState(UNIT_STATE_SIGHTLESS))
|
||||
{
|
||||
if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true))
|
||||
if (c->IsAIEnabled() && c->CanSeeOrDetect(u, false, true))
|
||||
c->AI()->MoveInLineOfSight_Safe(u);
|
||||
else
|
||||
if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true))
|
||||
if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled() && c->CanSeeOrDetect(u, false, true, true))
|
||||
c->AI()->TriggerAlert(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1096,8 +1096,7 @@ namespace Trinity
|
||||
if (!u->IsWithinLOSInMap(i_enemy))
|
||||
return;
|
||||
|
||||
if (u->GetAI() && u->IsAIEnabled)
|
||||
u->GetAI()->AttackStart(i_enemy);
|
||||
u->EngageWithTarget(i_enemy);
|
||||
}
|
||||
private:
|
||||
Unit* const i_funit;
|
||||
|
||||
@@ -133,7 +133,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
|
||||
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharmed())
|
||||
{
|
||||
TC_LOG_ERROR("entities.pet", "HandlePetStopAttack: %s isn't a pet or charmed creature of player %s",
|
||||
guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
@@ -215,7 +215,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
if (pet->GetVictim())
|
||||
pet->AttackStop();
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled())
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
@@ -382,9 +382,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
if (pet->GetVictim() != unit_target)
|
||||
{
|
||||
pet->GetMotionMaster()->Clear();
|
||||
if (pet->ToCreature()->IsAIEnabled)
|
||||
if (CreatureAI* AI = pet->ToCreature()->AI())
|
||||
{
|
||||
CreatureAI* AI = pet->ToCreature()->AI();
|
||||
if (PetAI* petAI = dynamic_cast<PetAI*>(AI))
|
||||
petAI->_AttackStart(unit_target); // force victim switch
|
||||
else
|
||||
@@ -704,7 +703,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
{
|
||||
if (pet->IsPet())
|
||||
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
|
||||
else if (pet->GetGUID() == _player->GetCharmGUID())
|
||||
else if (pet->GetGUID() == _player->GetCharmedGUID())
|
||||
_player->StopCastingCharm();
|
||||
}
|
||||
}
|
||||
@@ -717,7 +716,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
uint8 state; //1 for on, 0 for off
|
||||
recvPacket >> guid >> spellid >> state;
|
||||
|
||||
if (!_player->GetGuardianPet() && !_player->GetCharm())
|
||||
if (!_player->GetGuardianPet() && !_player->GetCharmed())
|
||||
return;
|
||||
|
||||
if (guid.IsPlayer())
|
||||
@@ -725,7 +724,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
|
||||
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
|
||||
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharmed()))
|
||||
{
|
||||
TC_LOG_ERROR("entities.pet", "HandlePetSpellAutocastOpcode. %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
@@ -771,12 +770,12 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
TC_LOG_DEBUG("entities.pet", "WORLD: CMSG_PET_CAST_SPELL, %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags);
|
||||
|
||||
// This opcode is also sent from charmed and possessed units (players and creatures)
|
||||
if (!_player->GetGuardianPet() && !_player->GetCharm())
|
||||
if (!_player->GetGuardianPet() && !_player->GetCharmed())
|
||||
return;
|
||||
|
||||
Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
|
||||
|
||||
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
|
||||
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharmed()))
|
||||
{
|
||||
TC_LOG_ERROR("entities.pet", "HandlePetCastSpellOpcode: %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
@@ -984,7 +983,7 @@ void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData*/)
|
||||
if (_player->GetPet() && _player->CanControlPet())
|
||||
_player->PetSpellInitialize();
|
||||
|
||||
if (Unit* charm = _player->GetCharm())
|
||||
if (Unit* charm = _player->GetCharmed())
|
||||
{
|
||||
if (charm->HasUnitState(UNIT_STATE_POSSESSED))
|
||||
_player->PossessSpellInitialize();
|
||||
|
||||
@@ -364,7 +364,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
|
||||
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharmed())
|
||||
{
|
||||
TC_LOG_ERROR("network", "HandlePetCancelAura: %s is not a pet of player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
|
||||
|
||||
ObjectGuid vehicleGUID = _player->GetCharmGUID();
|
||||
ObjectGuid vehicleGUID = _player->GetCharmedGUID();
|
||||
|
||||
if (!vehicleGUID) // something wrong here...
|
||||
{
|
||||
|
||||
@@ -38,9 +38,11 @@ static bool IsMutualChase(Unit const* owner, Unit const* target)
|
||||
|
||||
static void DoMovementInform(Unit* owner, Unit const* target)
|
||||
{
|
||||
if (Creature* cOwner = owner->ToCreature())
|
||||
if (CreatureAI* ai = cOwner->AI())
|
||||
ai->MovementInform(CHASE_MOTION_TYPE, target->GetGUID().GetCounter());
|
||||
if (owner->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
if (CreatureAI* AI = owner->ToCreature()->AI())
|
||||
AI->MovementInform(CHASE_MOTION_TYPE, target->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
static bool PositionOkay(Unit const* owner, Unit const* target, float distance, Optional<ChaseAngle> angle)
|
||||
|
||||
@@ -105,8 +105,8 @@ static void DoMovementInform(Unit* owner, Unit* target)
|
||||
if (owner->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
if (UnitAI* ai = owner->GetAI())
|
||||
static_cast<CreatureAI*>(ai)->MovementInform(FOLLOW_MOTION_TYPE, target->GetGUID().GetCounter());
|
||||
if (CreatureAI* AI = owner->ToCreature()->AI())
|
||||
AI->MovementInform(FOLLOW_MOTION_TYPE, target->GetGUID().GetCounter());
|
||||
}
|
||||
|
||||
static void GetFollowOffsets(uint8 followerIndex, float& distance, float& relativeAngle)
|
||||
|
||||
@@ -123,9 +123,9 @@ void SplineChainMovementGenerator::Finalize(Unit* me)
|
||||
{
|
||||
if (!finished)
|
||||
return;
|
||||
Creature* cMe = me->ToCreature();
|
||||
if (cMe && cMe->IsAIEnabled)
|
||||
cMe->AI()->MovementInform(SPLINE_CHAIN_MOTION_TYPE, _id);
|
||||
Creature* ownerCreature = me->ToCreature();
|
||||
if (CreatureAI* AI = ownerCreature ? ownerCreature->AI() : nullptr)
|
||||
AI->MovementInform(SPLINE_CHAIN_MOTION_TYPE, _id);
|
||||
}
|
||||
|
||||
bool SplineChainMovementGenerator::Update(Unit* me, uint32 diff)
|
||||
|
||||
@@ -68,8 +68,8 @@ void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature)
|
||||
}
|
||||
|
||||
// inform AI
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->WaypointPathStarted(_path->Id);
|
||||
if (CreatureAI* AI = creature->AI())
|
||||
AI->WaypointPathStarted(_path->Id);
|
||||
}
|
||||
|
||||
void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
|
||||
@@ -127,8 +127,8 @@ void WaypointMovementGenerator<Creature>::ProcessWaypointArrival(Creature* creat
|
||||
creature->UpdateCurrentWaypointInfo(0, 0);
|
||||
|
||||
// Inform the AI that the path has ended.
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->WaypointPathEnded(waypoint.Id, _path->Id);
|
||||
if (CreatureAI* AI = creature->AI())
|
||||
AI->WaypointPathEnded(waypoint.Id, _path->Id);
|
||||
}
|
||||
|
||||
if (waypoint.EventId && urand(0, 99) < waypoint.EventChance)
|
||||
@@ -141,10 +141,10 @@ void WaypointMovementGenerator<Creature>::ProcessWaypointArrival(Creature* creat
|
||||
creature->UpdateCurrentWaypointInfo(waypoint.Id, _path->Id);
|
||||
|
||||
// inform AI
|
||||
if (creature->IsAIEnabled)
|
||||
if (CreatureAI* AI = creature->AI())
|
||||
{
|
||||
creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, _currentNode);
|
||||
creature->AI()->WaypointReached(waypoint.Id, _path->Id);
|
||||
AI->MovementInform(WAYPOINT_MOTION_TYPE, _currentNode);
|
||||
AI->WaypointReached(waypoint.Id, _path->Id);
|
||||
}
|
||||
|
||||
// All hooks called and infos updated. Time to increment the waypoint node id
|
||||
@@ -248,8 +248,9 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature* creature, bool rel
|
||||
creature->SignalFormationMovement();
|
||||
|
||||
// Inform AI
|
||||
if (creature->IsAIEnabled && !relaunch)
|
||||
creature->AI()->WaypointStarted(waypoint.Id, _path->Id);
|
||||
if (!relaunch)
|
||||
if (CreatureAI* AI = creature->AI())
|
||||
AI->WaypointStarted(waypoint.Id, _path->Id);
|
||||
|
||||
_waypointReached = false;
|
||||
_recalculateSpeed = false;
|
||||
|
||||
@@ -435,7 +435,9 @@ class CreatureGameObjectScriptRegistrySwapHooks
|
||||
if (!creature->IsAlive())
|
||||
return;
|
||||
|
||||
creature->AI_InitializeAndEnable();
|
||||
creature->AI()->InitializeAI();
|
||||
if (creature->GetVehicleKit())
|
||||
creature->GetVehicleKit()->Reset();
|
||||
creature->AI()->EnterEvadeMode();
|
||||
|
||||
// Cast a dummy visual spell asynchronously here to signal
|
||||
|
||||
@@ -2813,11 +2813,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
if (spellHitTarget)
|
||||
{
|
||||
//AI functions
|
||||
if (spellHitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
if (spellHitTarget->ToCreature()->IsAIEnabled)
|
||||
spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo);
|
||||
if (Creature* cHitTarget = spellHitTarget->ToCreature())
|
||||
if (CreatureAI* hitTargetAI = cHitTarget->AI())
|
||||
hitTargetAI->SpellHit(m_caster, m_spellInfo);
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled())
|
||||
m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
|
||||
|
||||
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
|
||||
@@ -3520,8 +3520,8 @@ void Spell::_cast(bool skipCheck)
|
||||
if (Unit* unitTarget = m_targets.GetUnitTarget())
|
||||
for (Unit* controlled : playerCaster->m_Controlled)
|
||||
if (Creature* cControlled = controlled->ToCreature())
|
||||
if (cControlled->IsAIEnabled)
|
||||
cControlled->AI()->OwnerAttacked(unitTarget);
|
||||
if (CreatureAI* controlledAI = cControlled->AI())
|
||||
controlledAI->OwnerAttacked(unitTarget);
|
||||
}
|
||||
|
||||
SetExecutedCurrently(true);
|
||||
@@ -3742,8 +3742,8 @@ void Spell::_cast(bool skipCheck)
|
||||
|
||||
// Call CreatureAI hook OnSuccessfulSpellCast
|
||||
if (Creature* caster = m_originalCaster->ToCreature())
|
||||
if (caster->IsAIEnabled)
|
||||
caster->AI()->OnSpellCastFinished(GetSpellInfo(), SPELL_FINISHED_SUCCESSFUL_CAST);
|
||||
if (CreatureAI* casterAI = caster->AI())
|
||||
casterAI->OnSpellCastFinished(GetSpellInfo(), SPELL_FINISHED_SUCCESSFUL_CAST);
|
||||
}
|
||||
|
||||
void Spell::handle_immediate()
|
||||
@@ -4032,8 +4032,8 @@ void Spell::update(uint32 difftime)
|
||||
|
||||
// We call the hook here instead of in Spell::finish because we only want to call it for completed channeling. Everything else is handled by interrupts
|
||||
if (Creature* creatureCaster = m_caster->ToCreature())
|
||||
if (creatureCaster->IsAIEnabled)
|
||||
creatureCaster->AI()->OnSpellCastFinished(m_spellInfo, SPELL_FINISHED_CHANNELING_COMPLETE);
|
||||
if (CreatureAI* casterAI = creatureCaster->AI())
|
||||
casterAI->OnSpellCastFinished(m_spellInfo, SPELL_FINISHED_CHANNELING_COMPLETE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -4063,7 +4063,7 @@ void Spell::finish(bool ok, bool sendChannelUpdate /* = false */)
|
||||
// Unsummon summon as possessed creatures on spell cancel
|
||||
if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (Unit* charm = m_caster->GetCharm())
|
||||
if (Unit* charm = m_caster->GetCharmed())
|
||||
if (charm->GetTypeId() == TYPEID_UNIT
|
||||
&& charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET)
|
||||
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
|
||||
@@ -6092,7 +6092,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
[[fallthrough]]; // check both GetPetGUID() and GetCharmGUID for SUMMON_CATEGORY_PET*/
|
||||
case SUMMON_CATEGORY_PUPPET:
|
||||
if (m_caster->GetCharmGUID())
|
||||
if (m_caster->GetCharmedGUID())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
break;
|
||||
}
|
||||
@@ -6123,7 +6123,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
}
|
||||
|
||||
if (m_caster->GetCharmGUID())
|
||||
if (m_caster->GetCharmedGUID())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
break;
|
||||
}
|
||||
@@ -6241,7 +6241,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && m_caster->GetPetGUID())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if (m_caster->GetCharmGUID())
|
||||
if (m_caster->GetCharmedGUID())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
}
|
||||
|
||||
|
||||
@@ -1638,10 +1638,8 @@ public:
|
||||
if (!player)
|
||||
return false;
|
||||
Creature* target = handler->getSelectedCreature();
|
||||
if (!target || !target->IsAIEnabled || !target->AI())
|
||||
{
|
||||
if (!target || !target->IsAIEnabled())
|
||||
return false;
|
||||
}
|
||||
|
||||
char* fill_str = args ? strtok((char*)args, " ") : nullptr;
|
||||
char* duration_str = args ? strtok(nullptr, " ") : nullptr;
|
||||
|
||||
@@ -1547,7 +1547,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!creatureTarget->IsAIEnabled)
|
||||
if (!creatureTarget->IsAIEnabled())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_CREATURE_NOT_AI_ENABLED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
{
|
||||
if (InstanceScript* instance = player->GetInstanceScript())
|
||||
if (Creature* alizabal = instance->GetCreature(DATA_ALIZABAL))
|
||||
if (alizabal->IsAIEnabled)
|
||||
if (alizabal->IsAIEnabled())
|
||||
alizabal->AI()->DoAction(ACTION_INTRO);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1997,7 +1997,7 @@ class spell_ignacious_inferno_leap final : public SpellScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_CAST_INFERNO_RUSH);
|
||||
}
|
||||
|
||||
@@ -2178,7 +2178,7 @@ class spell_arion_disperse final : public SpellScript
|
||||
caster->CastSpell(GetHitUnit(), GetSpellInfo()->Effects[effIndex].BasePoints, true);
|
||||
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_CAST_LIGHTNING_BLAST);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ struct boss_beauty : public BossAI
|
||||
for (ObjectGuid guid : summons)
|
||||
if (Creature* puppy = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (puppy->GetEntry() != NPC_RUNTY && !puppy->IsInCombat())
|
||||
if (puppy->IsAIEnabled)
|
||||
if (puppy->IsAIEnabled())
|
||||
puppy->AI()->DoZoneInCombat();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -141,7 +141,7 @@ struct boss_corla_herald_of_twilight : public BossAI
|
||||
|
||||
for (ObjectGuid guid : summons)
|
||||
if (Creature* zealot = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (zealot->IsAIEnabled)
|
||||
if (zealot->IsAIEnabled())
|
||||
zealot->AI()->DoAction(ACTION_START_EVOLUTION);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ class spell_corla_evolution : public SpellScript
|
||||
corla->AI()->Talk(SAY_EVOLUTION_COMPLETE);
|
||||
if (Creature* creature = target->ToCreature())
|
||||
{
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
{
|
||||
corla->AI()->Talk(SAY_ANNOUNCE_ZEALOT_EVOLVED);
|
||||
creature->AI()->DoAction(ACTION_EVOLVE);
|
||||
@@ -527,7 +527,7 @@ class achievement_arrested_development : public AchievementCriteriaScript
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
return target->GetAI()->GetData(DATA_ARRESTED_DEVELOPMENT);
|
||||
|
||||
return false;
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ class AttackStartEvent : public BasicEvent
|
||||
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
|
||||
{
|
||||
_owner->SetReactState(REACT_AGGRESSIVE);
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
_owner->AI()->DoZoneInCombat();
|
||||
return true;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class spell_karsh_superheated_quicksilver_armor_AuraScript : public AuraScript
|
||||
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* creature = GetTarget()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_ANNOUNCE_SUPERHEATED_QUICKSILVER_ARMOR);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -71,7 +71,7 @@ class AttackStartEvent : public BasicEvent
|
||||
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
|
||||
{
|
||||
_owner->SetReactState(REACT_AGGRESSIVE);
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
_owner->AI()->DoZoneInCombat();
|
||||
return true;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ class spell_romogg_call_for_help : public SpellScript
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* creature = GetHitCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoZoneInCombat();
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ class achievement_crushing_bones_and_cracking_skulls : public AchievementCriteri
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
return target->GetAI()->GetData(DATA_CRUSHING_BONES_AND_CRACKING_SKULLS);
|
||||
|
||||
return false;
|
||||
|
||||
+9
-9
@@ -382,7 +382,7 @@ struct boss_atramedes : public BossAI
|
||||
events.ScheduleEvent(EVENT_LIFTOFF, 1min + 33s, 0, PHASE_GROUND);
|
||||
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_ATRAMEDES))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_START_SUMMONING_FIENDS);
|
||||
break;
|
||||
default:
|
||||
@@ -467,7 +467,7 @@ struct boss_atramedes : public BossAI
|
||||
me->GetMotionMaster()->MoveTakeoff(POINT_LIFTOFF, LiftoffPosition);
|
||||
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_ATRAMEDES))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_STOP_SUMMONING_FIENDS);
|
||||
break;
|
||||
case EVENT_MOVE_REVERBERATING_FLAME_TO_SHIELD:
|
||||
@@ -759,7 +759,7 @@ class spell_atramedes_resonating_clash_ground : public SpellScript
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Creature* target = GetHitCreature();
|
||||
if (!target || !caster || !target->IsAIEnabled)
|
||||
if (!target || !caster || !target->IsAIEnabled())
|
||||
return;
|
||||
|
||||
target->AI()->SetGUID(caster->GetGUID(), DATA_LAST_USED_ANCIENT_DWARVEN_SHIELD);
|
||||
@@ -782,7 +782,7 @@ class spell_atramedes_resonating_clash_air : public SpellScript
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Creature* target = GetHitCreature();
|
||||
if (!target || !caster || !target->IsAIEnabled)
|
||||
if (!target || !caster || !target->IsAIEnabled())
|
||||
return;
|
||||
|
||||
if (Unit* shield = GetSpell()->GetOriginalCaster())
|
||||
@@ -870,7 +870,7 @@ class spell_atramedes_vertigo : public AuraScript
|
||||
|
||||
if (Creature* atramedes = target->ToCreature())
|
||||
{
|
||||
if (atramedes->IsAIEnabled)
|
||||
if (atramedes->IsAIEnabled())
|
||||
{
|
||||
if (InstanceScript* instance = atramedes->GetInstanceScript())
|
||||
{
|
||||
@@ -878,7 +878,7 @@ class spell_atramedes_vertigo : public AuraScript
|
||||
atramedes->GetMotionMaster()->MovePoint(POINT_PREPARE_LAND_INTRO, IntroFlightPosition2, false);
|
||||
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_ATRAMEDES))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_DESTROY_SHIELD);
|
||||
}
|
||||
}
|
||||
@@ -943,7 +943,7 @@ class spell_atramedes_devastation_trigger : public AuraScript
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
if (!target->AI()->GetData(DATA_HAS_NOISY_PLAYER))
|
||||
PreventDefaultAction();
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ class spell_atramedes_pestered : public AuraScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_PLAYER_ENTERED);
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ class spell_atramedes_pestered : public AuraScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_PLAYER_LEFT);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -162,7 +162,7 @@ struct boss_chimaeron : public BossAI
|
||||
DoSummon(NPC_LORD_VICTOR_NEFARIUS_GENERIC, LordVictorNefariusSummonPosition, 0, TEMPSUMMON_MANUAL_DESPAWN);
|
||||
|
||||
if (Creature * finkle = instance->GetCreature(DATA_FINKLE_EINHORN))
|
||||
if (finkle->IsAIEnabled)
|
||||
if (finkle->IsAIEnabled())
|
||||
finkle->AI()->DoAction(ACTION_ENCOUNTER_STARTED);
|
||||
}
|
||||
|
||||
@@ -192,16 +192,16 @@ struct boss_chimaeron : public BossAI
|
||||
me->RemoveAllAuras();
|
||||
|
||||
if (Creature* bileOTron = instance->GetCreature(DATA_BILE_O_TRON_800))
|
||||
if (bileOTron->IsAIEnabled)
|
||||
if (bileOTron->IsAIEnabled())
|
||||
bileOTron->AI()->DoAction(ACTION_SHUT_DOWN);
|
||||
|
||||
if (Creature* finkle = instance->GetCreature(DATA_FINKLE_EINHORN))
|
||||
if (finkle->IsAIEnabled)
|
||||
if (finkle->IsAIEnabled())
|
||||
finkle->AI()->DoAction(ACTION_CHIMAERON_DIED);
|
||||
|
||||
if (IsHeroic())
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_CHIMAERON_DEFEATED);
|
||||
|
||||
}
|
||||
@@ -230,7 +230,7 @@ struct boss_chimaeron : public BossAI
|
||||
|
||||
if (IsHeroic())
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_ENTER_PHASE_2);
|
||||
}
|
||||
}
|
||||
@@ -259,11 +259,11 @@ struct boss_chimaeron : public BossAI
|
||||
|
||||
if (roll_chance_i(_knockOutChance))
|
||||
{
|
||||
if (bileOTron->IsAIEnabled)
|
||||
if (bileOTron->IsAIEnabled())
|
||||
bileOTron->AI()->DoAction(ACTION_KNOCK_OUT_BILE_O_TRON);
|
||||
|
||||
if (Creature* finkle = instance->GetCreature(DATA_FINKLE_EINHORN))
|
||||
if (finkle->IsAIEnabled)
|
||||
if (finkle->IsAIEnabled())
|
||||
finkle->AI()->Talk(SAY_BILE_O_TRON_KNOCKED_OUT, me);
|
||||
|
||||
me->StopMoving();
|
||||
@@ -290,7 +290,7 @@ struct boss_chimaeron : public BossAI
|
||||
_isInFeud = true;
|
||||
if (IsHeroic())
|
||||
if (Creature* nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_STOP_FEUD);
|
||||
break;
|
||||
case ACTION_END_FEUD:
|
||||
@@ -386,7 +386,7 @@ struct npc_chimaeron_finkle_einhorn : public ScriptedAI
|
||||
{
|
||||
_events.Reset();
|
||||
if (Creature* bileOTron = _instance->GetCreature(DATA_BILE_O_TRON_800))
|
||||
if (bileOTron->IsAIEnabled)
|
||||
if (bileOTron->IsAIEnabled())
|
||||
bileOTron->AI()->DoAction(ACTION_ACTIVATE_BILE_O_TRON);
|
||||
|
||||
if (Creature* chimaeron = _instance->GetCreature(DATA_CHIMAERON))
|
||||
@@ -638,7 +638,7 @@ class spell_chimaeron_reroute_power : public AuraScript
|
||||
void HandleActivation(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_BILE_O_TRON_BACK_ONLINE);
|
||||
}
|
||||
|
||||
@@ -653,14 +653,14 @@ class spell_chimaeron_feud : public AuraScript
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_START_FEUD);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_END_FEUD);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1195,14 +1195,14 @@ class spell_magmaw_massive_crash : public AuraScript
|
||||
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* magmaw = GetTarget()->ToCreature())
|
||||
if (magmaw->IsAIEnabled)
|
||||
if (magmaw->IsAIEnabled())
|
||||
magmaw->AI()->DoAction(ACTION_ENABLE_MOUNTING);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* magmaw = GetTarget()->ToCreature())
|
||||
if (magmaw->IsAIEnabled)
|
||||
if (magmaw->IsAIEnabled())
|
||||
magmaw->AI()->DoAction(ACTION_DISABLE_MOUNTING);
|
||||
}
|
||||
|
||||
@@ -1218,14 +1218,14 @@ class spell_magmaw_impale_self : public AuraScript
|
||||
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* magmaw = GetTarget()->ToCreature())
|
||||
if (magmaw->IsAIEnabled)
|
||||
if (magmaw->IsAIEnabled())
|
||||
magmaw->AI()->DoAction(ACTION_EXPOSE_HEAD);
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* magmaw = GetTarget()->ToCreature())
|
||||
if (magmaw->IsAIEnabled)
|
||||
if (magmaw->IsAIEnabled())
|
||||
magmaw->AI()->DoAction(ACTION_COVER_HEAD);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -292,7 +292,7 @@ struct boss_maloriak : public BossAI
|
||||
_JustDied();
|
||||
|
||||
if (Creature * nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_MALORIAK))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_MALORIAK_DEAD);
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ struct boss_maloriak : public BossAI
|
||||
// According to sniffs, the cauldron stalker leaves combat after 8 seconds
|
||||
cauldron->m_Events.AddEventAtOffset([cauldron]()
|
||||
{
|
||||
if (cauldron->IsAIEnabled)
|
||||
if (cauldron->IsAIEnabled())
|
||||
cauldron->AI()->EnterEvadeMode();
|
||||
}, 8s);
|
||||
cauldron->CastSpell(cauldron, SPELL_DEBILITATING_SLIME_DEBUFF);
|
||||
@@ -481,7 +481,7 @@ struct boss_maloriak : public BossAI
|
||||
if (_currentVial != VIAL_BLACK)
|
||||
Talk(vialData[_currentVial].SayTextId);
|
||||
else if (Creature * nefarius = instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_MALORIAK))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_THROW_BLACK_BOTTLE);
|
||||
|
||||
_usedVialsCount = _usedVialsCount < _vialsPerCycle ? _usedVialsCount + 1 : 0;
|
||||
@@ -1079,7 +1079,7 @@ class spell_maloriak_release_experiments : public SpellScript
|
||||
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_RELEASE_EXPERIMENT);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -490,7 +490,7 @@ struct boss_nefarians_end : public BossAI
|
||||
machine->CastSpell(machine, SPELL_ELECTROCUTE);
|
||||
|
||||
if (Creature* onyxia = instance->GetCreature(DATA_ONYXIA))
|
||||
if (onyxia->IsAIEnabled)
|
||||
if (onyxia->IsAIEnabled())
|
||||
onyxia->AI()->DoAction(ACTION_REANIMATED);
|
||||
|
||||
SetupTransportSpawns(SUMMON_GROUP_CONTROLLER_STALKER);
|
||||
@@ -667,7 +667,7 @@ struct boss_nefarians_end : public BossAI
|
||||
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, FRAME_INDEX_NEFARIAN);
|
||||
events.ScheduleEvent(EVENT_ENGAGE_PLAYERS, 2s, 0, PHASE_ONE);
|
||||
if (Creature* onyxia = instance->GetCreature(DATA_ONYXIA))
|
||||
if (onyxia->IsAIEnabled)
|
||||
if (onyxia->IsAIEnabled())
|
||||
onyxia->AI()->DoAction(ACTION_NEFARIAN_LANDED);
|
||||
}
|
||||
else if (events.IsInPhase(PHASE_THREE))
|
||||
@@ -886,7 +886,7 @@ private:
|
||||
for (ObjectGuid guid : summons)
|
||||
{
|
||||
if (Creature* creature = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (creature->GetEntry() == NPC_CHROMATIC_PROTOTYPE && creature->IsAlive() && creature->IsAIEnabled)
|
||||
if (creature->GetEntry() == NPC_CHROMATIC_PROTOTYPE && creature->IsAlive() && creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_DISENGAGE_PLAYERS);
|
||||
}
|
||||
}
|
||||
@@ -940,7 +940,7 @@ struct npc_nefarians_end_onyxia : public ScriptedAI
|
||||
|
||||
if (Creature* controller = _instance->GetCreature(DATA_CONTROLLER_STALKER))
|
||||
{
|
||||
if (controller->IsAIEnabled)
|
||||
if (controller->IsAIEnabled())
|
||||
controller->AI()->DoZoneInCombat();
|
||||
|
||||
controller->CastSpell(controller, SPELL_PET_HACK_1);
|
||||
@@ -1156,7 +1156,7 @@ struct npc_nefarians_end_animated_bone_warrior : public ScriptedAI
|
||||
me->m_Events.AddEventAtOffset([this]()
|
||||
{
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
if (me->IsAIEnabled)
|
||||
if (me->IsAIEnabled())
|
||||
DoZoneInCombat();
|
||||
}, 800ms);
|
||||
}
|
||||
@@ -1298,7 +1298,7 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
|
||||
_summonedByController = true;
|
||||
|
||||
if (Creature* nefarian = _instance->GetCreature(DATA_NEFARIANS_END))
|
||||
if (nefarian->IsAIEnabled)
|
||||
if (nefarian->IsAIEnabled())
|
||||
nefarian->AI()->JustSummoned(me);
|
||||
}
|
||||
|
||||
@@ -1407,7 +1407,7 @@ class spell_nefarians_end_electrical_charge : public AuraScript
|
||||
break;
|
||||
case NPC_ONYXIA:
|
||||
ModStackAmount(1);
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_UPDATE_ELECTRICAL_CHARGE);
|
||||
break;
|
||||
default:
|
||||
@@ -1596,7 +1596,7 @@ class spell_nefarians_end_shadowflame_breath : public SpellScript
|
||||
if (target->HasAura(SPELL_PERMANENT_FEIGN_DEATH_2))
|
||||
{
|
||||
target->SetReactState(REACT_AGGRESSIVE);
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoZoneInCombat();
|
||||
|
||||
target->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH_2);
|
||||
@@ -1696,7 +1696,7 @@ class spell_nefarians_end_onyxia_start_fight_2_effect : public SpellScript
|
||||
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
{
|
||||
if (caster->IsAIEnabled && !caster->IsInCombat())
|
||||
if (caster->IsAIEnabled() && !caster->IsInCombat())
|
||||
caster->AI()->DoZoneInCombat();
|
||||
|
||||
if (target->GetTransOffsetZ() > 9.5f)
|
||||
@@ -1783,7 +1783,7 @@ class spell_nefarians_end_brushfire_growth : public AuraScript
|
||||
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Creature* creature = GetTarget()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_SPREAD_FLAMES);
|
||||
}
|
||||
|
||||
@@ -1814,7 +1814,7 @@ class spell_nefarians_end_shadowblaze : public SpellScript
|
||||
if (target->HasAura(SPELL_PERMANENT_FEIGN_DEATH_2))
|
||||
{
|
||||
target->SetReactState(REACT_AGGRESSIVE);
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoZoneInCombat();
|
||||
|
||||
target->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH_2);
|
||||
@@ -2039,7 +2039,7 @@ struct go_nefarians_end_orb_of_culmination : public GameObjectAI
|
||||
stalker->RemoveAllAuras();
|
||||
|
||||
if (Creature* nefarius = _instance->GetCreature(DATA_LORD_VICTOR_NEFARIUS_NEFARIANS_END))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->DoAction(ACTION_START_INTRO);
|
||||
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
+2
-2
@@ -1243,7 +1243,7 @@ class spell_omnotron_recharging : public AuraScript
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Creature* golem = GetTarget()->ToCreature())
|
||||
if (golem->IsAIEnabled)
|
||||
if (golem->IsAIEnabled())
|
||||
golem->AI()->DoAction(ACTION_ACTIVATE_GOLEM);
|
||||
}
|
||||
|
||||
@@ -1292,7 +1292,7 @@ class spell_omnotron_inactive : public SpellScript
|
||||
Unit* target = GetHitUnit();
|
||||
target->CastSpell(target, SPELL_POWERED_DOWN, true);
|
||||
if (Creature* golem = target->ToCreature())
|
||||
if (golem->IsAIEnabled)
|
||||
if (golem->IsAIEnabled())
|
||||
golem->AI()->DoAction(ACTION_DEACTIVATE_GOLEM);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -244,7 +244,7 @@ class instance_blackwing_descent : public InstanceMapScript
|
||||
|
||||
if (state == DONE)
|
||||
if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->SetData(DATA_BOSS_DEFEATED, type);
|
||||
|
||||
_roomStalkerGUIDs.clear();
|
||||
@@ -255,7 +255,7 @@ class instance_blackwing_descent : public InstanceMapScript
|
||||
case DATA_MALORIAK:
|
||||
if (state == DONE)
|
||||
if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->SetData(DATA_BOSS_DEFEATED, type);
|
||||
break;
|
||||
case DATA_ATRAMEDES:
|
||||
@@ -268,7 +268,7 @@ class instance_blackwing_descent : public InstanceMapScript
|
||||
{
|
||||
instance->SpawnGroupDespawn(SPAWN_GROUP_ANCIENT_DWARVEN_SHIELDS, false);
|
||||
if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC))
|
||||
if (nefarius->IsAIEnabled)
|
||||
if (nefarius->IsAIEnabled())
|
||||
nefarius->AI()->SetData(DATA_BOSS_DEFEATED, type);
|
||||
}
|
||||
break;
|
||||
@@ -342,7 +342,7 @@ class instance_blackwing_descent : public InstanceMapScript
|
||||
atramedes->SetReactState(REACT_PASSIVE);
|
||||
atramedes->SendSetPlayHoverAnim(true);
|
||||
|
||||
if (atramedes->IsAIEnabled)
|
||||
if (atramedes->IsAIEnabled())
|
||||
atramedes->AI()->DoAction(ACTION_START_ATRAMEDES_INTRO);
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ class instance_blackwing_descent : public InstanceMapScript
|
||||
else
|
||||
nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS_GENERIC);
|
||||
|
||||
if (nefarius && nefarius->IsAIEnabled)
|
||||
if (nefarius && nefarius->IsAIEnabled())
|
||||
nefarius->AI()->SetData(DATA_HEROES_ENTERED_HALLS, DONE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ class spell_glubtok_blossom_targeting : public SpellScript
|
||||
{
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
{
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
{
|
||||
uint32 currentBlossomEntry = creature->AI()->GetData(DATA_CURRENT_BLOSSOM);
|
||||
targets.remove_if([currentBlossomEntry](WorldObject const* obj)->bool
|
||||
|
||||
@@ -285,7 +285,7 @@ struct boss_helix_gearbreaker : public BossAI
|
||||
if (events.IsInPhase(PHASE_1))
|
||||
{
|
||||
if (Creature* crew = DoSummon(NPC_HELIX_CREW, HelixFirstCrewPositions[i], 2 * IN_MILLISECONDS, TEMPSUMMON_CORPSE_TIMED_DESPAWN))
|
||||
if (!i && crew->IsAIEnabled)
|
||||
if (!i && crew->IsAIEnabled())
|
||||
crew->AI()->DoAction(ACTION_TALK_CREW);
|
||||
}
|
||||
else
|
||||
@@ -307,7 +307,7 @@ struct boss_helix_gearbreaker : public BossAI
|
||||
break;
|
||||
case EVENT_OAF_SMASH:
|
||||
if (Creature* oaf = instance->GetCreature(DATA_LUMBERING_OAF))
|
||||
if (oaf->IsAIEnabled)
|
||||
if (oaf->IsAIEnabled())
|
||||
oaf->AI()->DoAction(ACTION_OAF_SMASH);
|
||||
|
||||
events.RescheduleEvent(EVENT_STICKY_BOMB, 11s, 0, PHASE_1);
|
||||
@@ -344,7 +344,7 @@ struct npc_helix_lumbering_oaf : public ScriptedAI
|
||||
_instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
|
||||
|
||||
if (Creature* helix = _instance->GetCreature(DATA_HELIX_GEARBREAKER))
|
||||
if (helix->IsAIEnabled)
|
||||
if (helix->IsAIEnabled())
|
||||
helix->AI()->DoZoneInCombat();
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ class spell_helix_sticky_bomb_periodic_trigger : public AuraScript
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Creature* target = GetTarget()->ToCreature();
|
||||
if (!target || !target->IsAIEnabled)
|
||||
if (!target || !target->IsAIEnabled())
|
||||
return;
|
||||
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell);
|
||||
@@ -812,7 +812,7 @@ class spell_helix_chest_bomb_emote : public SpellScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->Talk(SAY_ANNOUNCE_CHEST_BOMB, GetHitUnit());
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ class npc_worgen_runt : public CreatureScript
|
||||
break;
|
||||
case EVENT_AGGRO_PLAYER:
|
||||
if (Unit* player = ObjectAccessor::GetPlayer(*me, _playerGuid))
|
||||
if (me->IsAIEnabled && me->IsInDist(player->GetPosition(), 100.0f))
|
||||
if (me->IsAIEnabled() && me->IsInDist(player->GetPosition(), 100.0f))
|
||||
me->AI()->AttackStart(player);
|
||||
break;
|
||||
default:
|
||||
@@ -534,7 +534,7 @@ class npc_greymanes_horse : public CreatureScript
|
||||
for (Unit* attacker : storedAttackers)
|
||||
{
|
||||
if (Creature* creature = attacker->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->EnterEvadeMode();
|
||||
}
|
||||
|
||||
@@ -662,7 +662,7 @@ class npc_crowleys_horse : public CreatureScript
|
||||
for (Unit* attacker : storedAttackers)
|
||||
{
|
||||
if (Creature* creature = attacker->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->EnterEvadeMode();
|
||||
}
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ class spell_gilneas_launch : public SpellScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
CAST_AI(npc_gilneas_forsaken_catapult, creature->AI())->SetTargetDestination(GetExplTargetDest()->GetPosition());
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ struct boss_drahga_shadowburner : public BossAI
|
||||
if (Creature* valiona = instance->GetCreature(DATA_VALIONA))
|
||||
{
|
||||
valiona->SetFacingToObject(summon);
|
||||
if (valiona->IsAIEnabled)
|
||||
if (valiona->IsAIEnabled())
|
||||
valiona->AI()->Talk(SAY_ANNOUNCE_DEVOURING_FLAMES);
|
||||
valiona->CastSpell(summon, SPELL_DEVOURING_FLAMES);
|
||||
}
|
||||
@@ -334,7 +334,7 @@ struct npc_drahga_valiona : public ScriptedAI
|
||||
DoZoneInCombat();
|
||||
|
||||
if (Creature* drahga = _instance->GetCreature(DATA_DRAHGA_SHADOWBURNER))
|
||||
if (drahga->IsAIEnabled)
|
||||
if (drahga->IsAIEnabled())
|
||||
drahga->AI()->DoAction(ACTION_SCHEDULE_EVENTS);
|
||||
|
||||
_events.ScheduleEvent(EVENT_SHREDDING_SWIPE, 1s);
|
||||
@@ -377,7 +377,7 @@ struct npc_drahga_valiona : public ScriptedAI
|
||||
drahga->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
drahga->SetReactState(REACT_AGGRESSIVE);
|
||||
|
||||
if (drahga->IsAIEnabled)
|
||||
if (drahga->IsAIEnabled())
|
||||
drahga->AI()->DoAction(ACTION_ENTER_PHASE_THREE);
|
||||
}
|
||||
_finished = true;
|
||||
|
||||
@@ -507,7 +507,7 @@ class spell_erudax_twilight_corruption_AuraScript : public AuraScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_FINISH_CORRUPTION);
|
||||
|
||||
if (Unit* owner = GetOwner()->ToUnit())
|
||||
|
||||
@@ -462,7 +462,7 @@ class spell_throngus_personal_phalanx : public SpellScriptLoader
|
||||
target->CastSpell(target, aurEff->GetAmount(), true);
|
||||
|
||||
if (Creature * throngus = target->ToCreature())
|
||||
if (throngus->IsAIEnabled)
|
||||
if (throngus->IsAIEnabled())
|
||||
throngus->AI()->DoAction(ACTION_START_PHALLANX);
|
||||
|
||||
target->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
|
||||
@@ -472,7 +472,7 @@ class spell_throngus_personal_phalanx : public SpellScriptLoader
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Creature* throngus = target->ToCreature())
|
||||
if (throngus->IsAIEnabled)
|
||||
if (throngus->IsAIEnabled())
|
||||
throngus->AI()->DoAction(ACTION_END_PHALLANX);
|
||||
|
||||
target->ModifyAuraState(AURA_STATE_UNKNOWN22, false);
|
||||
|
||||
@@ -393,9 +393,10 @@ struct npc_eye_of_acherus : public ScriptedAI
|
||||
_events.ScheduleEvent(EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION, 7s);
|
||||
}
|
||||
|
||||
void OnCharmed(bool apply) override
|
||||
void OnCharmed(bool /*isNew*/) override
|
||||
{
|
||||
if (!apply)
|
||||
bool const charmed = me->IsCharmed();
|
||||
if (!charmed)
|
||||
{
|
||||
me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_THE_EYE_OF_ACHERUS);
|
||||
me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST);
|
||||
|
||||
@@ -154,7 +154,7 @@ struct npc_scarlet_commander_mograine : public ScriptedAI
|
||||
me->RemoveAllAuras();
|
||||
|
||||
if (Creature* whitemane = _instance->GetCreature(DATA_HIGH_INQUISITOR_WHITEMANE))
|
||||
if (whitemane->IsAIEnabled)
|
||||
if (whitemane->IsAIEnabled())
|
||||
whitemane->AI()->DoAction(ACTION_MOGRAINE_DIED);
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@ struct npc_high_inquisitor_whitemane : public ScriptedAI
|
||||
_events.ScheduleEvent(EVENT_REENGAGE_PLAYERS, 5s);
|
||||
|
||||
if (Creature* mograine = _instance->GetCreature(DATA_SCARLET_COMMANDER_MOGRAINE))
|
||||
if (mograine->IsAIEnabled)
|
||||
if (mograine->IsAIEnabled())
|
||||
mograine->AI()->DoAction(ACTION_RESURRECTED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ struct npc_sfk_worgen_spirit : public ScriptedAI
|
||||
|
||||
_instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
|
||||
if (Creature* silverlaine = _instance->GetCreature(DATA_BARON_SILVERLAINE))
|
||||
if (silverlaine->IsAIEnabled)
|
||||
if (silverlaine->IsAIEnabled())
|
||||
silverlaine->AI()->JustSummoned(me);
|
||||
|
||||
DoZoneInCombat();
|
||||
|
||||
@@ -460,7 +460,7 @@ public:
|
||||
|
||||
if (aura)
|
||||
if (aura->GetStackAmount() == 3)
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->IsAIEnabled)
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->IsAIEnabled())
|
||||
target->ToCreature()->AI()->DoAction(ACTION_UNHOLY_POWER);
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ public:
|
||||
if (!aura)
|
||||
target->GetAura(SPELL_UNHOLY_POWER);
|
||||
|
||||
if (aura && aura->GetStackAmount() == 3 && target->IsAIEnabled)
|
||||
if (aura && aura->GetStackAmount() == 3 && target->IsAIEnabled())
|
||||
target->ToCreature()->AI()->DoAction(ACTION_UNHOLY_POWER);
|
||||
|
||||
if (InstanceScript* instance = target->GetInstanceScript())
|
||||
|
||||
@@ -121,7 +121,7 @@ struct boss_lord_godfrey : public BossAI
|
||||
summon->SetReactState(REACT_PASSIVE);
|
||||
summon->m_Events.AddEventAtOffset([summon]()
|
||||
{
|
||||
if (summon->IsAIEnabled)
|
||||
if (summon->IsAIEnabled())
|
||||
summon->AI()->DoZoneInCombat();
|
||||
}, 1s + 300ms);
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ class spell_walden_ice_shards : public AuraScript
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
if (Unit* target = caster->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
|
||||
caster->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
break;
|
||||
case NPC_PISTOL_BARRAGE_DUMMY:
|
||||
if (Creature* godfrey = GetCreature(DATA_LORD_GODFREY))
|
||||
if (godfrey->IsAIEnabled)
|
||||
if (godfrey->IsAIEnabled())
|
||||
godfrey->AI()->JustSummoned(creature);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
bool _OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
|
||||
{
|
||||
if (Creature* berserker = player->FindNearestCreature(NPC_BLOODFANG_BERSERKER, 15.f, true))
|
||||
if (berserker->IsAIEnabled)
|
||||
if (berserker->IsAIEnabled())
|
||||
berserker->AI()->Talk(SAY_SHOW_COMMANDER_SPRINGVALE, player);
|
||||
|
||||
return true;
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
bool _OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
|
||||
{
|
||||
if (Creature* ivar = player->FindNearestCreature(NPC_PACKLEADER_IVAR_BLOODFANG, 15.f))
|
||||
if (ivar->IsAIEnabled)
|
||||
if (ivar->IsAIEnabled())
|
||||
ivar->AI()->Talk(SAY_IVAR_WALDEN_INTRO, player);
|
||||
|
||||
return true;
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
if (InstanceScript* instance = player->GetInstanceScript())
|
||||
{
|
||||
if (Creature* announcer = instance->GetCreature(DATA_DEBUG_ANNOUNCER))
|
||||
if (announcer->IsAIEnabled)
|
||||
if (announcer->IsAIEnabled())
|
||||
announcer->AI()->Talk(SAY_ANNOUNCE_GARGOYLES);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -109,7 +109,7 @@ class DelayedAttackEvent : public BasicEvent
|
||||
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
|
||||
{
|
||||
_owner->SetReactState(REACT_AGGRESSIVE);
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
_owner->AI()->DoZoneInCombat();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class AttackNeptulonEvent : public BasicEvent
|
||||
if (Creature* neptulon = instance->GetCreature(DATA_NEPTULON))
|
||||
{
|
||||
_owner->SetReactState(REACT_AGGRESSIVE);
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
{
|
||||
if (_owner->GetEntry() == NPC_UNYIELDING_BEHEMOTH
|
||||
|| _owner->GetEntry() == NPC_VICIOUS_MINDLASHER
|
||||
|
||||
+2
-2
@@ -445,7 +445,7 @@ class instance_throne_of_the_tides : public InstanceMapScript
|
||||
trigger->CastSpell(trigger, SPELL_SHOCK_DEFENSE, true);
|
||||
|
||||
if (Creature* ozumatVehicle = GetCreature(DATA_OZUMAT_VEHICLE_BIG))
|
||||
if (ozumatVehicle->IsAIEnabled)
|
||||
if (ozumatVehicle->IsAIEnabled())
|
||||
ozumatVehicle->AI()->DoAction(ACTION_DEFENSE_SYSTEM_ACTIVATED);
|
||||
|
||||
if (GameObject* door1 = GetGameObject(DATA_INVISIBLE_DOOR_1))
|
||||
@@ -526,7 +526,7 @@ class instance_throne_of_the_tides : public InstanceMapScript
|
||||
case NPC_NAZJAR_INVADER_2:
|
||||
case NPC_NAZJAR_SPIRITMENDER_2:
|
||||
if (Creature* nazjar = GetCreature(DATA_LADY_NAZJAR_GAUNTLET))
|
||||
if (nazjar->IsAIEnabled)
|
||||
if (nazjar->IsAIEnabled())
|
||||
nazjar->AI()->SummonedCreatureDies(who->ToCreature(), nullptr);
|
||||
break;
|
||||
case NPC_TAINTED_SENTRY:
|
||||
|
||||
@@ -206,7 +206,7 @@ struct npc_tott_lady_nazjar : public ScriptedAI
|
||||
{
|
||||
if (Creature* murloc = ObjectAccessor::GetCreature(*me, guid))
|
||||
{
|
||||
if (murloc->IsAIEnabled)
|
||||
if (murloc->IsAIEnabled())
|
||||
{
|
||||
murloc->InterruptNonMeleeSpells(false);
|
||||
murloc->AI()->DoZoneInCombat();
|
||||
@@ -229,7 +229,7 @@ struct npc_tott_lady_nazjar : public ScriptedAI
|
||||
{
|
||||
if (Creature* murloc = target->ToCreature())
|
||||
{
|
||||
if (murloc->IsAIEnabled)
|
||||
if (murloc->IsAIEnabled())
|
||||
{
|
||||
murloc->InterruptNonMeleeSpells(false);
|
||||
murloc->AI()->DoZoneInCombat();
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
break;
|
||||
case NPC_AMANI_DRAGONHAWK_HATCHLING:
|
||||
if (Creature* janalai = GetCreature(DATA_JANALAI))
|
||||
if (janalai->IsAIEnabled)
|
||||
if (janalai->IsAIEnabled())
|
||||
janalai->AI()->JustSummoned(creature);
|
||||
break;
|
||||
default:
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
_speedRunState = IN_PROGRESS;
|
||||
|
||||
if (Creature* trigger = GetCreature(DATA_HEXLORD_MALACRASS_TRIGGER))
|
||||
if (trigger->IsAIEnabled)
|
||||
if (trigger->IsAIEnabled())
|
||||
trigger->AI()->Talk(SAY_SPEEDRUN_STARTED);
|
||||
|
||||
DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER_ENABLED, 1);
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
for (ObjectGuid guid : _amanishiGuardianGUIDs)
|
||||
{
|
||||
if (Creature* guardian = instance->GetCreature(guid))
|
||||
if (guardian->IsAIEnabled)
|
||||
if (guardian->IsAIEnabled())
|
||||
guardian->AI()->DoAction(ACTION_ALERT_AMANISHI_GUARDIANS);
|
||||
}
|
||||
break;
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
{
|
||||
case EVENT_RIUAL_OF_POWER:
|
||||
if (Creature* voljin = GetCreature(DATA_VOLJIN))
|
||||
if (voljin->IsAIEnabled)
|
||||
if (voljin->IsAIEnabled())
|
||||
voljin->AI()->DoAction(ACTION_OPEN_MASSIVE_GATES);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -145,7 +145,7 @@ class DelayedFollowEvent : public BasicEvent
|
||||
|
||||
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
|
||||
{
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
_owner->AI()->DoZoneInCombat();
|
||||
|
||||
if (TempSummon* summon = _owner->ToTempSummon())
|
||||
|
||||
@@ -434,7 +434,7 @@ class spell_kilnara_primal_awakening : public AuraScript
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* creature = GetTarget()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoZoneInCombat();
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class DelayedTalkEvent : public BasicEvent
|
||||
|
||||
bool Execute(uint64 /*time*/, uint32 /*diff*/) override
|
||||
{
|
||||
if (_owner->IsAIEnabled)
|
||||
if (_owner->IsAIEnabled())
|
||||
_owner->AI()->Talk(_textId);
|
||||
return true;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ struct boss_jindo_the_godbreaker : public BossAI
|
||||
if (Creature* summoner = creature->GetSummonerCreatureBase())
|
||||
{
|
||||
if (summoner->GetEntry() == NPC_SPIRIT_PORTAL)
|
||||
if (summon->IsAIEnabled)
|
||||
if (summon->IsAIEnabled())
|
||||
summon->AI()->DoZoneInCombat();
|
||||
}
|
||||
else
|
||||
@@ -381,7 +381,7 @@ struct boss_jindo_the_godbreaker : public BossAI
|
||||
}
|
||||
}
|
||||
|
||||
if (spirit->IsAIEnabled)
|
||||
if (spirit->IsAIEnabled())
|
||||
spirit->AI()->Talk(SAY_HAKKAR_FREED);
|
||||
|
||||
spirit->CastSpell(spirit, SPELL_HAKKAR_BREAKS_FREE);
|
||||
@@ -473,7 +473,7 @@ struct boss_jindo_the_godbreaker : public BossAI
|
||||
break;
|
||||
case EVENT_TALK_SPIRIT_OF_HAKKAR:
|
||||
if (Creature* hakkar = instance->GetCreature(DATA_SPIRIT_OF_HAKKAR))
|
||||
if (hakkar->IsAIEnabled)
|
||||
if (hakkar->IsAIEnabled())
|
||||
hakkar->AI()->Talk(SAY_HAKKAR_IMPRISONED);
|
||||
break;
|
||||
case EVENT_SHADOW_SPIKE:
|
||||
|
||||
@@ -483,7 +483,7 @@ class spell_zanzil_zanzili_fire : public AuraScript
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Creature* zanzil = GetTarget()->ToCreature())
|
||||
if (zanzil->IsAIEnabled)
|
||||
if (zanzil->IsAIEnabled())
|
||||
zanzil->AI()->DoAction(ACTION_CAST_ZANZILI_FLAME);
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ class spell_zanzil_zanzils_resurrection_elixir_red_script : public SpellScript
|
||||
|
||||
// This is ugly as fuck but there is no other way to get already targeted zombies
|
||||
if (Creature* creature = GetCaster()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
targets.remove_if(UnusedGuidTargetSelector(CAST_AI(boss_zanzil, creature->AI())->GetAlreadyTargetedObjectGuids()));
|
||||
|
||||
if (targets.empty())
|
||||
@@ -571,7 +571,7 @@ class spell_zanzil_zanzils_resurrection_elixir_red_script : public SpellScript
|
||||
target->SetAIAnimKitId(AI_ANIM_KIT_ID_NONE);
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
{
|
||||
target->AI()->DoZoneInCombat();
|
||||
target->m_Events.AddEvent(new DelayedAttackStartEvent(target), target->m_Events.CalculateTime(3500));
|
||||
@@ -582,7 +582,7 @@ class spell_zanzil_zanzils_resurrection_elixir_red_script : public SpellScript
|
||||
void HandleGuidReservation(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
if (Creature* target = GetHitCreature())
|
||||
caster->AI()->SetGUID(target->GetGUID());
|
||||
}
|
||||
@@ -616,7 +616,7 @@ class spell_zanzil_zanzils_graveyard_gas : public SpellScript
|
||||
|
||||
// This is ugly as fuck but there is no other way to get already targeted gas stalkers
|
||||
if (Creature* creature = GetCaster()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
targets.remove_if(UnusedGuidTargetSelector(CAST_AI(boss_zanzil, creature->AI())->GetAlreadyTargetedObjectGuids()));
|
||||
|
||||
if (targets.empty())
|
||||
@@ -637,7 +637,7 @@ class spell_zanzil_zanzils_graveyard_gas : public SpellScript
|
||||
void HandleGuidReservation(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
if (Creature* target = GetHitCreature())
|
||||
caster->AI()->SetGUID(target->GetGUID());
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class spell_zulgurub_rolling_boulders : public AuraScript
|
||||
// Serverside spell. We just skip that part and do it directly via script
|
||||
PreventDefaultAction();
|
||||
if (Creature* creature = GetTarget()->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_ROLL_BOULDER);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ struct npc_blackrock_battle_worg : public ScriptedAI
|
||||
_infantryGUID = infantry->GetGUID();
|
||||
AttackStart(infantry);
|
||||
|
||||
if (infantry->IsAIEnabled)
|
||||
if (infantry->IsAIEnabled())
|
||||
infantry->AI()->AttackStart(me);
|
||||
}
|
||||
}, 1s);
|
||||
|
||||
@@ -572,7 +572,7 @@ public:
|
||||
{
|
||||
if (Creature* spot = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (spot->GetDistance(pos) <= 5.0f)
|
||||
if (spot->IsAIEnabled)
|
||||
if (spot->IsAIEnabled())
|
||||
if (spot->AI()->GetData(DATA_CURRENT_ENTRY) == NPC_EMPTY_SPOT)
|
||||
return true;
|
||||
}
|
||||
@@ -738,7 +738,7 @@ struct npc_brazie_fertilitize_o_tron_2000 : public ScriptedAI
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
|
||||
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->JustSummoned(me);
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ struct npc_brazie_spot : public ScriptedAI
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
|
||||
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->JustSummoned(me);
|
||||
}
|
||||
|
||||
@@ -953,7 +953,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
me->SetWalk(true);
|
||||
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->JustSummoned(me);
|
||||
|
||||
for (uint8 i = 0; i < MAX_TARGET_POSITIONS; i++)
|
||||
@@ -993,7 +993,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
{
|
||||
if (Creature* target = who->ToCreature())
|
||||
{
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
{
|
||||
if (target->AI()->GetData(DATA_CURRENT_ENTRY) != NPC_EMPTY_SPOT || target->GetEntry() == NPC_FERTILITIZE_O_TRON_2000)
|
||||
{
|
||||
@@ -1011,7 +1011,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->DoAction(ACTION_ZOMBIE_DIED);
|
||||
|
||||
me->DespawnOrUnsummon(4s);
|
||||
@@ -1035,7 +1035,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
{
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
{
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
{
|
||||
if (me->GetEntry() == NPC_ZOMBIE)
|
||||
vehicle->AI()->DoAction(ACTION_ZOMBIE_DAMAGED);
|
||||
@@ -1060,7 +1060,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->DoAction(ACTION_QUEST_FAILED);
|
||||
}
|
||||
|
||||
@@ -1084,7 +1084,7 @@ struct npc_brazie_zombie : public ScriptedAI
|
||||
{
|
||||
if (Creature* target = victim->ToCreature())
|
||||
{
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
{
|
||||
if (target->AI()->GetData(DATA_CURRENT_ENTRY) == NPC_EMPTY_SPOT)
|
||||
{
|
||||
@@ -1133,7 +1133,7 @@ struct npc_brazie_vehicle_notifier : public ScriptedAI
|
||||
}
|
||||
|
||||
if (Creature* vehicle = summoner->GetVehicleCreatureBase())
|
||||
if (vehicle->IsAIEnabled)
|
||||
if (vehicle->IsAIEnabled())
|
||||
vehicle->AI()->JustSummoned(me);
|
||||
}
|
||||
|
||||
@@ -1196,7 +1196,7 @@ class spell_brazie_summon_plant : public SpellScript
|
||||
|
||||
Creature* creature = caster->ToCreature();
|
||||
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
{
|
||||
if (creature->HasAura(SPELL_SUNFLOWER_HIGHLIGHT))
|
||||
creature->AI()->DoAction(ACTION_FIRST_SUNFLOWER_PLANTED);
|
||||
|
||||
@@ -362,7 +362,7 @@ struct npc_westfall_hobo_witness : public ScriptedAI
|
||||
|
||||
void JustDied(Unit* who) override
|
||||
{
|
||||
if (who->IsCreature() && who->ToCreature()->IsAIEnabled)
|
||||
if (who->IsCreature() && who->ToCreature()->IsAIEnabled())
|
||||
who->ToCreature()->AI()->DoAction(ACTION_AGGRO_HOBO_DONE);
|
||||
me->CastSpell(me, SPELL_SUMMON_RAGAMUFFIN_LOOTER);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ class spell_westfall_aggro_hobo : public SpellScript
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* creature = GetHitCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->SetGUID(GetCaster()->GetGUID(), 0);
|
||||
}
|
||||
|
||||
@@ -637,13 +637,13 @@ struct npc_westfall_refugee_bridge_to_sentinelhill : public ScriptedAI
|
||||
|
||||
if (guard1 && guard2 && !guard1->IsInCombat() && !guard2->IsInCombat())
|
||||
{
|
||||
if (guard1->IsAIEnabled)
|
||||
if (guard1->IsAIEnabled())
|
||||
{
|
||||
guard1->AI()->DoAction(ACTION_SENTINEL_HILL_GATE_1);
|
||||
guard1->AI()->SetGUID(me->GetGUID(), 0);
|
||||
}
|
||||
|
||||
if (guard2->IsAIEnabled)
|
||||
if (guard2->IsAIEnabled())
|
||||
{
|
||||
guard2->AI()->DoAction(ACTION_SENTINEL_HILL_GATE_2);
|
||||
guard2->AI()->SetGUID(me->GetGUID(), 0);
|
||||
@@ -656,7 +656,7 @@ struct npc_westfall_refugee_bridge_to_sentinelhill : public ScriptedAI
|
||||
else
|
||||
{
|
||||
if (creature)
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_SENTINEL_HILL_TALK_3);
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ struct npc_westfall_refugee_bridge_to_sentinelhill : public ScriptedAI
|
||||
else
|
||||
{
|
||||
if (creature)
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_SENTINEL_HILL_TALK_4);
|
||||
}
|
||||
|
||||
@@ -674,7 +674,7 @@ struct npc_westfall_refugee_bridge_to_sentinelhill : public ScriptedAI
|
||||
else
|
||||
{
|
||||
if (creature)
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_SENTINEL_HILL_TALK_5);
|
||||
}
|
||||
}
|
||||
@@ -703,7 +703,7 @@ struct npc_westfall_refugee_bridge_to_sentinelhill : public ScriptedAI
|
||||
case EVENT_CRIME_SCENE_DRIFTER_TALK_0:
|
||||
if (Creature* creature = me->FindNearestCreature(NPC_WEST_PLAINS_DRIFTER_FOLLOWER, 5.f))
|
||||
{
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_CRIME_SCENE);
|
||||
_westPlainsDrifter = creature->GetGUID();
|
||||
}
|
||||
@@ -920,7 +920,7 @@ public:
|
||||
if (player->IsAlive())
|
||||
if (player->GetQuestStatus(QUEST_LOUS_PARTING_THOUGHTS) == QUEST_STATUS_INCOMPLETE)
|
||||
if (Creature* lousPartingThoughtsTrigger = player->FindNearestCreature(MPC_LOUS_PARTING_THOUGHTS_TRIGGER, 50.0f, true))
|
||||
if (lousPartingThoughtsTrigger->IsAIEnabled)
|
||||
if (lousPartingThoughtsTrigger->IsAIEnabled())
|
||||
lousPartingThoughtsTrigger->AI()->SetGUID(player->GetGUID());
|
||||
|
||||
return true;
|
||||
@@ -941,7 +941,7 @@ struct npc_westfall_thug : public ScriptedAI
|
||||
{
|
||||
if (Unit* summon = me->ToTempSummon()->GetSummoner())
|
||||
if (Creature* creature = summon->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_THUG_RESET);
|
||||
|
||||
me->DespawnOrUnsummon();
|
||||
@@ -951,7 +951,7 @@ struct npc_westfall_thug : public ScriptedAI
|
||||
{
|
||||
if (Unit* summon = me->ToTempSummon()->GetSummoner())
|
||||
if (Creature* creature = summon->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->SetData(0, DATA_THUG_DEATH);
|
||||
}
|
||||
|
||||
@@ -1038,7 +1038,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Creature* thug1 = ObjectAccessor::GetCreature(*me, _summons[0]);
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug1)
|
||||
if (thug1->IsAIEnabled)
|
||||
if (thug1->IsAIEnabled())
|
||||
thug1->AI()->Talk(SAY_THUG_0, invoker);
|
||||
_events.ScheduleEvent(EVENT_THUG2_SAY_1, 5s);
|
||||
break;
|
||||
@@ -1048,7 +1048,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Creature* thug2 = ObjectAccessor::GetCreature(*me, _summons[1]);
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug2)
|
||||
if (thug2->IsAIEnabled)
|
||||
if (thug2->IsAIEnabled())
|
||||
thug2->AI()->Talk(SAY_THUG_1, invoker);
|
||||
_events.ScheduleEvent(EVENT_THUG2_SAY_2, 5s);
|
||||
break;
|
||||
@@ -1058,7 +1058,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Creature* thug2 = ObjectAccessor::GetCreature(*me, _summons[1]);
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug2)
|
||||
if (thug2->IsAIEnabled)
|
||||
if (thug2->IsAIEnabled())
|
||||
thug2->AI()->Talk(SAY_THUG_2, invoker);
|
||||
_events.ScheduleEvent(EVENT_THUG3_SAY_3, 8s + 500ms);
|
||||
break;
|
||||
@@ -1068,7 +1068,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Creature* thug3 = ObjectAccessor::GetCreature(*me, _summons[2]);
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug3)
|
||||
if (thug3->IsAIEnabled)
|
||||
if (thug3->IsAIEnabled())
|
||||
thug3->AI()->Talk(SAY_THUG_3, invoker);
|
||||
_events.ScheduleEvent(EVENT_THUG1_SAY_4, 5s);
|
||||
break;
|
||||
@@ -1079,7 +1079,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug1)
|
||||
{
|
||||
if (thug1->IsAIEnabled)
|
||||
if (thug1->IsAIEnabled())
|
||||
thug1->AI()->Talk(SAY_THUG_4, invoker);
|
||||
|
||||
for (ObjectGuid const& guid : _summons)
|
||||
@@ -1095,7 +1095,7 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Creature* thug1 = ObjectAccessor::GetCreature(*me, _summons[0]);
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug1)
|
||||
if (thug1->IsAIEnabled)
|
||||
if (thug1->IsAIEnabled())
|
||||
thug1->AI()->Talk(SAY_THUG_5, invoker);
|
||||
|
||||
|
||||
@@ -1108,14 +1108,14 @@ struct npc_westfall_lous_parting_thoughts_trigger : public ScriptedAI
|
||||
Player* invoker = ObjectAccessor::GetPlayer(*me, _eventInvokerGUID);
|
||||
if (invoker && thug1)
|
||||
{
|
||||
if (thug1->IsAIEnabled)
|
||||
if (thug1->IsAIEnabled())
|
||||
thug1->AI()->Talk(SAY_THUG_6, invoker);
|
||||
|
||||
for (ObjectGuid const& guid : _summons)
|
||||
if (Creature* thug = ObjectAccessor::GetCreature(*me, guid))
|
||||
{
|
||||
thug->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
if (thug->IsAIEnabled)
|
||||
if (thug->IsAIEnabled())
|
||||
thug->AI()->AttackStart(invoker);
|
||||
}
|
||||
}
|
||||
@@ -1212,7 +1212,7 @@ public:
|
||||
{
|
||||
if (player->IsAlive())
|
||||
if (Creature* lousPartingThoughtsTrigger = player->FindNearestCreature(NPC_SMALL_TIME_HUSTLER, 10.0f, true))
|
||||
if (lousPartingThoughtsTrigger->IsAIEnabled)
|
||||
if (lousPartingThoughtsTrigger->IsAIEnabled())
|
||||
lousPartingThoughtsTrigger->AI()->SetGUID(player->GetGUID());
|
||||
|
||||
return true;
|
||||
@@ -1593,7 +1593,7 @@ class spell_westfall_sniper_fire : public SpellScript
|
||||
if (Creature* agent = caster->FindNearestCreature(NPC_AGENT_KEARNEN, 100.f))
|
||||
{
|
||||
agent->CastSpell(target, SPELL_KILL_SHOT_TRIGGERED); // 79525
|
||||
if (agent->IsAIEnabled)
|
||||
if (agent->IsAIEnabled())
|
||||
agent->AI()->Talk(SAY_0, caster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ public:
|
||||
{
|
||||
epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
|
||||
AttackStart(epoch);
|
||||
if (epoch->IsAIEnabled)
|
||||
if (epoch->IsAIEnabled())
|
||||
epoch->AI()->AttackStart(me);
|
||||
}
|
||||
ScheduleActionOOC(RP3_ACTION_AFTER_EPOCH);
|
||||
@@ -1421,7 +1421,7 @@ public:
|
||||
malganis->AI()->Talk(RP5_LINE_MALGANIS1, ObjectAccessor::GetUnit(*malganis, _eventStarterGuid));
|
||||
malganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
|
||||
AttackStart(malganis);
|
||||
if (malganis->IsAIEnabled)
|
||||
if (malganis->IsAIEnabled())
|
||||
malganis->AI()->AttackStart(me);
|
||||
}
|
||||
ScheduleActionOOC(RP5_ACTION_AFTER_MALGANIS);
|
||||
@@ -1527,7 +1527,7 @@ public:
|
||||
{
|
||||
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
|
||||
me->AI()->AttackStart(target);
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->AttackStart(me);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -500,7 +500,7 @@ struct boss_madness_of_deathwing : public BossAI
|
||||
|
||||
for (ObjectGuid guid : _mutatedCorruptionGUIDs)
|
||||
if (Creature* corruption = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (corruption->IsAIEnabled)
|
||||
if (corruption->IsAIEnabled())
|
||||
corruption->AI()->EnterEvadeMode();
|
||||
|
||||
for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; i++)
|
||||
@@ -639,7 +639,7 @@ struct boss_madness_of_deathwing : public BossAI
|
||||
case ACTION_LIMB_TENTACLE_DAMAGED:
|
||||
if (!_limbData[DRAGON_ASPECT_ALEXSTRASZA].TentacleKilled)
|
||||
if (Creature* alexstrasza = GetDragonAspect(DRAGON_ASPECT_ALEXSTRASZA))
|
||||
if (alexstrasza->IsAIEnabled)
|
||||
if (alexstrasza->IsAIEnabled())
|
||||
alexstrasza->AI()->DoAction(ACTION_CAUTERIZE);
|
||||
break;
|
||||
case ACTION_DEATH:
|
||||
@@ -713,7 +713,7 @@ struct boss_madness_of_deathwing : public BossAI
|
||||
// Nozdormu creates a time zone at the same moment when Deathwing faces a platform
|
||||
if (!_limbData[DRAGON_ASPECT_NOZDORMU].TentacleKilled)
|
||||
if (Creature* nozdormu = GetDragonAspect(DRAGON_ASPECT_NOZDORMU))
|
||||
if (nozdormu->IsAIEnabled)
|
||||
if (nozdormu->IsAIEnabled())
|
||||
nozdormu->AI()->DoAction(ACTION_CREATE_TIME_ZONE);
|
||||
break;
|
||||
}
|
||||
@@ -727,7 +727,7 @@ struct boss_madness_of_deathwing : public BossAI
|
||||
Talk(SAY_ANNOUNCE_CATACLYSM);
|
||||
DoCastAOE(SPELL_CATACLYSM);
|
||||
if (Creature* aspect = GetDragonAspect(_assaultedDragonAspect))
|
||||
if (aspect->IsAIEnabled)
|
||||
if (aspect->IsAIEnabled())
|
||||
aspect->AI()->DoAction(ACTION_CATACLYSM_IN_PROGRESS);
|
||||
break;
|
||||
case EVENT_HEMORRHAGE:
|
||||
@@ -754,7 +754,7 @@ struct boss_madness_of_deathwing : public BossAI
|
||||
case EVENT_PREPARE_TIME_ZONE:
|
||||
DoCastSelf(SPELL_TIME_ZONE_PHASE_TWO);
|
||||
if (Creature* nozdormu = GetDragonAspect(DRAGON_ASPECT_NOZDORMU))
|
||||
if (nozdormu->IsAIEnabled)
|
||||
if (nozdormu->IsAIEnabled())
|
||||
nozdormu->AI()->DoAction(ACTION_CAST_TIME_ZONE);
|
||||
break;
|
||||
case EVENT_DISENGAGE:
|
||||
@@ -858,7 +858,7 @@ private:
|
||||
Talk(announcementTextID);
|
||||
|
||||
if (Creature* aspect = GetDragonAspect(aspectId))
|
||||
if (aspect->IsAIEnabled)
|
||||
if (aspect->IsAIEnabled())
|
||||
aspect->AI()->DoAction(ACTION_ASSAULTED);
|
||||
|
||||
if (Creature* limb = ObjectAccessor::GetCreature(*me, _limbData[aspectId].TentacleGUID))
|
||||
@@ -940,11 +940,11 @@ private:
|
||||
|
||||
uint8 aspectID = urand(DRAGON_ASPECT_YSERA, DRAGON_ASPECT_ALEXSTRASZA);
|
||||
if (Creature* aspect = GetDragonAspect(aspectID))
|
||||
if (aspect->IsAIEnabled)
|
||||
if (aspect->IsAIEnabled())
|
||||
aspect->AI()->DoAction(ACTION_TALK_PHASE_TWO);
|
||||
|
||||
if (Creature* thrall = instance->GetCreature(DATA_THRALL_MADNESS_OF_DEATHWING))
|
||||
if (thrall->IsAIEnabled)
|
||||
if (thrall->IsAIEnabled())
|
||||
thrall->AI()->DoAction(ACTION_TALK_ASPECT_AID);
|
||||
|
||||
events.SetPhase(PHASE_TWO);
|
||||
@@ -974,7 +974,7 @@ private:
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DEGENERATIVE_BITE);
|
||||
|
||||
if (Creature* thrall = instance->GetCreature(DATA_THRALL_MADNESS_OF_DEATHWING))
|
||||
if (thrall->IsAIEnabled)
|
||||
if (thrall->IsAIEnabled())
|
||||
thrall->AI()->DoAction(ACTION_FIRE_DRAGON_SOUL);
|
||||
|
||||
Player* recipient = nullptr;
|
||||
@@ -1763,7 +1763,7 @@ class spell_madness_of_deathwing_assault_aspects : public SpellScript
|
||||
// All players count, inform Deathwing about the numbers
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
{
|
||||
if (!caster->IsAIEnabled)
|
||||
if (!caster->IsAIEnabled())
|
||||
return;
|
||||
|
||||
for (uint8 i = 0; i < MAX_DRAGON_ASPECTS; ++i)
|
||||
@@ -1774,7 +1774,7 @@ class spell_madness_of_deathwing_assault_aspects : public SpellScript
|
||||
void NotifyDeathwing()
|
||||
{
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
caster->AI()->DoAction(ACTION_ASSAULT_PLATFORM);
|
||||
}
|
||||
|
||||
@@ -1807,7 +1807,7 @@ class spell_madness_of_deathwing_summon_tail : public SpellScript
|
||||
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
{
|
||||
if (!caster->IsAIEnabled)
|
||||
if (!caster->IsAIEnabled())
|
||||
return;
|
||||
|
||||
InstanceScript* instance = caster->GetInstanceScript();
|
||||
@@ -1870,7 +1870,7 @@ class spell_madness_of_deathwing_hemorrhage : public SpellScript
|
||||
void SetDest(SpellDestination& dest)
|
||||
{
|
||||
if (Creature* caster = GetCaster()->ToCreature())
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
if (Creature* platform = ObjectAccessor::GetCreature(*caster, caster->AI()->GetGUID(DATA_CURRENT_PLATFORM)))
|
||||
dest.Relocate(platform->GetPosition());
|
||||
}
|
||||
@@ -1964,7 +1964,7 @@ class spell_madness_of_deathwing_elementium_meteor_script: public SpellScript
|
||||
if (Creature* target = GetHitCreature())
|
||||
{
|
||||
target->ExitVehicle();
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_LAUNCH_ELEMENTIUM_BOLT);
|
||||
}
|
||||
}
|
||||
@@ -2118,7 +2118,7 @@ class spell_madness_of_deathwing_trigger_concentration : public SpellScript
|
||||
if (!creature || creature->GetGUID() != _aspectGUID)
|
||||
return;
|
||||
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_LIMB_KILLED);
|
||||
}
|
||||
|
||||
@@ -2136,7 +2136,7 @@ class spell_madness_of_deathwing_concentration : public AuraScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->SetGUID(GetTarget()->GetGUID(), DATA_FOCUSED_LIMB);
|
||||
|
||||
GetTarget()->SetAnimationTier(AnimationTier::Fly);
|
||||
@@ -2312,7 +2312,7 @@ class spell_madness_of_deathwing_fire_dragon_soul: public SpellScript
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* deathwing = GetHitCreature())
|
||||
if (deathwing->IsAIEnabled)
|
||||
if (deathwing->IsAIEnabled())
|
||||
deathwing->AI()->DoAction(ACTION_DEATH);
|
||||
}
|
||||
|
||||
@@ -2397,7 +2397,7 @@ class spell_madness_of_deathwing_trigger_aspect_yell : public SpellScript
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_TALK_CHARGE_DRAGON_SOUL);
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ struct boss_murozond : public BossAI
|
||||
events.ScheduleEvent(EVENT_LAND, 3s + 500ms);
|
||||
|
||||
if (Creature* nozdormu = instance->GetCreature(DATA_NOZDORMU_BRONZE_DRAGON_SHRINE))
|
||||
if (nozdormu->IsAIEnabled)
|
||||
if (nozdormu->IsAIEnabled())
|
||||
nozdormu->AI()->DoAction(ACTION_ENCOUNTER_INTRO);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ struct boss_murozond : public BossAI
|
||||
hourglass->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (Creature* nozdormu = instance->GetCreature(DATA_NOZDORMU_BRONZE_DRAGON_SHRINE))
|
||||
if (nozdormu->IsAIEnabled)
|
||||
if (nozdormu->IsAIEnabled())
|
||||
nozdormu->AI()->DoAction(ACTION_ENCOUNTER_OUTRO);
|
||||
|
||||
events.ScheduleEvent(EVENT_DESPAWN, 7s);
|
||||
@@ -391,7 +391,7 @@ struct npc_murozond_mirror_image : public NullCreatureAI
|
||||
{
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
if (Creature* murozond = instance->GetCreature(DATA_MUROZOND))
|
||||
if (murozond->IsAIEnabled)
|
||||
if (murozond->IsAIEnabled())
|
||||
murozond->AI()->JustSummoned(me);
|
||||
|
||||
summoner->CastSpell(me, SPELL_CLONE_ME, true);
|
||||
@@ -491,7 +491,7 @@ class spell_murozond_rewind_time : public SpellScript
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_REWIND_TIME);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
++_killedInfiniteDragonkins;
|
||||
if (_killedInfiniteDragonkins == 4 || _killedInfiniteDragonkins == 8)
|
||||
if (Creature* murozond = GetCreature(DATA_MUROZOND))
|
||||
if (murozond->IsAIEnabled)
|
||||
if (murozond->IsAIEnabled())
|
||||
murozond->AI()->SetData(DATA_MUROZOND_INTRO, _killedInfiniteDragonkins == 4 ? IN_PROGRESS : DONE);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -816,7 +816,7 @@ class achievement_share_the_pain : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*source*/, Unit* target) override
|
||||
{
|
||||
if (!target || !target->IsAIEnabled)
|
||||
if (!target || !target->IsAIEnabled())
|
||||
return false;
|
||||
|
||||
return target->GetAI()->GetData(DATA_SHARE_THE_PAIN) != 0;
|
||||
|
||||
@@ -182,7 +182,7 @@ struct boss_majordomo_staghelm : public BossAI
|
||||
summon->SetCorpseDelay(0);
|
||||
summon->m_Events.AddEventAtOffset([summon]()
|
||||
{
|
||||
if (summon->IsAIEnabled)
|
||||
if (summon->IsAIEnabled())
|
||||
summon->AI()->DoZoneInCombat();
|
||||
}, 1s);
|
||||
break;
|
||||
@@ -380,7 +380,7 @@ class spell_majordomo_staghelm_clump_check : public SpellScript
|
||||
}
|
||||
|
||||
Creature* caster = GetCaster()->ToCreature();
|
||||
if (caster->IsAIEnabled)
|
||||
if (caster->IsAIEnabled())
|
||||
caster->AI()->DoAction(hasClumpedPlayers ? ACTION_PLAYERS_CLUSTERED : ACTION_PLAYERS_SPLIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ class instance_firelands : public InstanceMapScript
|
||||
{
|
||||
case NPC_DRUID_OF_THE_FLAME:
|
||||
if (Creature* majordomo = GetCreature(DATA_MAJORDOMO_STAGHELM))
|
||||
if (majordomo->IsAIEnabled)
|
||||
if (majordomo->IsAIEnabled())
|
||||
majordomo->AI()->DoAction(ACTION_DRUID_OF_THE_FLAME_DIED);
|
||||
break;
|
||||
default:
|
||||
@@ -144,7 +144,7 @@ class instance_firelands : public InstanceMapScript
|
||||
case DATA_BALEROC:
|
||||
if (state == DONE)
|
||||
if (Creature* majordomo = GetCreature(DATA_MAJORDOMO_STAGHELM))
|
||||
if (majordomo->IsAIEnabled)
|
||||
if (majordomo->IsAIEnabled())
|
||||
majordomo->AI()->DoAction(ACTION_BALEROC_DIED);
|
||||
break;
|
||||
case DATA_MAJORDOMO_STAGHELM:
|
||||
|
||||
@@ -245,7 +245,7 @@ struct npc_ammunae_seedling_pod : public NullCreatureAI
|
||||
case NPC_BLOODPETAL_SPROUT:
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
if (Creature* ammunae = instance->GetCreature(DATA_AMMUNAE))
|
||||
if (ammunae->IsAIEnabled)
|
||||
if (ammunae->IsAIEnabled())
|
||||
ammunae->AI()->JustSummoned(summon);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -156,7 +156,7 @@ struct boss_anraphet : public BossAI
|
||||
_JustDied();
|
||||
|
||||
if (Creature* brann = instance->GetCreature(DATA_BRANN_0))
|
||||
if (brann->IsAIEnabled)
|
||||
if (brann->IsAIEnabled())
|
||||
brann->AI()->DoAction(ACTION_ANRAPHET_DIED);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ struct boss_earthrager_ptah : public BossAI
|
||||
case NPC_DUSTBONE_HORROR:
|
||||
case NPC_JEWELED_SCARAB:
|
||||
summon->SetReactState(REACT_PASSIVE);
|
||||
if (summon->IsAIEnabled)
|
||||
if (summon->IsAIEnabled())
|
||||
summon->AI()->DoZoneInCombat();
|
||||
_addGUIDs.push_back(summon->GetGUID());
|
||||
_summonCount++;
|
||||
@@ -206,7 +206,7 @@ struct boss_earthrager_ptah : public BossAI
|
||||
if (Creature* add = ObjectAccessor::GetCreature(*me, guid))
|
||||
{
|
||||
add->SetReactState(REACT_AGGRESSIVE);
|
||||
if (add->IsAIEnabled)
|
||||
if (add->IsAIEnabled())
|
||||
add->AI()->DoZoneInCombat();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ class spell_anhuur_reverberating_hymn : public AuraScript
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Creature * anhuur = GetCaster()->ToCreature())
|
||||
if (anhuur->IsAIEnabled)
|
||||
if (anhuur->IsAIEnabled())
|
||||
anhuur->AI()->DoAction(ACTION_HYMN_EXPIRED);
|
||||
}
|
||||
|
||||
|
||||
@@ -948,7 +948,7 @@ public:
|
||||
{
|
||||
if (InstanceScript* instance = player->GetInstanceScript())
|
||||
if (Creature* brann = instance->GetCreature(DATA_BRANN_0))
|
||||
if (brann->IsAIEnabled)
|
||||
if (brann->IsAIEnabled())
|
||||
brann->AI()->DoAction(ACTION_INTRO_AREA_TRIGGER);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class instance_halls_of_origination : public InstanceMapScript
|
||||
{
|
||||
ActivateLightMachine(data - DATA_WARDEN_1_DIED);
|
||||
if (Creature* brann = GetCreature(DATA_BRANN_0))
|
||||
if (brann->IsAIEnabled)
|
||||
if (brann->IsAIEnabled())
|
||||
brann->AI()->SetData(data, value);
|
||||
}
|
||||
break;
|
||||
@@ -466,7 +466,7 @@ class instance_halls_of_origination : public InstanceMapScript
|
||||
sunMirror->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
if (Creature* anraphet = GetCreature(DATA_ANRAPHET))
|
||||
if (anraphet->IsAIEnabled)
|
||||
if (anraphet->IsAIEnabled())
|
||||
anraphet->AI()->DoAction(ACTION_ANRAPHET_INTRO);
|
||||
break;
|
||||
case EVENT_FAIL_VAULTS_OF_LIGHT_ACHIEVEMENT:
|
||||
@@ -518,7 +518,7 @@ class instance_halls_of_origination : public InstanceMapScript
|
||||
for (uint8 i = 0; i < MAX_VAULT_OF_LIGHTS_WARDEN; ++i)
|
||||
{
|
||||
if (Creature* warden = instance->SummonCreature(wardenEntries[i], VaultOfLightsWardenPositions[i]))
|
||||
if (warden->IsAIEnabled)
|
||||
if (warden->IsAIEnabled())
|
||||
warden->AI()->SetData(DATA_WARDEN_NUMBER, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ class spell_husam_detonate_traps : public SpellScript
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->IsAIEnabled)
|
||||
if (target->IsAIEnabled())
|
||||
target->AI()->DoAction(ACTION_INITIATE_COUNTDOWN);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ class spell_husam_land_mine_player_search_effect : public SpellScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
if (creature->IsAIEnabled)
|
||||
if (creature->IsAIEnabled())
|
||||
creature->AI()->DoAction(ACTION_DETONATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ struct boss_high_prophet_barim : public BossAI
|
||||
{
|
||||
if (Creature* phoenix = instance->GetCreature(data))
|
||||
{
|
||||
if (phoenix->IsAIEnabled)
|
||||
if (phoenix->IsAIEnabled())
|
||||
{
|
||||
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, phoenix);
|
||||
phoenix->DespawnOrUnsummon();
|
||||
@@ -182,7 +182,7 @@ struct boss_high_prophet_barim : public BossAI
|
||||
{
|
||||
if (Creature* phoenix = instance->GetCreature(data))
|
||||
{
|
||||
if (phoenix->IsAIEnabled)
|
||||
if (phoenix->IsAIEnabled())
|
||||
{
|
||||
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, phoenix);
|
||||
phoenix->DespawnOrUnsummon();
|
||||
@@ -226,7 +226,7 @@ struct boss_high_prophet_barim : public BossAI
|
||||
summons.DoAction(ACTION_PULL_PLAYERS_BACK, pred);
|
||||
|
||||
if (Creature* blaze = instance->GetCreature(DATA_BLAZE_OF_THE_HEAVENS))
|
||||
if (blaze->IsAIEnabled)
|
||||
if (blaze->IsAIEnabled())
|
||||
blaze->AI()->DoAction(ACTION_RESUME_COMBAT);
|
||||
|
||||
events.ScheduleEvent(EVENT_FIFTY_LASHINGS, 2s);
|
||||
@@ -278,7 +278,7 @@ struct boss_high_prophet_barim : public BossAI
|
||||
events.ScheduleEvent(EVENT_REPENTANCE_PULL, 1s);
|
||||
|
||||
if (Creature* blaze = instance->GetCreature(DATA_BLAZE_OF_THE_HEAVENS))
|
||||
if (blaze->IsAIEnabled)
|
||||
if (blaze->IsAIEnabled())
|
||||
blaze->AI()->DoAction(ACTION_DISABLE_COMBAT);
|
||||
break;
|
||||
case EVENT_REPENTANCE_PULL:
|
||||
@@ -297,7 +297,7 @@ struct boss_high_prophet_barim : public BossAI
|
||||
|
||||
// The phoenix is in a passive state so he won't evade on his own in that state so we give him a little push here.
|
||||
if (Creature* blaze = instance->GetCreature(DATA_BLAZE_OF_THE_HEAVENS))
|
||||
if (blaze->IsAIEnabled && blaze->HasReactState(REACT_PASSIVE))
|
||||
if (blaze->IsAIEnabled() && blaze->HasReactState(REACT_PASSIVE))
|
||||
blaze->AI()->EnterEvadeMode();
|
||||
break;
|
||||
case EVENT_BLAZE_OF_THE_HEAVENS:
|
||||
|
||||
+3
-3
@@ -125,17 +125,17 @@ class instance_lost_city_of_the_tolvir : public InstanceMapScript
|
||||
case NPC_REPENTANCE:
|
||||
case NPC_SOUL_FRAGMENT:
|
||||
if (Creature* barim = GetCreature(DATA_HIGH_PROPHET_BARIM))
|
||||
if (barim->IsAIEnabled)
|
||||
if (barim->IsAIEnabled())
|
||||
barim->AI()->JustSummoned(creature);
|
||||
break;
|
||||
case NPC_TOLVIR_LAND_MINE:
|
||||
if (Creature* husam = GetCreature(DATA_GENERAL_HUSAM))
|
||||
if (husam->IsAIEnabled)
|
||||
if (husam->IsAIEnabled())
|
||||
husam->AI()->JustSummoned(creature);
|
||||
break;
|
||||
case NPC_MINION_OF_SIAMAT_STORM:
|
||||
if (Creature* siamat = GetCreature(DATA_SIAMAT))
|
||||
if (siamat->IsAIEnabled)
|
||||
if (siamat->IsAIEnabled())
|
||||
siamat->AI()->JustSummoned(creature);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1271,7 +1271,7 @@ public:
|
||||
{
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (summoner->IsAIEnabled)
|
||||
if (summoner->IsAIEnabled())
|
||||
summoner->GetAI()->DoAction(ACTION_FLESH_TENTACLE_KILLED);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1079,7 +1079,7 @@ class spell_conclave_of_wind_winds_pre_effect_warning : public AuraScript
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* conclave = caster->ToCreature())
|
||||
if (conclave->IsAIEnabled)
|
||||
if (conclave->IsAIEnabled())
|
||||
conclave->AI()->DoAction(ACTION_NO_NEARBY_PLAYER);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ class instance_throne_of_the_four_winds : public InstanceMapScript
|
||||
break;
|
||||
case EVENT_ANNOUNCE_ALMOST_FULL_STRENGTH:
|
||||
if (Creature* trigger = instance->GetCreature(_engerizeWorldTriggerGUID))
|
||||
if (trigger->IsAIEnabled)
|
||||
if (trigger->IsAIEnabled())
|
||||
trigger->AI()->Talk(SAY_ANNOUNCE_ALMOST_FULL_STRENGTH);
|
||||
break;
|
||||
case EVENT_CONCLAVE_AT_FULL_STRENGTH:
|
||||
|
||||
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user