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

@@ -894,7 +894,7 @@ public:
void PassengerBoarded(Unit* pass, int8 /*seat*/, bool apply) override
{
if (pass && !apply && pass->GetTypeId() == TYPEID_PLAYER)
if (pass && !apply && pass->IsPlayer())
{
Player* plr = pass->ToPlayer();
float speed = plr->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f);
@@ -1258,7 +1258,7 @@ public:
return;
if (apply)
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, true);
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, true);
@@ -1286,7 +1286,7 @@ public:
me->SetCanFly(false);
me->GetMotionMaster()->MoveLand(0, me->GetPositionX(), me->GetPositionY(), 267.24f, 10.0f);
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, false);
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, false);
@@ -1456,7 +1456,7 @@ public:
me->SetDisableGravity(false);
me->SendMovementFlagUpdate();
}
else if (pass && pass->GetTypeId() == TYPEID_PLAYER && me->IsAlive())
else if (pass && pass->IsPlayer() && me->IsAlive())
{
me->SetDisplayId(11686); // prevents nasty falling animation at despawn
me->DespawnOrUnsummon(1);