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

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

View File

@@ -305,7 +305,7 @@ public:
void KilledUnit(Unit* victim) override
{
if( victim->GetTypeId() == TYPEID_PLAYER )
if( victim->IsPlayer() )
{
Talk(SAY_BK_KILL_PLAYER);
}
@@ -434,7 +434,7 @@ public:
}
break;
case SPELL_EXPLODE_H:
if (target && target->GetTypeId() == TYPEID_PLAYER)
if (target && target->IsPlayer())
if (pInstance)
pInstance->SetData(DATA_ACHIEV_IVE_HAD_WORSE, 0);
break;

View File

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

View File

@@ -107,7 +107,7 @@ struct boss_faction_championsAI : 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

@@ -161,12 +161,12 @@ public:
case 0:
break;
case EVENT_SPELL_SNOBOLLED:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell((Unit*)nullptr, SPELL_SNOBOLLED, true);
break;
case EVENT_SPELL_BATTER:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell(t, SPELL_BATTER);
events.Repeat(6s, 8s);
break;
@@ -198,7 +198,7 @@ public:
}
break;
case EVENT_SPELL_HEAD_CRACK:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell(t, SPELL_HEAD_CRACK);
events.Repeat(30s, 35s);
break;

View File

@@ -499,7 +499,7 @@ struct boss_twin_valkyrAI : public ScriptedAI
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
{
Talk(SAY_KILL_PLAYER);
if( Creature* twin = GetSister() )

View File

@@ -155,7 +155,7 @@ public:
void OnUnitDeath(Unit* u) override
{
if (bNooneDied && u->GetTypeId() == TYPEID_PLAYER)
if (bNooneDied && u->IsPlayer())
{
bNooneDied = false;
SaveToDB();