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

@@ -83,7 +83,7 @@ struct boss_exarch_maladaar : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (!_talked && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 150.0f))
if (!_talked && who->IsPlayer() && me->IsWithinDistInMap(who, 150.0f))
{
_talked = true;
Talk(SAY_INTRO);

View File

@@ -77,7 +77,7 @@ struct boss_nexusprince_shaffar : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
if (!HasTaunted && who->IsPlayer() && me->IsWithinDistInMap(who, 100.0f))
{
HasTaunted = true;
Talk(SAY_INTRO);
@@ -133,7 +133,7 @@ struct boss_nexusprince_shaffar : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View File

@@ -101,7 +101,7 @@ struct boss_pandemonius : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View File

@@ -97,7 +97,7 @@ struct boss_darkweaver_syth : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View File

@@ -186,7 +186,7 @@ struct boss_grandmaster_vorpil : public BossAI
void MoveInLineOfSight(Unit* who) override
{
ScriptedAI::MoveInLineOfSight(who);
if (!sayIntro && who->GetTypeId() == TYPEID_PLAYER)
if (!sayIntro && who->IsPlayer())
{
Talk(SAY_INTRO);
sayIntro = true;

View File

@@ -99,7 +99,7 @@ struct boss_najentus : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && _canTalk)
if (victim->IsPlayer() && _canTalk)
{
Talk(SAY_SLAY);
_canTalk = false;

View File

@@ -170,7 +170,7 @@ struct boss_lady_vashj : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (!_intro && who->GetTypeId() == TYPEID_PLAYER)
if (!_intro && who->IsPlayer())
{
_intro = true;
Talk(SAY_INTRO);

View File

@@ -62,7 +62,7 @@ struct boss_warlord_kalithresh : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (!_introDone && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 35.0f))
if (!_introDone && who->IsPlayer() && me->IsWithinDistInMap(who, 35.0f))
{
Talk(SAY_INTRO);
_introDone = true;

View File

@@ -71,7 +71,7 @@ struct boss_the_maker : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
{
Talk(SAY_KILL);
}

View File

@@ -100,7 +100,7 @@ struct boss_watchkeeper_gargolmar : public BossAI
{
if (!_taunted)
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
_taunted = true;
Talk(SAY_TAUNT);

View File

@@ -226,7 +226,7 @@ struct boss_warbringer_omrogg : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
HandleHeadTalk(SAY_ON_KILL);
}

View File

@@ -157,7 +157,7 @@ struct boss_warchief_kargath_bladefist : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
Talk(SAY_SLAY);
}

View File

@@ -108,7 +108,7 @@ struct boss_high_astromancer_solarian : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
{
Talk(SAY_KILL);
}

View File

@@ -315,7 +315,7 @@ struct boss_kaelthas : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (_phase == PHASE_NONE && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
if (_phase == PHASE_NONE && who->IsPlayer() && me->IsValidAttackTarget(who))
{
_phase = PHASE_SINGLE_ADVISOR;
me->SetInCombatWithZone();
@@ -345,7 +345,7 @@ struct boss_kaelthas : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_SLAY);
}
@@ -1270,7 +1270,7 @@ class spell_kaelthas_nether_beam : public SpellScript
for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{
Unit* target = ObjectAccessor::GetUnit(*GetCaster(), (*itr)->getUnitGuid());
if (target && target->GetTypeId() == TYPEID_PLAYER)
if (target && target->IsPlayer())
targetList.push_back(target);
}

View File

@@ -116,7 +116,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL);
DoCastSelf(SPELL_CAPTURE_SOUL);

View File

@@ -105,7 +105,7 @@ struct boss_doomwalker : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
if (who && who->IsPlayer() && me->IsValidAttackTarget(who))
{
if (who->HasAura(SPELL_MARK_DEATH) && !who->HasAura(27827)) // Spirit of Redemption
{

View File

@@ -332,7 +332,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER)
if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->IsPlayer())
{
const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL};
int cid = rand() % (4 - 1);
@@ -466,7 +466,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
if (who->HasAura(SPELL_LASHHAN_CHANNEL) && me->IsWithinDistInMap(who, 10.0f))
{

View File

@@ -170,7 +170,7 @@ public:
{
npc_ancestral_wolfAI(Creature* creature) : npc_escortAI(creature)
{
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (creature->GetOwner() && creature->GetOwner()->IsPlayer())
Start(false, false, creature->GetOwner()->GetGUID());
creature->SetSpeed(MOVE_WALK, 1.5f);
DoCast(SPELL_GUIDED_BY_THE_SPIRITS);

View File

@@ -323,7 +323,7 @@ public:
if (bCanEat || bIsEating)
return;
if (pCaster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN))
if (pCaster->IsPlayer() && spell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN))
{
uiPlayerGUID = pCaster->GetGUID();
bCanEat = true;
@@ -599,7 +599,7 @@ public:
PlayerGUID = caster->GetGUID();
if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_POISON && !Tapped)
if (caster->IsPlayer() && spell->Id == SPELL_POISON && !Tapped)
{
Tapped = true;
caster->GetClosePoint(x, y, z, me->GetObjectSize());
@@ -1278,7 +1278,7 @@ public:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
DoCast(target, SpawnCast[1].SpellId); //Focused Bursts
SpellTimer1 = SpawnCast[1].Timer2 + (rand() % 5 * 1000);