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

@@ -673,7 +673,7 @@ struct boss_nefarian : public BossAI
{
for (auto& ref : me->GetThreatMgr().GetThreatList())
{
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
if (ref->getTarget() && ref->getTarget()->IsPlayer())
{
classesPresent.insert(ref->getTarget()->getClass());
}

View File

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

View File

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

View File

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

View File

@@ -178,7 +178,7 @@ struct boss_moroes : public BossAI
void KilledUnit(Unit* victim) override
{
if (!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER)
if (!_recentlySpoken && victim->IsPlayer())
{
Talk(SAY_KILL);
_recentlySpoken = true;

View File

@@ -149,7 +149,7 @@ struct boss_netherspite : public BossAI
}
}
// buff the target
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
target->AddAura(PlayerBuff[j], target);
}
@@ -177,7 +177,7 @@ struct boss_netherspite : public BossAI
}
}
// aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
if (j == RED_PORTAL && me->GetVictim() != target && target->IsPlayer())
{
me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
}

View File

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

View File

@@ -142,7 +142,7 @@ struct boss_felblood_kaelthas : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER)
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->IsPlayer())
{
Talk(SAY_AGGRO);
introSpeak = true;

View File

@@ -292,7 +292,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
for (ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit))
if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
{
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);

View File

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

View File

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

View File

@@ -77,7 +77,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->IsAlive() && !speechCounter)
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->IsPlayer() && me->IsAlive() && !speechCounter)
{
if (Player* player = caster->ToPlayer())
{

View File

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

View File

@@ -143,7 +143,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}
@@ -291,7 +291,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}

View File

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

View File

@@ -229,7 +229,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(SAY_EVIL_SLAY);
}
@@ -539,7 +539,7 @@ public:
void KilledUnit(Unit* target) override
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
Talk(SAY_SATH_SLAY);
}

View File

@@ -364,7 +364,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
if (victim->IsPlayer() && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
Talk(SAY_KJ_SLAY);
}

View File

@@ -135,7 +135,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_KILL);
}

View File

@@ -420,7 +420,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG)
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->IsPlayer() && me->GetEntry() == NPC_FOREST_FROG)
{
me->GetMotionMaster()->MoveIdle();
me->SetFacingToObject(caster);

View File

@@ -299,7 +299,7 @@ class spell_enveloping_webs : public SpellScript
{
Unit* caster = GetCaster();
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->GetTypeId() == TYPEID_PLAYER)
if (caster && hitUnit && hitUnit->IsPlayer())
{
caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
}

View File

@@ -75,7 +75,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!_introSpoken && who->GetTypeId() == TYPEID_PLAYER)
if (!_introSpoken && who->IsPlayer())
{
_introSpoken = true;
Talk(SAY_RESPAWN, who);
@@ -102,7 +102,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL, victim);
DoCastSelf(SPELL_SWELL_OF_SOULS);

View File

@@ -499,7 +499,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!announced && who->GetTypeId() == TYPEID_PLAYER && who->GetPositionZ() < 30.0f)
if (!announced && who->IsPlayer() && who->GetPositionZ() < 30.0f)
{
announced = true;
playerGUID = who->GetGUID();

View File

@@ -109,7 +109,7 @@ public:
m_uiPhase = 1;
if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
if (pDoneBy->IsPlayer())
{
m_uiPlayerGUID = pDoneBy->GetGUID();
}
@@ -118,7 +118,7 @@ public:
if (Unit* owner = pDoneBy->GetOwner())
{
// not sure if this is needed.
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
m_uiPlayerGUID = owner->GetGUID();
}