refactor(Core/Object): getLevel() -> GetLevel() (#14122)

* refactor(Core/Object): getLevel() -> GetLevel()

* fix build and sneak some doxygen in

* codeSTLE

* codestyle
This commit is contained in:
Kitzunu
2022-12-31 17:39:23 +01:00
committed by GitHub
parent 089ce9eb41
commit 4870b14b1f
78 changed files with 326 additions and 314 deletions

View File

@@ -149,7 +149,7 @@ class spell_dk_raise_ally : public SpellScript
if (Unit* ghoul = unitTarget->GetCharm())
{
//health, mana, armor and resistance
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(ghoul->GetEntry(), ghoul->getLevel());
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(ghoul->GetEntry(), ghoul->GetLevel());
if (pInfo) // exist in DB
{
ghoul->SetCreateHealth(pInfo->health);
@@ -159,8 +159,8 @@ class spell_dk_raise_ally : public SpellScript
ghoul->SetCreateStat(Stats(stat), float(pInfo->stats[stat]));
}
ghoul->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(ghoul->getLevel() - (ghoul->getLevel() / 4)));
ghoul->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(ghoul->getLevel() + (ghoul->getLevel() / 4)));
ghoul->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(ghoul->GetLevel() - (ghoul->GetLevel() / 4)));
ghoul->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(ghoul->GetLevel() + (ghoul->GetLevel() / 4)));
// Avoidance, Night of the Dead
if (Aura* aur = ghoul->AddAura(62137, ghoul))

View File

@@ -273,10 +273,10 @@ class spell_gen_reduced_above_60 : public SpellScript
void RecalculateDamage()
{
if (Unit* target = GetHitUnit())
if (target->getLevel() > 60)
if (target->GetLevel() > 60)
{
int32 damage = GetHitDamage();
AddPct(damage, -4 * int8(std::min(target->getLevel(), uint8(85)) - 60)); // prevents reduce by more than 100%
AddPct(damage, -4 * int8(std::min(target->GetLevel(), uint8(85)) - 60)); // prevents reduce by more than 100%
SetHitDamage(damage);
}
}
@@ -294,8 +294,8 @@ class spell_gen_reduced_above_60_aura : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
if (owner->getLevel() > 60)
AddPct(amount, -4 * int8(std::min(owner->getLevel(), uint8(85)) - 60)); // prevents reduce by more than 100%
if (owner->GetLevel() > 60)
AddPct(amount, -4 * int8(std::min(owner->GetLevel(), uint8(85)) - 60)); // prevents reduce by more than 100%
}
void Register() override
@@ -417,7 +417,7 @@ public:
SpellCastResult CheckRequirement()
{
if (Unit* target = GetExplTargetUnit())
if (target->getLevel() >= _level)
if (target->GetLevel() >= _level)
return SPELL_FAILED_DONT_REPORT;
return SPELL_CAST_OK;
@@ -587,8 +587,8 @@ class spell_gen_disabled_above_63 : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
Unit* target = GetUnitOwner();
if (target->getLevel() <= 63)
amount = amount * target->getLevel() / 60;
if (target->GetLevel() <= 63)
amount = amount * target->GetLevel() / 60;
else
SetDuration(1);
}
@@ -693,7 +693,7 @@ class spell_gen_use_spell_base_level_check : public SpellScript
SpellCastResult CheckRequirement()
{
if (GetCaster()->getLevel() < GetSpellInfo()->BaseLevel)
if (GetCaster()->GetLevel() < GetSpellInfo()->BaseLevel)
return SPELL_FAILED_LEVEL_REQUIREMENT;
return SPELL_CAST_OK;
}
@@ -857,7 +857,7 @@ class spell_gen_proc_above_75 : public SpellScript
SpellCastResult CheckLevel()
{
Unit* caster = GetCaster();
if (caster->getLevel() < 75)
if (caster->GetLevel() < 75)
{
return SPELL_FAILED_LOWLEVEL;
}
@@ -934,8 +934,8 @@ class spell_gen_proc_reduced_above_60 : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
// Xinef: mostly its 33.(3)% reduce by 70 and 66.(6)% by 80
if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() > 60)
if (roll_chance_f((eventInfo.GetActor()->getLevel() - 60) * 3.33f))
if (eventInfo.GetActor() && eventInfo.GetActor()->GetLevel() > 60)
if (roll_chance_f((eventInfo.GetActor()->GetLevel() - 60) * 3.33f))
return false;
return true;

