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

@@ -360,14 +360,14 @@ class spell_dk_master_of_ghouls : public AuraScript
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->SetShowDKPet(true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->SetShowDKPet(false);
}
@@ -780,7 +780,7 @@ class spell_dk_pet_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -1014,7 +1014,7 @@ class spell_dk_blood_boil : public SpellScript
bool Load() override
{
_executed = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY);
return GetCaster()->IsPlayer() && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY);
}
void HandleAfterHit()
@@ -1291,7 +1291,7 @@ class spell_dk_death_grip : public SpellScript
Unit* caster = GetCaster();
Unit* target = GetExplTargetUnit();
if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
if (target->IsPlayer() && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
return SPELL_FAILED_TOO_CLOSE;
if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
@@ -1569,7 +1569,7 @@ class spell_dk_icebound_fortitude : public AuraScript
bool Load() override
{
Unit* caster = GetCaster();
return caster && caster->GetTypeId() == TYPEID_PLAYER;
return caster && caster->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -1881,7 +1881,7 @@ class spell_dk_raise_dead : public SpellScript
{
_result = SPELL_CAST_OK;
_corpse = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
SpellCastResult CheckCast()

View File

@@ -355,7 +355,7 @@ class spell_dru_treant_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, nature), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -791,7 +791,7 @@ class spell_dru_rip : public AuraScript
bool Load() override
{
Unit* caster = GetCaster();
return caster && caster->GetTypeId() == TYPEID_PLAYER;
return caster && caster->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
@@ -1005,7 +1005,7 @@ class spell_dru_swift_flight_passive : public AuraScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -1063,7 +1063,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1151,7 +1151,7 @@ class spell_dru_berserk : public SpellScript
{
Unit* caster = GetCaster();
if (caster->GetTypeId() == TYPEID_PLAYER)
if (caster->IsPlayer())
{
// Remove tiger fury / mangle(bear)
const uint32 TigerFury[6] = { 5217, 6793, 9845, 9846, 50212, 50213 };

View File

@@ -644,7 +644,7 @@ class spell_gen_area_aura_select_players : public AuraScript
bool CheckAreaTarget(Unit* target)
{
return target->GetTypeId() == TYPEID_PLAYER;
return target->IsPlayer();
}
void Register() override
{
@@ -662,7 +662,7 @@ class spell_gen_area_aura_select_players_and_caster : public AuraScript
bool CheckAreaTarget(Unit* target)
{
return target->GetTypeId() == TYPEID_PLAYER || target == GetCaster();
return target->IsPlayer() || target == GetCaster();
}
void Register() override
{
@@ -1692,7 +1692,7 @@ class spell_gen_pet_summoned : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1973,7 +1973,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -2097,7 +2097,7 @@ class spell_gen_divine_storm_cd_reset : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -2128,7 +2128,7 @@ class spell_gen_profession_research : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
SpellCastResult CheckRequirement()
@@ -2358,7 +2358,7 @@ class spell_gen_seaforium_blast : public SpellScript
bool Load() override
{
// OriginalCaster is always available in Spell::prepare
return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER;
return GetOriginalCaster()->IsPlayer();
}
void AchievementCredit(SpellEffIndex /*effIndex*/)
@@ -2501,7 +2501,7 @@ class spell_gen_vehicle_scaling_aura: public AuraScript
bool Load() override
{
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER && GetOwner()->GetTypeId() == TYPEID_UNIT;
return GetCaster() && GetCaster()->IsPlayer() && GetOwner()->GetTypeId() == TYPEID_UNIT;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -2547,7 +2547,7 @@ class spell_gen_oracle_wolvar_reputation : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex effIndex)
@@ -2667,7 +2667,7 @@ class spell_gen_spirit_healer_res : public SpellScript
bool Load() override
{
return GetOriginalCaster() && GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER;
return GetOriginalCaster() && GetOriginalCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3243,7 +3243,7 @@ class spell_gen_tournament_duel : public SpellScript
}
else if (Unit* unitTarget = GetHitUnit())
{
if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->GetTypeId() == TYPEID_PLAYER && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT))
if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->IsPlayer() && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT))
rider->CastSpell(unitTarget->GetCharmer(), SPELL_MOUNTED_DUEL, true);
}
}
@@ -3450,7 +3450,7 @@ class spell_gen_on_tournament_mount : public AuraScript
bool Load() override
{
_pennantSpellId = 0;
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster() && GetCaster()->IsPlayer();
}
void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -3630,7 +3630,7 @@ class spell_gen_tournament_pennant : public AuraScript
bool Load() override
{
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster() && GetCaster()->IsPlayer();
}
void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -3953,7 +3953,7 @@ public:
{
if (GetCaster())
if (Unit* owner = GetCaster()->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong
if (owner->IsPlayer()) /// @todo this check is maybe wrong
owner->ToPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
}

View File

@@ -231,7 +231,7 @@ class spell_hun_generic_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -322,7 +322,7 @@ class spell_hun_aspect_of_the_beast : public AuraScript
bool Load() override
{
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster() && GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -655,7 +655,7 @@ class spell_hun_readiness : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -708,7 +708,7 @@ class spell_hun_scatter_shot : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -930,7 +930,7 @@ class spell_hun_disengage : public SpellScript
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->IsInCombat())
if (caster->IsPlayer() && !caster->IsInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;

View File

@@ -608,7 +608,7 @@ class spell_item_feast : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScriptEffect(SpellEffIndex effIndex)
@@ -1275,7 +1275,7 @@ class spell_item_summon_argent_knight : public SpellScript
{
if (Unit* caster = GetCaster())
{
if (caster->GetTypeId() == TYPEID_PLAYER)
if (caster->IsPlayer())
{
// summoning the "Argent Knight (Horde)" is default for spell 54307;
if (caster->ToPlayer()->GetTeamId() == TEAM_ALLIANCE)
@@ -1585,7 +1585,7 @@ class spell_item_deviate_fish : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -1813,7 +1813,7 @@ class spell_item_make_a_wish : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -2032,7 +2032,7 @@ class spell_item_noggenfogger_elixir : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -2102,7 +2102,7 @@ class spell_item_savory_deviate_delight : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -2156,7 +2156,7 @@ class spell_item_scroll_of_recall : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScript(SpellEffIndex effIndex)
@@ -2215,7 +2215,7 @@ class spell_item_dimensional_ripper_area52 : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScript(SpellEffIndex /* effIndex */)
@@ -2571,7 +2571,7 @@ class spell_item_underbelly_elixir : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
@@ -2619,7 +2619,7 @@ class spell_item_book_of_glyph_mastery : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
SpellCastResult CheckRequirement()
@@ -2735,7 +2735,7 @@ class spell_item_ashbringer : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void OnDummyEffect(SpellEffIndex effIndex)
@@ -2832,7 +2832,7 @@ class spell_item_purify_helboar_meat : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spell*/) override
@@ -3042,7 +3042,7 @@ class spell_item_demon_broiled_surprise : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /* effIndex */)
@@ -3249,7 +3249,7 @@ class spell_item_teach_language : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spell*/) override
@@ -3282,7 +3282,7 @@ class spell_item_rocket_boots : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spell*/) override
@@ -3320,7 +3320,7 @@ class spell_item_healing_injector : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleHeal(SpellEffIndex /*effIndex*/)
@@ -3342,7 +3342,7 @@ class spell_item_mana_injector : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleEnergize(SpellEffIndex /*effIndex*/)
@@ -3431,7 +3431,7 @@ class spell_item_chicken_cover : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spell*/) override
@@ -3834,7 +3834,7 @@ class spell_item_worn_troll_dice : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScript(SpellEffIndex /*effIndex*/)

View File

@@ -267,7 +267,7 @@ class spell_mage_pet_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, frost), 33);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -459,7 +459,7 @@ class spell_mage_cold_snap : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)

