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

@@ -68,7 +68,7 @@ struct npc_brewfest_keg_thrower : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
if (!who->ToPlayer()->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
me->CastSpell(who, SPELL_THROW_KEG, true); // throw keg
@@ -90,7 +90,7 @@ struct npc_brewfest_keg_reciver : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
Player* player = who->ToPlayer();
if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
@@ -149,7 +149,7 @@ struct npc_brewfest_bark_trigger : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
bool allow = false;
uint32 quest = 0;

View File

@@ -62,7 +62,7 @@ struct npc_love_in_air_supply_sentry : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->IsPlayer() && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
{
lock = 0;
if (urand(0, 1))
@@ -135,7 +135,7 @@ struct npc_love_in_air_snivel : public NullCreatureAI
void MoveInLineOfSight(Unit* who) override
{
if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER)
if (delay == 0 && me->GetDistance(who) < 7.0f && who->IsPlayer())
{
Player* plr = who->ToPlayer();
if (AllowAction(plr))
@@ -454,7 +454,7 @@ class spell_gen_aura_service_uniform : public AuraScript
{
// Apply model goblin
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (target->getGender() == GENDER_MALE)
{
@@ -472,7 +472,7 @@ class spell_gen_aura_service_uniform : public AuraScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->RestoreDisplayId();
}

View File

@@ -437,7 +437,7 @@ struct npc_midsummer_torch_target : public ScriptedAI
if (posVec.empty())
return;
// Triggered spell from torch
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->IsPlayer())
{
me->CastSpell(me, SPELL_BRAZIERS_HIT_VISUAL, true); // hit visual anim
if (++counter >= maxCount)
@@ -906,12 +906,12 @@ class spell_midsummer_ribbon_pole : public AuraScript
target->CastSpell(target, SPELL_RIBBON_POLE_XP, true);
// Achievement
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
// Achievement
if ((time(nullptr) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((time(nullptr) - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
}

View File

@@ -118,7 +118,7 @@ struct npc_pilgrims_bounty_chair : public VehicleAI
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
{
if (apply && who->GetTypeId() == TYPEID_PLAYER)
if (apply && who->IsPlayer())
who->ToPlayer()->SetClientControl(me, 0, true);
}