View File

@@ -950,7 +950,7 @@ class spell_hun_tame_beast : public SpellScript
if (Creature* target = GetExplTargetUnit()->ToCreature())
{
if (target->getLevel() > player->getLevel())
if (target->GetLevel() > player->GetLevel())
{
player->SendTameFailure(PET_TAME_TOO_HIGHLEVEL);
return SPELL_FAILED_DONT_REPORT;

View File

@@ -123,10 +123,10 @@ class spell_item_mind_amplify_dish : public SpellScript
return;
if (GetSpellInfo()->Id != SPELL_AMPLIFY_10S)
if (target->getLevel() > 60)
if (target->GetLevel() > 60)
return;
uint8 pct = std::max(0, 20 + player->getLevel() - target->getLevel());
uint8 pct = std::max(0, 20 + player->GetLevel() - target->GetLevel());
if (roll_chance_i(pct))
player->CastSpell(target, SPELL_MENTAL_BATTLE, true);
else if (roll_chance_i(pct))
@@ -156,7 +156,7 @@ class spell_item_runescroll_of_fortitude : public SpellScript
if (Unit* target = GetHitUnit())
{
if (target->getLevel() < 70)
if (target->GetLevel() < 70)
return;
target->CastSpell(target, SPELL_FORTITUDE, true);
@@ -264,7 +264,7 @@ class spell_item_with_mount_speed : public AuraScript
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->getLevel() <= 70)
if (target->GetLevel() <= 70)
{
if (auto spellId = getMountSpellId())
{
@@ -297,9 +297,9 @@ class spell_item_magic_dust : public SpellScript
{
if (Unit* target = GetHitUnit())
{
if (target->getLevel() >= 30)
if (target->GetLevel() >= 30)
{
uint8 chance = 100 - std::min<uint8>(100, target->getLevel() - 30 * urand(3, 10));
uint8 chance = 100 - std::min<uint8>(100, target->GetLevel() - 30 * urand(3, 10));
if (!roll_chance_i(chance))
{
PreventHitAura();
@@ -1362,7 +1362,7 @@ class spell_item_arcane_shroud : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
int32 diff = GetUnitOwner()->getLevel() - 60;
int32 diff = GetUnitOwner()->GetLevel() - 60;
if (diff > 0)
amount += 2 * diff;
}
@@ -2142,7 +2142,7 @@ class spell_item_scroll_of_recall : public SpellScript
break;
}
if (caster->getLevel() > maxSafeLevel)
if (caster->GetLevel() > maxSafeLevel)
{
caster->CastSpell(caster, SPELL_LOST, true);
@@ -2508,7 +2508,7 @@ class spell_item_the_eye_of_diminution : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
int32 diff = GetUnitOwner()->getLevel() - 60;
int32 diff = GetUnitOwner()->GetLevel() - 60;
if (diff > 0)
amount += diff;
}
@@ -3745,7 +3745,7 @@ class spell_item_green_whelp_armor : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() <= 50)
if (eventInfo.GetActor() && eventInfo.GetActor()->GetLevel() <= 50)
return true;
return false;

View File

@@ -337,7 +337,7 @@ private:
uint32 defenseSkillValue = victim->GetDefenseSkillValue();
// Max heal when defense skill denies critical hits from raid bosses
// Formula: max defense at level + 140 (raiting from gear)
uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
uint32 reqDefForMaxHeal = victim->GetLevel() * 5 + 140;
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
? 1.0f
: float(defenseSkillValue) / float(reqDefForMaxHeal);

View File

@@ -203,7 +203,7 @@ class spell_pri_divine_aegis : public AuraScript
if (AuraEffect const* aegis = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0))
absorb += aegis->GetAmount();
absorb = std::min(absorb, eventInfo.GetProcTarget()->getLevel() * 125);
absorb = std::min(absorb, eventInfo.GetProcTarget()->GetLevel() * 125);
GetTarget()->CastCustomSpell(SPELL_PRIEST_DIVINE_AEGIS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff);
}