View File

@@ -178,7 +178,7 @@ class spell_pal_divine_intervention : public AuraScript
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER)
if (!GetTarget()->IsInCombat() && GetTarget()->IsPlayer())
GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724);
}
@@ -329,7 +329,7 @@ private:
{
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
return GetUnitOwner()->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -518,7 +518,7 @@ class spell_pal_divine_sacrifice : public AuraScript
{
if (Unit* caster = GetCaster())
{
if (caster->GetTypeId() == TYPEID_PLAYER)
if (caster->IsPlayer())
{
if (caster->ToPlayer()->GetGroup())
groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount();

View File

@@ -118,7 +118,7 @@ class spell_pri_shadowfiend_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, shadow), 30);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -552,7 +552,7 @@ class spell_pri_penance : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* spellInfo) override
@@ -782,7 +782,7 @@ class spell_pri_renew : public AuraScript
bool Load() override
{
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster() && GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override

View File

@@ -201,7 +201,7 @@ class spell_q11026_a11051_banish_the_demons : public SpellScript
{
if (Unit* target = GetHitUnit())
if (Unit* owner = target->ToTempSummon()->GetSummonerUnit())
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->ToPlayer()->KilledMonsterCredit(23327); // Some trigger, just count
}
@@ -652,7 +652,7 @@ class spell_q13369_fate_up_against_your_will : public SpellScript
{
// Fate, Up Against Your Will (13369)
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE)
if (caster->IsPlayer() && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE)
return SPELL_CAST_OK;
return SPELL_FAILED_DONT_REPORT;
}
@@ -864,7 +864,7 @@ class spell_q5206_test_fetid_skull : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -903,7 +903,7 @@ class spell_q6124_6129_apply_salve : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1108,7 +1108,7 @@ class spell_q11730_ultrasonic_screwdriver : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
return GetCaster()->IsPlayer() && GetCastItem();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -1346,7 +1346,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -1452,7 +1452,7 @@ class spell_q12659_ahunaes_knife : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1483,7 +1483,7 @@ class spell_q9874_liquid_fire : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1515,7 +1515,7 @@ class spell_q12805_lifeblood_dummy : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -1616,7 +1616,7 @@ class spell_q9452_cast_net : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
SpellCastResult CheckCast()

View File

@@ -201,7 +201,7 @@ class spell_rog_deadly_poison : public SpellScript
{
_stackAmount = 0;
// at this point CastItem must already be initialized
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
return GetCaster()->IsPlayer() && GetCastItem();
}
void HandleBeforeHit(SpellMissInfo missInfo)
@@ -438,7 +438,7 @@ class spell_rog_preparation : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -505,7 +505,7 @@ class spell_rog_prey_on_the_weak : public AuraScript
{
Unit* target = GetTarget();
Unit* victim = target->GetVictim();
if (!victim && target->GetTypeId() == TYPEID_PLAYER)
if (!victim && target->IsPlayer())
victim = target->ToPlayer()->GetSelectedUnit();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
@@ -534,7 +534,7 @@ class spell_rog_rupture : public AuraScript
bool Load() override
{
Unit* caster = GetCaster();
return caster && caster->GetTypeId() == TYPEID_PLAYER;
return caster && caster->IsPlayer();
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
@@ -574,7 +574,7 @@ class spell_rog_shiv : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override

View File

@@ -215,7 +215,7 @@ class spell_sha_feral_spirit_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -324,7 +324,7 @@ class spell_sha_fire_elemental_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, fire), 100);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -951,7 +951,7 @@ class spell_sha_lava_lash : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1049,7 +1049,7 @@ class spell_sha_sentry_totem : public AuraScript
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
if (caster->GetTypeId() == TYPEID_PLAYER)
if (caster->IsPlayer())
caster->ToPlayer()->StopCastingBindSight();
}

View File

@@ -171,7 +171,7 @@ class spell_warl_improved_demonic_tactics : public AuraScript
bool Load() override
{
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
return GetUnitOwner()->IsPlayer();
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
@@ -223,7 +223,7 @@ class spell_warl_ritual_of_summoning : public SpellScript
SpellCastResult CheckCast()
{
if (GetCaster()->GetTypeId() == TYPEID_PLAYER)
if (GetCaster()->IsPlayer())
if (GetCaster()->ToPlayer()->InBattleground())
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
return SPELL_CAST_OK;
@@ -339,7 +339,7 @@ class spell_warl_generic_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -450,7 +450,7 @@ class spell_warl_infernal_scaling : public AuraScript
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
@@ -900,7 +900,7 @@ class spell_warl_life_tap : public SpellScript
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spell*/) override
@@ -1147,7 +1147,7 @@ class spell_warl_curse_of_doom : public AuraScript
bool Load() override
{
return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
return GetCaster() && GetCaster()->IsPlayer();
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1322,7 +1322,7 @@ class spell_warl_drain_soul : public AuraScript
Unit* caster = GetCaster();
Unit* target = GetTarget();
if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target))
{
if (roll_chance_i(20))
{