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

@@ -1550,7 +1550,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!allowTimer && !locked && (who->GetTypeId() == TYPEID_PLAYER || who->IsPet()) && me->GetDistance(who) < 15.0f)
if (!allowTimer && !locked && (who->IsPlayer() || who->IsPet()) && me->GetDistance(who) < 15.0f)
InfectMe(2000);
ScriptedAI::MoveInLineOfSight(who);

View File

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

View File

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

View File

@@ -130,7 +130,7 @@ struct npc_medivh_bm : public ScriptedAI
return;
}
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 20.0f))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_MEDIVH_ENTER);
_instance->SetData(DATA_MEDIVH, 1);

View File

@@ -106,7 +106,7 @@ struct boss_buru : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
ChaseNewVictim();
}

View File

@@ -189,7 +189,7 @@ struct boss_eye_of_cthun : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && !me->IsInCombat())
if (who->IsPlayer() && !me->IsInCombat())
{
// Z checks are necessary here because AQ maps do funky stuff.
if (me->IsWithinLOSInMap(who) && me->IsWithinDist2d(who, 90.0f) && who->GetPositionZ() > 100.0f)

View File

@@ -75,7 +75,7 @@ struct npc_ouro_spawner : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
// Spawn Ouro on LoS check
if (!hasSummoned && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
if (!hasSummoned && who->IsPlayer() && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
{
if (InstanceScript* instance = me->GetInstanceScript())
{

View File

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

View File

@@ -77,7 +77,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
{
Talk(SAY_KILL);
victim->CastSpell(victim, SPELL_MARK_OF_FROST, true);

View File

@@ -339,7 +339,7 @@ public:
if (!who)
return;
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 5))
{
DoCast(who, SPELL_DEPTH_CHARGE_TRAP);
WeMustDie = true;

View File

@@ -94,7 +94,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
if (CanSayHelp && who->IsPlayer() && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
{
//Random switch between 4 texts
Talk(SAY_HELP, who);

View File

@@ -70,7 +70,7 @@ public:
{
if (Unit* owner = killer->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
owner->ToPlayer()->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER);
}

View File

@@ -99,7 +99,7 @@ class spell_energize_aoe : public SpellScript
{
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
if ((*itr)->IsPlayer() && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
targets.erase(itr++);

View File

@@ -91,7 +91,7 @@ public:
{
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
{
if (player->GetTypeId() == TYPEID_PLAYER && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
if (player->IsPlayer() && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
player->FailQuest(QUEST_SHATTERED_SALUTE);
}
Reset();

View File

@@ -121,7 +121,7 @@ public:
{
if (SendItemTimer <= diff)
{
if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER)
if (me->GetVictim()->IsPlayer())
SendItem(me->GetVictim());
SendItemTimer = 5000;
}