refactor(Core/Object): adds consistency in the use of type object check (#19671)

This commit is contained in:
Grimdhex
2024-08-25 14:57:37 +02:00
committed by GitHub
parent 61f3a631c3
commit 643362d697
189 changed files with 783 additions and 775 deletions

View File

@@ -103,7 +103,7 @@ public:
void MySelectNextTarget()
{
Unit* owner = me->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
if (owner && owner->IsPlayer() && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
{
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection))

View File

@@ -528,7 +528,7 @@ struct npc_pet_gen_imp_in_a_bottle : public NullCreatureAI
if (TempSummon* summon = me->ToTempSummon())
if (Unit* owner = summon->GetSummonerUnit())
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
_ownerGUID = owner->GetGUID();
if (owner->ToPlayer()->GetGroup())

View File

@@ -158,7 +158,7 @@ struct npc_pet_mage_mirror_image : CasterAI
_ebonGargoyleGUID.Clear();
}
Unit* owner = me->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
if (owner && owner->IsPlayer())
{
Unit* selection = owner->ToPlayer()->GetSelectedUnit();