Core/Unit: rename several getters to follow codestyle

uint8 GetLevel()
        uint8 GetLevelForTarget(WorldObject const* /*target*/)
        void SetLevel(uint8 lvl)
        uint8 GetRace()
        uint32 GetRaceMask()
        uint8 GetClass()
        uint32 GetClassMask()
        uint8 GetGender()

(cherry picked from commit 5c09ff51f7015b775def8d5cc1f678eaef37200f)
This commit is contained in:
ccrs
2021-12-13 00:42:20 +01:00
committed by Shauren
parent b8d675eba7
commit 4e6c59dca7
99 changed files with 538 additions and 538 deletions
+22 -22
View File
@@ -1075,7 +1075,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
if (blocked)
{
// double blocked amount if block is critical
uint32 value = victim->GetBlockPercent(getLevel());
uint32 value = victim->GetBlockPercent(GetLevel());
if (victim->isBlockCritical())
value *= 2; // double blocked percent
damageInfo->blocked = CalculatePct(damage, value);
@@ -1290,7 +1290,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->TargetState = VICTIMSTATE_HIT;
damageInfo->HitInfo |= HITINFO_BLOCK;
// 30% damage blocked, double blocked amount if block is critical
damageInfo->Blocked = CalculatePct(damageInfo->Damage, damageInfo->Target->GetBlockPercent(getLevel()));
damageInfo->Blocked = CalculatePct(damageInfo->Damage, damageInfo->Target->GetBlockPercent(GetLevel()));
if (damageInfo->Target->isBlockCritical())
damageInfo->Blocked *= 2;
@@ -1302,7 +1302,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
{
damageInfo->HitInfo |= HITINFO_GLANCING;
damageInfo->TargetState = VICTIMSTATE_HIT;
int32 leveldif = int32(victim->getLevel()) - int32(getLevel());
int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
if (leveldif > 3)
leveldif = 3;
@@ -1410,7 +1410,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
float chance = 20.0f;
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (victim->getLevel() < 30)
if (victim->GetLevel() < 30)
chance = 0.65f * victim->GetLevelForTarget(this) + 0.5f;
uint32 const victimDefense = victim->GetMaxSkillValueForLevel(this);
@@ -1568,7 +1568,7 @@ void Unit::HandleEmoteCommand(uint32 anim_id, Player* target /*=nullptr*/, Trini
if (attacker)
{
attackerLevel = attacker->GetLevelForTarget(victim);
attackerClass = Classes(attacker->getClass());
attackerClass = Classes(attacker->GetClass());
}
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
@@ -1678,7 +1678,7 @@ void Unit::HandleEmoteCommand(uint32 anim_id, Player* target /*=nullptr*/, Trini
static uint32 const bossLevel = 83;
static float const bossResistanceConstant = 510.0f;
uint32 level = caster ? victim->GetLevelForTarget(caster) : victim->getLevel();
uint32 level = caster ? victim->GetLevelForTarget(caster) : victim->GetLevel();
float resistanceConstant = 0.0f;
if (level == bossLevel)
@@ -5282,7 +5282,7 @@ void Unit::UpdateDisplayPower()
}
else if (GetTypeId() == TYPEID_PLAYER)
{
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass());
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(GetClass());
if (cEntry && cEntry->DisplayPower < MAX_POWERS)
displayPower = Powers(cEntry->DisplayPower);
}
@@ -5292,7 +5292,7 @@ void Unit::UpdateDisplayPower()
{
if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(vehicle->GetVehicleInfo()->PowerDisplayID[0]))
displayPower = Powers(powerDisplay->ActualType);
else if (getClass() == CLASS_ROGUE)
else if (GetClass() == CLASS_ROGUE)
displayPower = POWER_ENERGY;
}
else if (Pet* pet = ToPet())
@@ -6667,7 +6667,7 @@ float Unit::SpellCritChanceTaken(Unit const* caster, Spell* spell, AuraEffect co
// Spell crit suppression
if (GetTypeId() == TYPEID_UNIT)
{
int32 const levelDiff = static_cast<int32>(GetLevelForTarget(caster)) - caster->getLevel();
int32 const levelDiff = static_cast<int32>(GetLevelForTarget(caster)) - caster->GetLevel();
crit_chance -= levelDiff * 1.0f;
}
}
@@ -9581,7 +9581,7 @@ void Unit::ProcSkillsAndReactives(bool isVictim, Unit* procTarget, uint32 typeMa
if (hitMask & PROC_HIT_DODGE)
{
// Update AURA_STATE on dodge
if (getClass() != CLASS_ROGUE) // skip Rogue Riposte
if (GetClass() != CLASS_ROGUE) // skip Rogue Riposte
{
ModifyAuraState(AURA_STATE_DEFENSIVE, true);
StartReactiveTimer(REACTIVE_DEFENSE);
@@ -10170,7 +10170,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id)
return nullptr;
}
uint8 level = creatureTarget->GetLevelForTarget(this) + 5 < getLevel() ? (getLevel() - 5) : creatureTarget->GetLevelForTarget(this);
uint8 level = creatureTarget->GetLevelForTarget(this) + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevelForTarget(this);
InitTamedPet(pet, level, spell_id);
@@ -10188,7 +10188,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, getLevel(), spell_id))
if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
{
delete pet;
return nullptr;
@@ -10932,7 +10932,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
AddUnitState(UNIT_STATE_POSSESSED);
break;
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
if (GetTypeId() == TYPEID_UNIT && charmer->GetClass() == CLASS_WARLOCK)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
@@ -11030,7 +11030,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
RemoveUnitFlag(UNIT_FLAG_POSSESSED);
break;
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
if (GetTypeId() == TYPEID_UNIT && charmer->GetClass() == CLASS_WARLOCK)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
@@ -11073,7 +11073,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
void Unit::RestoreFaction()
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->setFactionForRace(getRace());
ToPlayer()->setFactionForRace(GetRace());
else
{
if (HasUnitTypeMask(UNIT_MASK_MINION))
@@ -11499,7 +11499,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
if (ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID) == form)
return artifactAppearance->OverrideShapeshiftDisplayID;
if (ShapeshiftFormModelData const* formModelData = sDB2Manager.GetShapeshiftFormModelData(getRace(), thisPlayer->GetNativeSex(), form))
if (ShapeshiftFormModelData const* formModelData = sDB2Manager.GetShapeshiftFormModelData(GetRace(), thisPlayer->GetNativeSex(), form))
{
bool useRandom = false;
switch (form)
@@ -11524,7 +11524,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
if (ChrCustomizationDisplayInfoEntry const* displayInfo = formModelData->Displays[i])
{
ChrCustomizationReqEntry const* choiceReq = sChrCustomizationReqStore.LookupEntry((*formModelData->Choices)[i]->ChrCustomizationReqID);
if (!choiceReq || thisPlayer->GetSession()->MeetsChrCustomizationReq(choiceReq, Classes(getClass()), false,
if (!choiceReq || thisPlayer->GetSession()->MeetsChrCustomizationReq(choiceReq, Classes(GetClass()), false,
MakeChrCustomizationChoiceRange(thisPlayer->m_playerData->Customizations)))
displayIds.push_back(displayInfo->DisplayID);
}
@@ -11569,13 +11569,13 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
return formEntry->CreatureDisplayID[0];
else
{
if (Player::TeamForRace(getRace()) == ALLIANCE)
if (Player::TeamForRace(GetRace()) == ALLIANCE)
modelid = formEntry->CreatureDisplayID[0];
else
modelid = formEntry->CreatureDisplayID[1];
// If the player is horde but there are no values for the horde modelid - take the alliance modelid
if (!modelid && Player::TeamForRace(getRace()) == HORDE)
if (!modelid && Player::TeamForRace(GetRace()) == HORDE)
modelid = formEntry->CreatureDisplayID[0];
}
}
@@ -13029,7 +13029,7 @@ void Unit::Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject con
return;
}
Trinity::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
Trinity::BroadcastTextBuilder builder(this, msgType, textId, GetGender(), target);
Trinity::LocalizedDo<Trinity::BroadcastTextBuilder> localizer(builder);
Trinity::PlayerDistWorker<Trinity::LocalizedDo<Trinity::BroadcastTextBuilder> > worker(this, textRange, localizer);
Cell::VisitWorldObjects(this, worker, textRange);
@@ -13064,7 +13064,7 @@ void Unit::Whisper(uint32 textId, Player* target, bool isBossWhisper /*= false*/
LocaleConstant locale = target->GetSession()->GetSessionDbLocaleIndex();
WorldPackets::Chat::Chat packet;
packet.Initialize(isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, DB2Manager::GetBroadcastTextValue(bct, locale, getGender()), 0, "", locale);
packet.Initialize(isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, DB2Manager::GetBroadcastTextValue(bct, locale, GetGender()), 0, "", locale);
target->SendDirectMessage(packet.Write());
}
@@ -13149,6 +13149,6 @@ std::string Unit::GetDebugInfo() const
<< std::boolalpha
<< "IsAIEnabled: " << IsAIEnabled() << " DeathState: " << std::to_string(getDeathState())
<< " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
<< " Class: " << std::to_string(getClass());
<< " Class: " << std::to_string(GetClass());
return sstr.str();
}