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

@@ -390,7 +390,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* cast
CalculatePeriodicData();
m_amount = CalculateAmount(caster);
m_casterLevel = caster ? caster->getLevel() : 0;
m_casterLevel = caster ? caster->GetLevel() : 0;
m_applyResilience = caster && caster->CanApplyResilience();
m_auraGroup = sSpellMgr->GetSpellGroup(GetId());

View File

@@ -410,7 +410,7 @@ Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item*
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(itemGUID ? itemGUID : castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(GameTime::GetGameTime().count()),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_casterLevel(caster ? caster->GetLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_triggeredByAuraSpellInfo(nullptr)
{
if ((m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel) && !m_spellInfo->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
@@ -824,7 +824,7 @@ void Aura::Update(uint32 diff, Unit* caster)
m_timeCla -= diff;
else if (caster)
{
if (int32 ManaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->getLevel())
if (int32 ManaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->GetLevel())
{
m_timeCla += 1000 - diff;
@@ -1531,7 +1531,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_SHAMAN:
{
// Ghost Wolf Speed (PvP 58 lvl set)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000800 && target->HasAura(22801) && target->getLevel() <= 60)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000800 && target->HasAura(22801) && target->GetLevel() <= 60)
{
int32 bp0 = 15;
target->CastCustomSpell(target, 47017, &bp0, 0, 0, true);

View File

@@ -2396,7 +2396,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target)
{
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel)
if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
ihit->scaleAura = true;
}
@@ -2419,7 +2419,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target)
{
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel)
if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
targetInfo.scaleAura = true;
}
@@ -3105,7 +3105,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
int32 basePoints[3];
if (scaleAura)
{
aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel());
aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->GetLevel());
ASSERT(aurSpellInfo);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
@@ -6097,7 +6097,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel())
if (m_spellInfo->SpellLevel > pet->GetLevel())
return SPELL_FAILED_LOWLEVEL;
break;
@@ -6119,7 +6119,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel())
if (m_spellInfo->SpellLevel > pet->GetLevel())
return SPELL_FAILED_LOWLEVEL;
}
break;
@@ -6240,7 +6240,7 @@ SpellCastResult Spell::CheckCast(bool strict)
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
int32 TargetLevel = m_targets.GetUnitTarget()->getLevel();
int32 TargetLevel = m_targets.GetUnitTarget()->GetLevel();
int32 ReqValue = (skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5);
if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
@@ -6619,7 +6619,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_CANT_BE_CHARMED;
int32 damage = CalculateSpellDamage(i, target);
if (damage && int32(target->getLevel()) > damage)
if (damage && int32(target->GetLevel()) > damage)
return SPELL_FAILED_HIGHLEVEL;
}
@@ -7886,7 +7886,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
if (target->GetCharmerGUID())
return false;
if (int32 damage = CalculateSpellDamage(eff, target))
if ((int32)target->getLevel() > damage)
if ((int32)target->GetLevel() > damage)
return false;
break;
default:
@@ -7958,7 +7958,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
return false;
if (m_caster->ToPlayer()->GetSession()->GetRecruiterId() != target->ToPlayer()->GetSession()->GetAccountId() && target->ToPlayer()->GetSession()->IsARecruiter())
return false;
if (target->ToPlayer()->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
if (target->ToPlayer()->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
return false;
break;
default: // normal case

View File

@@ -352,7 +352,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Shield Slam
if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->GetCategory() == 1209)
{
uint8 level = m_caster->getLevel();
uint8 level = m_caster->GetLevel();
// xinef: shield block should increase the limit
float limit = m_caster->HasAura(2565) ? 2.0f : 1.0f;
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f * limit), uint32(float(level) * 34.5f * limit));
@@ -641,7 +641,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Shield of Righteousness
if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000)
{
uint8 level = m_caster->getLevel();
uint8 level = m_caster->GetLevel();
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 34.5f));
if (m_caster->GetAuraEffect(64882, EFFECT_0))
block_value += 225;
@@ -1911,15 +1911,15 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
switch (m_spellInfo->Id)
{
case 9512: // Restore Energy
level_diff = m_caster->getLevel() - 40;
level_diff = m_caster->GetLevel() - 40;
level_multiplier = 2;
break;
case 24571: // Blood Fury
level_diff = m_caster->getLevel() - 60;
level_diff = m_caster->GetLevel() - 60;
level_multiplier = 10;
break;
case 24532: // Burst of Energy
level_diff = m_caster->getLevel() - 60;
level_diff = m_caster->GetLevel() - 60;
level_multiplier = 4;
break;
case 31930: // Judgements of the Wise
@@ -1981,7 +1981,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
for (std::set<uint32>::iterator itr = availableElixirs.begin(); itr != availableElixirs.end();)
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*itr);
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->GetLevel())
availableElixirs.erase(itr++);
else
++itr;
@@ -2817,7 +2817,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
// do not allow to add too many honor for player (50 * 21) = 1040 at level 70, or (50 * 31) = 1550 at level 80
if (damage <= 50)
{
uint32 honor_reward = Acore::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage));
uint32 honor_reward = Acore::Honor::hk_honor_at_level(unitTarget->GetLevel(), float(damage));
unitTarget->ToPlayer()->RewardHonor(nullptr, 1, honor_reward, false);
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id {}) rewards {} honor points (scale) to player: {}",
m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUID().ToString());
@@ -3127,7 +3127,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
// "kill" original creature
creatureTarget->DespawnOrUnsummon();
uint8 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
uint8 level = (creatureTarget->GetLevel() < (m_caster->GetLevel() - 5)) ? (m_caster->GetLevel() - 5) : creatureTarget->GetLevel();
// prepare visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
@@ -4181,7 +4181,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
}
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->GetFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() + 1);
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel() + 1);
int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
@@ -4391,7 +4391,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
minLevel = 80;
break;
}
if (minLevel && m_caster->getLevel() < minLevel)
if (minLevel && m_caster->GetLevel() < minLevel)
{
SendCastResult(SPELL_FAILED_GLYPH_SOCKET_LOCKED);
return;
@@ -4648,7 +4648,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
return;
}
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel());
int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
@@ -4922,7 +4922,7 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
return;
Creature* creature = unitTarget->ToCreature();
int32 targetLevel = creature->getLevel();
int32 targetLevel = creature->GetLevel();
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
@@ -5511,7 +5511,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
pGameObj->SetOwnerGUID(m_caster->GetGUID());
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel());
pGameObj->SetSpellId(m_spellInfo->Id);
ExecuteLogEffectSummonObject(effIndex, pGameObj);
@@ -6015,7 +6015,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
caster = caster->ToTotem()->GetOwner();
// in another case summon new
uint8 summonLevel = caster->getLevel();
uint8 summonLevel = caster->GetLevel();
// level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER)
@@ -6113,7 +6113,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
summon->SetLevel(summonLevel);
// if summonLevel changed, set stats for calculated level
if (summonLevel != caster->getLevel())
if (summonLevel != caster->GetLevel())
{
((Guardian*)summon)->InitStatsForLevel(summonLevel);
}

