refactor(Core/Object): adds consistency in the use of type object check (#19671)
This commit is contained in:
@@ -33,7 +33,7 @@ int32 PetAI::Permissible(Creature const* creature)
|
||||
{
|
||||
if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
|
||||
{
|
||||
if (reinterpret_cast<Guardian const*>(creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
if (reinterpret_cast<Guardian const*>(creature)->GetOwner()->IsPlayer())
|
||||
return PERMIT_BASE_PROACTIVE;
|
||||
return PERMIT_BASE_REACTIVE;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ void PetAI::UpdateAI(uint32 diff)
|
||||
// Autocast (casted only in combat or persistent spells in any state)
|
||||
if (!me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
|
||||
if (owner && owner->IsPlayer() && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
|
||||
{
|
||||
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), std::abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
|
||||
|
||||
@@ -332,10 +332,10 @@ void PetAI::UpdateAI(uint32 diff)
|
||||
if (!me->HasInArc(M_PI, target))
|
||||
{
|
||||
me->SetInFront(target);
|
||||
if (target && target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target && target->IsPlayer())
|
||||
me->SendUpdateToPlayer(target->ToPlayer());
|
||||
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (owner && owner->IsPlayer())
|
||||
me->SendUpdateToPlayer(owner->ToPlayer());
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ void PetAI::UpdateAllies()
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
else if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
else if (owner->IsPlayer())
|
||||
group = owner->ToPlayer()->GetGroup();
|
||||
|
||||
//only pet and owner/not in group->ok
|
||||
|
||||
@@ -129,7 +129,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
|
||||
void TotemAI::AttackStart(Unit* /*victim*/)
|
||||
{
|
||||
// Sentry totem sends ping on attack
|
||||
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->IsPlayer())
|
||||
{
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
|
||||
data << me->GetGUID();
|
||||
|
||||
@@ -140,7 +140,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
|
||||
{
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
{
|
||||
me->AddAura(spellid, unit);
|
||||
return SPELL_CAST_OK;
|
||||
@@ -163,7 +163,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered
|
||||
{
|
||||
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
|
||||
{
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
return me->CastSpell(unit, spellid, triggered);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -668,7 +668,7 @@ void BossAI::TeleportCheaters()
|
||||
ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
|
||||
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
if (Unit* target = (*itr)->getTarget())
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target))
|
||||
if (target->IsPlayer() && !IsInBoundary(target))
|
||||
target->NearTeleportTo(x, y, z, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
|
||||
mCanRepeatPath = repeat;
|
||||
SetRun(run);
|
||||
|
||||
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
||||
if (invoker && invoker->IsPlayer())
|
||||
{
|
||||
mEscortNPCFlags = me->GetNpcFlags();
|
||||
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
|
||||
|
||||
@@ -5220,12 +5220,12 @@ WorldObject* SmartScript::GetLastInvoker(WorldObject* invoker) const
|
||||
|
||||
bool SmartScript::IsUnit(WorldObject* obj)
|
||||
{
|
||||
return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
|
||||
return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->IsPlayer());
|
||||
}
|
||||
|
||||
bool SmartScript::IsPlayer(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_PLAYER;
|
||||
return obj && obj->IsPlayer();
|
||||
}
|
||||
|
||||
bool SmartScript::IsCreature(WorldObject* obj)
|
||||
|
||||
Reference in New Issue
Block a user