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

@@ -486,7 +486,7 @@ AuraObjectType Aura::GetType() const
return UNIT_AURA_TYPE;
}
return (m_owner->GetTypeId() == TYPEID_DYNAMICOBJECT) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE;
return (m_owner->IsDynamicObject()) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE;
}
void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
@@ -559,7 +559,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp
}
}
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
if (caster && caster->IsPlayer())
{
if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
{
@@ -1350,7 +1350,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId())
{
case 32474: // Buffeting Winds of Susurrus
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
break;
case 33572: // Gronn Lord's Grasp, becomes stoned
@@ -1362,7 +1362,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
target->CastSpell(target, 50812, true);
break;
case 60970: // Heroic Fury (remove Intercept cooldown)
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->RemoveSpellCooldown(20252, true);
break;
}
@@ -1587,7 +1587,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_POTION:
// Alchemy: Mixology
if (caster && caster->HasAura(53042) && caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->GetSession()->PlayerLoading())
if (caster && caster->HasAura(53042) && caster->IsPlayer() && !caster->ToPlayer()->GetSession()->PlayerLoading())
{
if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/
{
@@ -1726,7 +1726,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
{
// check cooldown
if (caster->GetTypeId() == TYPEID_PLAYER)
if (caster->IsPlayer())
{
if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
{
@@ -2266,7 +2266,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
// do that only for passive spells
/// @todo: this needs to be unified for all kinds of auras
Unit* target = aurApp->GetTarget();
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->EquippedItemClass != -1)
if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1)
{
if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT))
{