View File

@@ -414,7 +414,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
// xinef: added basePointsPerLevel check
if (caster && basePointsPerLevel != 0.0f)
{
int32 level = int32(caster->getLevel());
int32 level = int32(caster->GetLevel());
if (level > int32(_spellInfo->MaxLevel) && _spellInfo->MaxLevel > 0)
level = int32(_spellInfo->MaxLevel);
else if (level < int32(_spellInfo->BaseLevel))
@@ -458,7 +458,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
// amount multiplication based on caster's level
if (!caster->IsControlledByPlayer() &&
_spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->getLevel() &&
_spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->GetLevel() &&
!basePointsPerLevel && _spellInfo->HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL))
{
bool canEffectScale = false;
@@ -502,7 +502,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
if (canEffectScale)
{
GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(_spellInfo->SpellLevel - 1);
GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1);
GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->GetLevel() - 1);
if (spellScaler && casterScaler)
value *= casterScaler->ratio / spellScaler->ratio;
}
@@ -549,7 +549,7 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
float radius = RadiusEntry->RadiusMin;
if (caster)
{
radius += RadiusEntry->RadiusPerLevel * caster->getLevel();
radius += RadiusEntry->RadiusPerLevel * caster->GetLevel();
radius = std::min(radius, RadiusEntry->RadiusMax);
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
@@ -2453,7 +2453,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S
if (HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL))
{
GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(SpellLevel - 1);
GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1);
GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->GetLevel() - 1);
if (spellScaler && casterScaler)
powerCost *= casterScaler->ratio / spellScaler->ratio;
}