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
+4 -4
View File
@@ -469,25 +469,25 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
return true; return true;
} }
// @deprecated DO NOT USE - use GetOption<std::string> instead. /// @deprecated DO NOT USE - use GetOption<std::string> instead.
std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def, bool showLogs /*= true*/) std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def, bool showLogs /*= true*/)
{ {
return GetOption<std::string>(name, def, showLogs); return GetOption<std::string>(name, def, showLogs);
} }
// @deprecated DO NOT USE - use GetOption<bool> instead. /// @deprecated DO NOT USE - use GetOption<bool> instead.
bool ConfigMgr::GetBoolDefault(std::string const& name, bool def, bool showLogs /*= true*/) bool ConfigMgr::GetBoolDefault(std::string const& name, bool def, bool showLogs /*= true*/)
{ {
return GetOption<bool>(name, def, showLogs); return GetOption<bool>(name, def, showLogs);
} }
// @deprecated DO NOT USE - use GetOption<int32> instead. /// @deprecated DO NOT USE - use GetOption<int32> instead.
int ConfigMgr::GetIntDefault(std::string const& name, int def, bool showLogs /*= true*/) int ConfigMgr::GetIntDefault(std::string const& name, int def, bool showLogs /*= true*/)
{ {
return GetOption<int32>(name, def, showLogs); return GetOption<int32>(name, def, showLogs);
} }
// @deprecated DO NOT USE - use GetOption<float> instead. /// @deprecated DO NOT USE - use GetOption<float> instead.
float ConfigMgr::GetFloatDefault(std::string const& name, float def, bool showLogs /*= true*/) float ConfigMgr::GetFloatDefault(std::string const& name, float def, bool showLogs /*= true*/)
{ {
return GetOption<float>(name, def, showLogs); return GetOption<float>(name, def, showLogs);
@@ -348,7 +348,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
if (!target) if (!target)
return false; return false;
return target->getLevel() >= level.minlevel; return target->GetLevel() >= level.minlevel;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER:
if (!target) if (!target)
return false; return false;
@@ -986,7 +986,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria)) if (AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria))
if (!data->Meets(GetPlayer(), unit)) if (!data->Meets(GetPlayer(), unit))
continue; continue;
SetCriteriaProgress(achievementCriteria, GetPlayer()->getLevel()); SetCriteriaProgress(achievementCriteria, GetPlayer()->GetLevel());
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
// update at loading or specific skill update // update at loading or specific skill update
+1 -1
View File
@@ -284,7 +284,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
} }
// If the player does not match minimal level requirements for the battlefield, kick him // If the player does not match minimal level requirements for the battlefield, kick him
if (player->getLevel() < m_MinLevel) if (player->GetLevel() < m_MinLevel)
{ {
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0) if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + 10; m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime().count() + 10;
+1 -1
View File
@@ -455,7 +455,7 @@ void ArenaTeam::Roster(WorldSession* session)
sCharacterCache->GetCharacterNameByGuid(itr->Guid, tempName); sCharacterCache->GetCharacterNameByGuid(itr->Guid, tempName);
data << tempName; // member name data << tempName; // member name
data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
data << uint8((player ? player->getLevel() : 0)); // unknown, level? data << uint8((player ? player->GetLevel() : 0)); // unknown, level?
data << uint8(itr->Class); // class data << uint8(itr->Class); // class
data << uint32(itr->WeekGames); // played this week data << uint32(itr->WeekGames); // played this week
data << uint32(itr->WeekWins); // wins this week data << uint32(itr->WeekWins); // wins this week
@@ -862,7 +862,7 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills)); UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
// Xinef: check player level and not bracket level if (CanAwardArenaPoints()) // Xinef: check player level and not bracket level if (CanAwardArenaPoints())
if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL) if (player->GetLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
player->ModifyArenaPoints(winner_arena); player->ModifyArenaPoints(winner_arena);
if (!player->GetRandomWinner()) if (!player->GetRandomWinner())
+1 -1
View File
@@ -454,7 +454,7 @@ public:
void EndBattleground(PvPTeamId winnerTeamId); void EndBattleground(PvPTeamId winnerTeamId);
// deprecated, need delete /// @deprecated need delete
virtual void EndBattleground(TeamId winnerTeamId) virtual void EndBattleground(TeamId winnerTeamId)
{ {
EndBattleground(GetPvPTeamId(winnerTeamId)); EndBattleground(GetPvPTeamId(winnerTeamId));
@@ -575,8 +575,8 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST); uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
winner_kills = Acore::Honor::hk_honor_at_level(player->getLevel(), float(winner_kills)); winner_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(winner_kills));
loser_kills = Acore::Honor::hk_honor_at_level(player->getLevel(), float(loser_kills)); loser_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(loser_kills));
data->Initialize(SMSG_BATTLEFIELD_LIST); data->Initialize(SMSG_BATTLEFIELD_LIST);
*data << guid; // battlemaster guid *data << guid; // battlemaster guid
@@ -614,7 +614,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
if (it != bgDataStore.end()) if (it != bgDataStore.end())
{ {
// expected bracket entry // expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second._Battlegrounds.begin()->second->GetMapId(), player->getLevel())) if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second._Battlegrounds.begin()->second->GetMapId(), player->GetLevel()))
{ {
uint32 count = 0; uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId(); BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
+1 -1
View File
@@ -53,7 +53,7 @@ void WhoListCacheMgr::Update()
wstrToLower(wideGuildName); wstrToLower(wideGuildName);
_whoListStorage.emplace_back(player->GetGUID(), player->GetTeamId(), player->GetSession()->GetSecurity(), player->getLevel(), _whoListStorage.emplace_back(player->GetGUID(), player->GetTeamId(), player->GetSession()->GetSecurity(), player->GetLevel(),
player->getClass(), player->getRace(), player->getClass(), player->getRace(),
(player->IsSpectator() ? 4395 /*Dalaran*/ : player->GetZoneId()), player->getGender(), player->IsVisible(), (player->IsSpectator() ? 4395 /*Dalaran*/ : player->GetZoneId()), player->getGender(), player->IsVisible(),
widePlayerName, wideGuildName, playerName, guildName); widePlayerName, wideGuildName, playerName, guildName);
+2 -2
View File
@@ -485,7 +485,7 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
ObjectGuid invitee = invite.GetInviteeGUID(); ObjectGuid invitee = invite.GetInviteeGUID();
Player* player = ObjectAccessor::FindConnectedPlayer(invitee); Player* player = ObjectAccessor::FindConnectedPlayer(invitee);
uint8 level = player ? player->getLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee); uint8 level = player ? player->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1); WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
data << invitee.WriteAsPacked(); data << invitee.WriteAsPacked();
@@ -630,7 +630,7 @@ void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calend
ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID(); ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
Player* invitee = ObjectAccessor::FindConnectedPlayer(inviteeGuid); Player* invitee = ObjectAccessor::FindConnectedPlayer(inviteeGuid);
uint8 inviteeLevel = invitee ? invitee->getLevel() : sCharacterCache->GetCharacterLevelByGuid(inviteeGuid); uint8 inviteeLevel = invitee ? invitee->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(inviteeGuid);
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(inviteeGuid); uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(inviteeGuid);
data << inviteeGuid.WriteAsPacked(); data << inviteeGuid.WriteAsPacked();
+1 -1
View File
@@ -268,7 +268,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_LEVEL: case CONDITION_LEVEL:
{ {
if (Unit* unit = object->ToUnit()) if (Unit* unit = object->ToUnit())
condMeets = CompareValues(static_cast<ComparisionType>(ConditionValue2), static_cast<uint32>(unit->getLevel()), ConditionValue1); condMeets = CompareValues(static_cast<ComparisionType>(ConditionValue2), static_cast<uint32>(unit->GetLevel()), ConditionValue1);
break; break;
} }
case CONDITION_DRUNKENSTATE: case CONDITION_DRUNKENSTATE:
+4 -3
View File
@@ -391,7 +391,8 @@ namespace lfg
void LFGMgr::InitializeLockedDungeons(Player* player, Group const* group) void LFGMgr::InitializeLockedDungeons(Player* player, Group const* group)
{ {
ObjectGuid guid = player->GetGUID(); ObjectGuid guid = player->GetGUID();
uint8 level = player->getLevel();
uint8 level = player->GetLevel();
uint8 expansion = player->GetSession()->Expansion(); uint8 expansion = player->GetSession()->Expansion();
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0); LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
LfgLockMap lock; LfgLockMap lock;
@@ -1062,7 +1063,7 @@ namespace lfg
maxPower = (p->getPowerType() == POWER_RAGE || p->getPowerType() == POWER_RUNIC_POWER) ? p->GetMaxPower(p->getPowerType()) / 10 : p->GetMaxPower(p->getPowerType()); maxPower = (p->getPowerType() == POWER_RAGE || p->getPowerType() == POWER_RUNIC_POWER) ? p->GetMaxPower(p->getPowerType()) / 10 : p->GetMaxPower(p->getPowerType());
currInternalInfoMap[sitr->first] = RBInternalInfo(guid, sitr->second.comment, !groupGuid.IsEmpty(), groupGuid, sitr->second.roles, encounterMask, instanceGuid, currInternalInfoMap[sitr->first] = RBInternalInfo(guid, sitr->second.comment, !groupGuid.IsEmpty(), groupGuid, sitr->second.roles, encounterMask, instanceGuid,
1, p->getLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(), 1, p->GetLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(),
talents, p->GetAreaId(), p->GetArmor(), (uint32)std::max<int32>(0, spellDamage), (uint32)std::max<int32>(0, spellHeal), talents, p->GetAreaId(), p->GetArmor(), (uint32)std::max<int32>(0, spellDamage), (uint32)std::max<int32>(0, spellHeal),
p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_MELEE)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_RANGED)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_SPELL)), std::max<float>(0.0f, mp5), std::max<float>(0.0f, mp5combat), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_MELEE)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_RANGED)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_SPELL)), std::max<float>(0.0f, mp5), std::max<float>(0.0f, mp5combat),
std::max<uint32>(baseAP, rangedAP), (uint32)p->GetStat(STAT_AGILITY), p->GetMaxHealth(), maxPower, p->GetDefenseSkillValue(), std::max<uint32>(baseAP, rangedAP), (uint32)p->GetStat(STAT_AGILITY), p->GetMaxHealth(), maxPower, p->GetDefenseSkillValue(),
@@ -2266,7 +2267,7 @@ namespace lfg
if (uint8 count = GetRandomPlayersCount(player->GetGUID())) if (uint8 count = GetRandomPlayersCount(player->GetGUID()))
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, count); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, count);
LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->getLevel()); LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->GetLevel());
if (!reward) if (!reward)
continue; continue;
@@ -546,7 +546,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
} }
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class);
float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float? float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor); SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor);
SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY])); SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY]));
@@ -1213,7 +1213,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const
bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
{ {
return player->getLevel() >= 10 return player->GetLevel() >= 10
&& GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS && GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS
&& player->getClass() == GetCreatureTemplate()->trainer_class; && player->getClass() == GetCreatureTemplate()->trainer_class;
} }
@@ -2898,7 +2898,7 @@ uint8 Creature::getLevelForTarget(WorldObject const* target) const
if (!isWorldBoss() || !target->ToUnit()) if (!isWorldBoss() || !target->ToUnit())
return Unit::getLevelForTarget(target); return Unit::getLevelForTarget(target);
uint16 level = target->ToUnit()->getLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF); uint16 level = target->ToUnit()->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
if (level < 1) if (level < 1)
return 1; return 1;
if (level > 255) if (level > 255)
+1 -1
View File
@@ -152,7 +152,7 @@ public:
[[nodiscard]] uint32 GetShieldBlockValue() const override [[nodiscard]] uint32 GetShieldBlockValue() const override
{ {
return (getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20)); return (GetLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
} }
[[nodiscard]] SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType /*attackType*/ = BASE_ATTACK, uint8 /*damageIndex*/ = 0) const override { return m_meleeDamageSchoolMask; } [[nodiscard]] SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType /*attackType*/ = BASE_ATTACK, uint8 /*damageIndex*/ = 0) const override { return m_meleeDamageSchoolMask; }
@@ -452,12 +452,12 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
uint32 moneyRew = 0; uint32 moneyRew = 0;
Player* player = _session->GetPlayer(); Player* player = _session->GetPlayer();
uint8 playerLevel = player ? player->getLevel() : 0; uint8 playerLevel = player ? player->GetLevel() : 0;
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))) if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
{ {
moneyRew = quest->GetRewMoneyMaxLevel(); moneyRew = quest->GetRewMoneyMaxLevel();
} }
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl) moneyRew += quest->GetRewOrReqMoney(player ? player->GetLevel() : 0); // reward money (below max lvl)
data << moneyRew; data << moneyRew;
uint32 questXp; uint32 questXp;
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)) if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
@@ -553,11 +553,11 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
{ {
uint32 moneyRew = 0; uint32 moneyRew = 0;
Player* player = _session->GetPlayer(); Player* player = _session->GetPlayer();
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))) if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
{ {
moneyRew = quest->GetRewMoneyMaxLevel(); moneyRew = quest->GetRewMoneyMaxLevel();
} }
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl) moneyRew += quest->GetRewOrReqMoney(player ? player->GetLevel() : 0); // reward money (below max lvl)
data << moneyRew; data << moneyRew;
} }
@@ -705,12 +705,12 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
uint32 moneyRew = 0; uint32 moneyRew = 0;
Player* player = _session->GetPlayer(); Player* player = _session->GetPlayer();
uint8 playerLevel = player ? player->getLevel() : 0; uint8 playerLevel = player ? player->GetLevel() : 0;
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))) if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
{ {
moneyRew = quest->GetRewMoneyMaxLevel(); moneyRew = quest->GetRewMoneyMaxLevel();
} }
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl) moneyRew += quest->GetRewOrReqMoney(player ? player->GetLevel() : 0); // reward money (below max lvl)
data << moneyRew; data << moneyRew;
uint32 questXp; uint32 questXp;
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)) if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
@@ -216,7 +216,7 @@ void TempSummon::InitStats(uint32 duration)
if (IsTrigger() && m_spells[0]) if (IsTrigger() && m_spells[0])
{ {
SetFaction(owner->GetFaction()); SetFaction(owner->GetFaction());
SetLevel(owner->getLevel()); SetLevel(owner->GetLevel());
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true; m_ControlledByPlayer = true;
} }
@@ -412,7 +412,7 @@ void Guardian::InitStats(uint32 duration)
if (Unit* m_owner = GetOwner()) if (Unit* m_owner = GetOwner())
{ {
InitStatsForLevel(m_owner->getLevel()); InitStatsForLevel(m_owner->GetLevel());
if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
m_charmInfo->InitCharmCreateSpells(); m_charmInfo->InitCharmCreateSpells();
@@ -450,7 +450,7 @@ Puppet::Puppet(SummonPropertiesEntry const* properties, ObjectGuid owner) : Mini
void Puppet::InitStats(uint32 duration) void Puppet::InitStats(uint32 duration)
{ {
Minion::InitStats(duration); Minion::InitStats(duration);
SetLevel(GetOwner()->getLevel()); SetLevel(GetOwner()->GetLevel());
SetReactState(REACT_PASSIVE); SetReactState(REACT_PASSIVE);
} }
@@ -1916,10 +1916,10 @@ void GameObject::Use(Unit* user)
return; return;
//required lvl checks! //required lvl checks!
uint8 level = player->getLevel(); uint8 level = player->GetLevel();
if (level < info->meetingstone.minLevel) if (level < info->meetingstone.minLevel)
return; return;
level = targetPlayer->getLevel(); level = targetPlayer->GetLevel();
if (level < info->meetingstone.minLevel) if (level < info->meetingstone.minLevel)
return; return;
@@ -2107,7 +2107,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
{ {
trigger->SetLevel(owner->getLevel(), false); trigger->SetLevel(owner->GetLevel(), false);
trigger->SetFaction(owner->GetFaction()); trigger->SetFaction(owner->GetFaction());
// needed for GO casts for proper target validation checks // needed for GO casts for proper target validation checks
trigger->SetOwnerGUID(owner->GetGUID()); trigger->SetOwnerGUID(owner->GetGUID());
+1 -1
View File
@@ -2361,7 +2361,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)) if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT))
{ {
summon->SetFaction(((Unit*)this)->GetFaction()); summon->SetFaction(((Unit*)this)->GetFaction());
summon->SetLevel(((Unit*)this)->getLevel()); summon->SetLevel(((Unit*)this)->GetLevel());
} }
// Xinef: correctly set phase mask in case of gameobjects // Xinef: correctly set phase mask in case of gameobjects
+24 -24
View File
@@ -296,7 +296,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
switch (getPetType()) switch (getPetType())
{ {
case SUMMON_PET: case SUMMON_PET:
petlevel = owner->getLevel(); petlevel = owner->GetLevel();
if (IsPetGhoul()) if (IsPetGhoul())
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x400); // class = rogue SetUInt32Value(UNIT_FIELD_BYTES_0, 0x400); // class = rogue
@@ -565,7 +565,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
stmt->SetData(3, GetNativeDisplayId()); stmt->SetData(3, GetNativeDisplayId());
stmt->SetData(4, GetUInt32Value(UNIT_CREATED_BY_SPELL)); stmt->SetData(4, GetUInt32Value(UNIT_CREATED_BY_SPELL));
stmt->SetData(5, uint8(getPetType())); stmt->SetData(5, uint8(getPetType()));
stmt->SetData(6, getLevel()); stmt->SetData(6, GetLevel());
stmt->SetData(7, GetUInt32Value(UNIT_FIELD_PETEXPERIENCE)); stmt->SetData(7, GetUInt32Value(UNIT_FIELD_PETEXPERIENCE));
stmt->SetData(8, uint8(GetReactState())); stmt->SetData(8, uint8(GetReactState()));
stmt->SetData(9, GetName()); stmt->SetData(9, GetName());
@@ -887,8 +887,8 @@ void Pet::GivePetXP(uint32 xp)
if (!IsAlive()) if (!IsAlive())
return; return;
uint8 maxlevel = std::min((uint8)sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL), GetOwner()->getLevel()); uint8 maxlevel = std::min((uint8)sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL), GetOwner()->GetLevel());
uint8 petlevel = getLevel(); uint8 petlevel = GetLevel();
// If pet is detected to be at, or above(?) the players level, don't hand out XP // If pet is detected to be at, or above(?) the players level, don't hand out XP
if (petlevel >= maxlevel) if (petlevel >= maxlevel)
@@ -915,7 +915,7 @@ void Pet::GivePetXP(uint32 xp)
void Pet::GivePetLevel(uint8 level) void Pet::GivePetLevel(uint8 level)
{ {
if (!level || level == getLevel()) if (!level || level == GetLevel())
return; return;
if (getPetType() == HUNTER_PET) if (getPetType() == HUNTER_PET)
@@ -992,7 +992,7 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phas
setPowerType(POWER_FOCUS); setPowerType(POWER_FOCUS);
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr->GetXPForLevel(getLevel() + 1)* sWorld->getRate(RATE_XP_PET_NEXT_LEVEL))); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr->GetXPForLevel(GetLevel() + 1)* sWorld->getRate(RATE_XP_PET_NEXT_LEVEL)));
ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
if (cinfo->type == CREATURE_TYPE_BEAST) if (cinfo->type == CREATURE_TYPE_BEAST)
@@ -1078,12 +1078,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
if (cFamily && cFamily->minScale > 0.0f && petType == HUNTER_PET) if (cFamily && cFamily->minScale > 0.0f && petType == HUNTER_PET)
{ {
float scale; float scale;
if (getLevel() >= cFamily->maxScaleLevel) if (GetLevel() >= cFamily->maxScaleLevel)
scale = 1.0f; scale = 1.0f;
else if (getLevel() <= cFamily->minScaleLevel) else if (GetLevel() <= cFamily->minScaleLevel)
scale = 0.5f; scale = 0.5f;
else else
scale = 0.5f + 0.5f * float(getLevel() - cFamily->minScaleLevel) / float(cFamily->maxScaleLevel - cFamily->minScaleLevel); scale = 0.5f + 0.5f * float(GetLevel() - cFamily->minScaleLevel) / float(cFamily->maxScaleLevel - cFamily->minScaleLevel);
SetObjectScale(scale); SetObjectScale(scale);
} }
@@ -1421,13 +1421,13 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const
{ {
// -5 or greater food level // -5 or greater food level
if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect if (GetLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
return 35000; return 35000;
// -10..-6 // -10..-6
else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good else if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good
return 17000; return 17000;
// -14..-11 // -14..-11
else if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me else if (GetLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
return 8000; return 8000;
// -15 or less // -15 or less
else else
@@ -1611,7 +1611,7 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff)
} }
// avoid higher level auras if any, and adjust // avoid higher level auras if any, and adjust
SpellInfo const* scaledSpellInfo = spellInfo->GetAuraRankForLevel(getLevel()); SpellInfo const* scaledSpellInfo = spellInfo->GetAuraRankForLevel(GetLevel());
if (scaledSpellInfo != spellInfo) if (scaledSpellInfo != spellInfo)
spellInfo = scaledSpellInfo; spellInfo = scaledSpellInfo;
@@ -1864,7 +1864,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
uint32 talentCost = GetTalentSpellCost(spellId); uint32 talentCost = GetTalentSpellCost(spellId);
if (talentCost) if (talentCost)
{ {
int32 free_points = GetMaxTalentPointsForLevel(getLevel()); int32 free_points = GetMaxTalentPointsForLevel(GetLevel());
m_usedTalentCount += talentCost; m_usedTalentCount += talentCost;
// update free talent points // update free talent points
free_points -= m_usedTalentCount; free_points -= m_usedTalentCount;
@@ -1892,7 +1892,7 @@ bool Pet::learnSpell(uint32 spell_id)
void Pet::InitLevelupSpellsForLevel() void Pet::InitLevelupSpellsForLevel()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : nullptr) if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : nullptr)
{ {
@@ -1970,7 +1970,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
else else
m_usedTalentCount = 0; m_usedTalentCount = 0;
// update free talent points // update free talent points
int32 free_points = GetMaxTalentPointsForLevel(getLevel()) - m_usedTalentCount; int32 free_points = GetMaxTalentPointsForLevel(GetLevel()) - m_usedTalentCount;
SetFreeTalentPoints(free_points > 0 ? free_points : 0); SetFreeTalentPoints(free_points > 0 ? free_points : 0);
} }
@@ -2044,7 +2044,7 @@ bool Pet::resetTalents()
Player* player = owner->ToPlayer(); Player* player = owner->ToPlayer();
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level); uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
if (m_usedTalentCount == 0) if (m_usedTalentCount == 0)
@@ -2166,7 +2166,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= nullptr*/)
void Pet::InitTalentForLevel() void Pet::InitTalentForLevel()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level); uint32 talentPointsForLevel = GetMaxTalentPointsForLevel(level);
Unit* owner = GetOwner(); Unit* owner = GetOwner();
@@ -2349,14 +2349,14 @@ void Pet::SynchronizeLevelWithOwner()
{ {
// always same level // always same level
case SUMMON_PET: case SUMMON_PET:
GivePetLevel(owner->getLevel()); GivePetLevel(owner->GetLevel());
break; break;
// can't be greater owner level // can't be greater owner level
case HUNTER_PET: case HUNTER_PET:
if (getLevel() > owner->getLevel()) if (GetLevel() > owner->GetLevel())
GivePetLevel(owner->getLevel()); GivePetLevel(owner->GetLevel());
else if (getLevel() + 5 < owner->getLevel()) else if (GetLevel() + 5 < owner->GetLevel())
GivePetLevel(owner->getLevel() - 5); GivePetLevel(owner->GetLevel() - 5);
break; break;
default: default:
break; break;
@@ -2421,7 +2421,7 @@ void Pet::FillPetInfo(PetStable::PetInfo* petInfo) const
petInfo->PetNumber = m_charmInfo->GetPetNumber(); petInfo->PetNumber = m_charmInfo->GetPetNumber();
petInfo->CreatureId = GetEntry(); petInfo->CreatureId = GetEntry();
petInfo->DisplayId = GetNativeDisplayId(); petInfo->DisplayId = GetNativeDisplayId();
petInfo->Level = getLevel(); petInfo->Level = GetLevel();
petInfo->Experience = GetUInt32Value(UNIT_FIELD_PETEXPERIENCE); petInfo->Experience = GetUInt32Value(UNIT_FIELD_PETEXPERIENCE);
petInfo->ReactState = GetReactState(); petInfo->ReactState = GetReactState();
petInfo->Name = GetName(); petInfo->Name = GetName();
@@ -87,7 +87,7 @@ void KillRewarder::_InitGroupData()
if (Player* member = itr->GetSource()) if (Player* member = itr->GetSource())
if ((_killer == member || member->IsAtGroupRewardDistance(_victim))) if ((_killer == member || member->IsAtGroupRewardDistance(_victim)))
{ {
const uint8 lvl = member->getLevel(); const uint8 lvl = member->GetLevel();
if (member->IsAlive()) if (member->IsAlive())
{ {
// 2.1. _count - number of alive group members within reward distance; // 2.1. _count - number of alive group members within reward distance;
@@ -102,7 +102,7 @@ void KillRewarder::_InitGroupData()
// 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance, // 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
// for whom victim is not gray; // for whom victim is not gray;
uint32 grayLevel = Acore::XP::GetGrayLevel(lvl); uint32 grayLevel = Acore::XP::GetGrayLevel(lvl);
if (_victim->getLevel() > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember->getLevel() < lvl)) if (_victim->GetLevel() > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember->GetLevel() < lvl))
{ {
_maxNotGrayMember = member; _maxNotGrayMember = member;
} }
@@ -112,7 +112,7 @@ void KillRewarder::_InitGroupData()
} }
// 2.6. _isFullXP - flag identifying that for all group members victim is not gray, // 2.6. _isFullXP - flag identifying that for all group members victim is not gray,
// so 100% XP will be rewarded (50% otherwise). // so 100% XP will be rewarded (50% otherwise).
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember->getLevel()); _isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember->GetLevel());
} }
else else
_count = 1; _count = 1;
@@ -151,7 +151,7 @@ void KillRewarder::_RewardXP(Player* player, float rate)
// * set to 0 if player's level is more than maximum level of not gray member; // * set to 0 if player's level is more than maximum level of not gray member;
// * cut XP in half if _isFullXP is false. // * cut XP in half if _isFullXP is false.
if (_maxNotGrayMember && player->IsAlive() && if (_maxNotGrayMember && player->IsAlive() &&
_maxNotGrayMember->getLevel() >= player->getLevel()) _maxNotGrayMember->GetLevel() >= player->GetLevel())
xp = _isFullXP ? xp = _isFullXP ?
uint32(xp * rate) : // Reward FULL XP if all group members are not gray. uint32(xp * rate) : // Reward FULL XP if all group members are not gray.
uint32(xp * rate / 2) + 1; // Reward only HALF of XP if some of group members are gray. uint32(xp * rate / 2) + 1; // Reward only HALF of XP if some of group members are gray.
@@ -206,8 +206,8 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
// Give reputation and kill credit only in PvE. // Give reputation and kill credit only in PvE.
if (!_isPvP || _isBattleGround) if (!_isPvP || _isBattleGround)
{ {
float xpRate = _group ? _groupRate * float(player->getLevel()) / _aliveSumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels. float xpRate = _group ? _groupRate * float(player->GetLevel()) / _aliveSumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels.
float reputationRate = _group ? _groupRate * float(player->getLevel()) / _sumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels. float reputationRate = _group ? _groupRate * float(player->GetLevel()) / _sumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels.
sScriptMgr->OnRewardKillRewarder(player, isDungeon, xpRate); // Personal rate is 100%. sScriptMgr->OnRewardKillRewarder(player, isDungeon, xpRate); // Personal rate is 100%.
if (_xp) if (_xp)
+64 -61
View File
@@ -854,7 +854,7 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimer[BREATH_TIMER] += 1 * IN_MILLISECONDS; m_MirrorTimer[BREATH_TIMER] += 1 * IN_MILLISECONDS;
// Calculate and deal damage // Calculate and deal damage
// TODO: Check this formula // TODO: Check this formula
uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
EnvironmentalDamage(DAMAGE_DROWNING, damage); EnvironmentalDamage(DAMAGE_DROWNING, damage);
} }
else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need
@@ -890,7 +890,7 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimer[FATIGUE_TIMER] += 1 * IN_MILLISECONDS; m_MirrorTimer[FATIGUE_TIMER] += 1 * IN_MILLISECONDS;
if (IsAlive()) // Calculate and deal damage if (IsAlive()) // Calculate and deal damage
{ {
uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1);
EnvironmentalDamage(DAMAGE_EXHAUSTED, damage); EnvironmentalDamage(DAMAGE_EXHAUSTED, damage);
} }
else if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard else if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard
@@ -1850,8 +1850,8 @@ void Player::Regenerate(Powers power)
bool recentCast = IsUnderLastManaUseEffect(); bool recentCast = IsUnderLastManaUseEffect();
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA); float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && getLevel() < 15) if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA) * (2.066f - (getLevel() * 0.066f)); ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA) * (2.066f - (GetLevel() * 0.066f));
if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer; addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
@@ -1960,8 +1960,8 @@ void Player::RegenerateHealth()
float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH); float HealthIncreaseRate = sWorld->getRate(RATE_HEALTH);
if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && getLevel() < 15) if (sWorld->getBoolConfig(CONFIG_LOW_LEVEL_REGEN_BOOST) && GetLevel() < 15)
HealthIncreaseRate = sWorld->getRate(RATE_HEALTH) * (2.066f - (getLevel() * 0.066f)); HealthIncreaseRate = sWorld->getRate(RATE_HEALTH) * (2.066f - (GetLevel() * 0.066f));
float addvalue = 0.0f; float addvalue = 0.0f;
@@ -2354,7 +2354,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
return; return;
} }
uint8 level = getLevel(); uint8 level = GetLevel();
sScriptMgr->OnGivePlayerXP(this, xp, victim); sScriptMgr->OnGivePlayerXP(this, xp, victim);
@@ -2400,7 +2400,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
GiveLevel(level + 1); GiveLevel(level + 1);
level = getLevel(); level = GetLevel();
nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP); nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
} }
@@ -2411,7 +2411,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
// Current player experience not update (must be update by caller) // Current player experience not update (must be update by caller)
void Player::GiveLevel(uint8 level) void Player::GiveLevel(uint8 level)
{ {
uint8 oldLevel = getLevel(); uint8 oldLevel = GetLevel();
if (level == oldLevel) if (level == oldLevel)
return; return;
@@ -2532,15 +2532,15 @@ void Player::InitStatsForLevel(bool reapplyMods)
_RemoveAllStatBonuses(); _RemoveAllStatBonuses();
PlayerClassLevelInfo classInfo; PlayerClassLevelInfo classInfo;
sObjectMgr->GetPlayerClassLevelInfo(getClass(), getLevel(), &classInfo); sObjectMgr->GetPlayerClassLevelInfo(getClass(), GetLevel(), &classInfo);
PlayerLevelInfo info; PlayerLevelInfo info;
sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), getLevel(), &info); sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info);
uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel); sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel);
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel); SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel);
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(getLevel())); SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(GetLevel()));
// reset before any aura state sources (health set/aura apply) // reset before any aura state sources (health set/aura apply)
SetUInt32Value(UNIT_FIELD_AURASTATE, 0); SetUInt32Value(UNIT_FIELD_AURASTATE, 0);
@@ -3853,7 +3853,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
return TRAINER_SPELL_RED; return TRAINER_SPELL_RED;
// check level requirement // check level requirement
if (getLevel() < trainer_spell->reqLevel) if (GetLevel() < trainer_spell->reqLevel)
return TRAINER_SPELL_RED; return TRAINER_SPELL_RED;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -4425,15 +4425,15 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
//Characters level 20 and up suffer from ten minutes of sickness. //Characters level 20 and up suffer from ten minutes of sickness.
int32 startLevel = sWorld->getIntConfig(CONFIG_DEATH_SICKNESS_LEVEL); int32 startLevel = sWorld->getIntConfig(CONFIG_DEATH_SICKNESS_LEVEL);
if (int32(getLevel()) >= startLevel) if (int32(GetLevel()) >= startLevel)
{ {
// set resurrection sickness // set resurrection sickness
CastSpell(this, 15007, true); CastSpell(this, 15007, true);
// not full duration // not full duration
if (int32(getLevel()) < startLevel + 9) if (int32(GetLevel()) < startLevel + 9)
{ {
int32 delta = (int32(getLevel()) - startLevel + 1) * MINUTE; int32 delta = (int32(GetLevel()) - startLevel + 1) * MINUTE;
if (Aura* aur = GetAura(15007, GetGUID())) if (Aura* aur = GetAura(15007, GetGUID()))
{ {
@@ -4990,7 +4990,7 @@ uint32 Player::GetShieldBlockValue() const
float Player::GetMeleeCritFromAgility() float Player::GetMeleeCritFromAgility()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 pclass = getClass(); uint32 pclass = getClass();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
@@ -5038,7 +5038,7 @@ void Player::GetDodgeFromAgility(float& diminishing, float& nondiminishing)
2.00f / 1.15f // Druid 2.00f / 1.15f // Druid
}; };
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 pclass = getClass(); uint32 pclass = getClass();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
@@ -5060,7 +5060,7 @@ void Player::GetDodgeFromAgility(float& diminishing, float& nondiminishing)
float Player::GetSpellCritFromIntellect() float Player::GetSpellCritFromIntellect()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 pclass = getClass(); uint32 pclass = getClass();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
@@ -5077,7 +5077,7 @@ float Player::GetSpellCritFromIntellect()
float Player::GetRatingMultiplier(CombatRating cr) const float Player::GetRatingMultiplier(CombatRating cr) const
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
level = GT_MAX_LEVEL; level = GT_MAX_LEVEL;
@@ -5112,7 +5112,7 @@ float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
float Player::OCTRegenHPPerSpirit() float Player::OCTRegenHPPerSpirit()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 pclass = getClass(); uint32 pclass = getClass();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
@@ -5135,7 +5135,7 @@ float Player::OCTRegenHPPerSpirit()
float Player::OCTRegenMPPerSpirit() float Player::OCTRegenMPPerSpirit()
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 pclass = getClass(); uint32 pclass = getClass();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
@@ -5687,17 +5687,17 @@ void Player::CheckAreaExploreAndOutdoor()
if (areaEntry->area_level > 0) if (areaEntry->area_level > 0)
{ {
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
SendExplorationExperience(areaId, 0); SendExplorationExperience(areaId, 0);
} }
else else
{ {
int32 diff = int32(getLevel()) - areaEntry->area_level; int32 diff = int32(GetLevel()) - areaEntry->area_level;
uint32 XP = 0; uint32 XP = 0;
if (diff < -5) if (diff < -5)
{ {
XP = uint32(sObjectMgr->GetBaseXP(getLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE)); XP = uint32(sObjectMgr->GetBaseXP(GetLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE));
} }
else if (diff > 5) else if (diff > 5)
{ {
@@ -5792,7 +5792,7 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
break; break;
} }
if (rate != 1.0f && creatureOrQuestLevel <= Acore::XP::GetGrayLevel(getLevel())) if (rate != 1.0f && creatureOrQuestLevel <= Acore::XP::GetGrayLevel(GetLevel()))
percent *= rate; percent *= rate;
if (percent <= 0.0f) if (percent <= 0.0f)
@@ -5869,7 +5869,7 @@ void Player::RewardReputation(Unit* victim, float rate)
if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE)) if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
{ {
float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
donerep1 *= rate; donerep1 *= rate;
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
@@ -5881,7 +5881,7 @@ void Player::RewardReputation(Unit* victim, float rate)
if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE)) if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
{ {
float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
donerep2 *= rate; donerep2 *= rate;
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
@@ -6011,9 +6011,9 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (GetTeamId() == victim->GetTeamId() && !sWorld->IsFFAPvPRealm()) if (GetTeamId() == victim->GetTeamId() && !sWorld->IsFFAPvPRealm())
return false; return false;
uint8 k_level = getLevel(); uint8 k_level = GetLevel();
uint8 k_grey = Acore::XP::GetGrayLevel(k_level); uint8 k_grey = Acore::XP::GetGrayLevel(k_level);
uint8 v_level = victim->getLevel(); uint8 v_level = victim->GetLevel();
if (v_level <= k_grey) if (v_level <= k_grey)
return false; return false;
@@ -6103,7 +6103,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping
// Xinef: Only for BG activities // Xinef: Only for BG activities
if (!uVictim) if (!uVictim)
GiveXP(uint32(honor * (3 + getLevel() * 0.30f)), nullptr); GiveXP(uint32(honor * (3 + GetLevel() * 0.30f)), nullptr);
} }
if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE)) if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))
@@ -6492,7 +6492,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
return; return;
// req. check at equip, but allow use for extended range if range limit max level, set proper level // req. check at equip, but allow use for extended range if range limit max level, set proper level
uint32 ssd_level = getLevel(); uint32 ssd_level = GetLevel();
uint32 CustomScalingStatValue = 0; uint32 CustomScalingStatValue = 0;
sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue); sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
@@ -6684,7 +6684,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
case ITEM_MOD_BLOCK_VALUE: case ITEM_MOD_BLOCK_VALUE:
HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply); HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
break; break;
// deprecated item mods /// @deprecated item mods
case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_HEALING_DONE:
case ITEM_MOD_SPELL_DAMAGE_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE:
break; break;
@@ -6790,7 +6790,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr; ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : nullptr;
// req. check at equip, but allow use for extended range if range limit max level, set proper level // req. check at equip, but allow use for extended range if range limit max level, set proper level
uint32 ssd_level = getLevel(); uint32 ssd_level = GetLevel();
if (ssd && ssd_level > ssd->MaxLevel) if (ssd && ssd_level > ssd->MaxLevel)
ssd_level = ssd->MaxLevel; ssd_level = ssd->MaxLevel;
@@ -7632,7 +7632,7 @@ void Player::RemovedInsignia(Player* looterPlr)
// We store the level of our player in the gold field // We store the level of our player in the gold field
// We retrieve this information at Player::SendLoot() // We retrieve this information at Player::SendLoot()
bones->loot.gold = getLevel(); bones->loot.gold = GetLevel();
bones->lootRecipient = looterPlr; bones->lootRecipient = looterPlr;
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA); looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
} }
@@ -7883,8 +7883,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true);
// Generate extra money for pick pocket loot // Generate extra money for pick pocket loot
const uint32 a = urand(0, creature->getLevel() / 2); const uint32 a = urand(0, creature->GetLevel() / 2);
const uint32 b = urand(0, getLevel() / 2); const uint32 b = urand(0, GetLevel() / 2);
loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY)); loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
permission = OWNER_PERMISSION; permission = OWNER_PERMISSION;
} }
@@ -8861,7 +8861,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->setPowerType(POWER_MANA); pet->setPowerType(POWER_MANA);
pet->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); pet->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pet->InitStatsForLevel(getLevel()); pet->InitStatsForLevel(GetLevel());
SetMinion(pet, true); SetMinion(pet, true);
@@ -9110,7 +9110,7 @@ Pet* Player::CreatePet(Creature* creatureTarget, uint32 spellID /*= 0*/)
creatureTarget->DespawnOrUnsummon(); creatureTarget->DespawnOrUnsummon();
// calculate proper level // calculate proper level
uint8 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : getLevel(); uint8 level = (creatureTarget->GetLevel() < (GetLevel() - 5)) ? (GetLevel() - 5) : GetLevel();
// prepare visual effect for levelup // prepare visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1); pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
@@ -9154,13 +9154,13 @@ Pet* Player::CreatePet(uint32 creatureEntry, uint32 spellID /*= 0*/)
} }
// prepare visual effect for levelup // prepare visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, getLevel() - 1); pet->SetUInt32Value(UNIT_FIELD_LEVEL, GetLevel() - 1);
// add to world // add to world
pet->GetMap()->AddToMap(pet->ToCreature()); pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup // visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, getLevel()); pet->SetUInt32Value(UNIT_FIELD_LEVEL, GetLevel());
// caster have pet now // caster have pet now
SetMinion(pet, true); SetMinion(pet, true);
@@ -9939,7 +9939,7 @@ void Player::LeaveAllArenaTeams(ObjectGuid guid)
void Player::SetRestBonus(float rest_bonus_new) void Player::SetRestBonus(float rest_bonus_new)
{ {
// Prevent resting on max level // Prevent resting on max level
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
rest_bonus_new = 0; rest_bonus_new = 0;
if (rest_bonus_new < 0) if (rest_bonus_new < 0)
@@ -11652,7 +11652,7 @@ void Player::LearnDefaultSkill(uint32 skillId, uint16 rank)
} }
else if (getClass() == CLASS_DEATH_KNIGHT) else if (getClass() == CLASS_DEATH_KNIGHT)
{ {
skillValue = std::min(std::max<uint16>({ 1, uint16((getLevel() - 1) * 5) }), maxValue); skillValue = std::min(std::max<uint16>({ 1, uint16((GetLevel() - 1) * 5) }), maxValue);
} }
else if (skillId == SKILL_FIST_WEAPONS) else if (skillId == SKILL_FIST_WEAPONS)
{ {
@@ -11685,7 +11685,7 @@ void Player::LearnDefaultSkill(uint32 skillId, uint16 rank)
} }
else if (getClass() == CLASS_DEATH_KNIGHT) else if (getClass() == CLASS_DEATH_KNIGHT)
{ {
skillValue = std::min(std::max<uint16>({ uint16(1), uint16((getLevel() - 1) * 5) }), maxValue); skillValue = std::min(std::max<uint16>({ uint16(1), uint16((GetLevel() - 1) * 5) }), maxValue);
} }
SetSkill(skillId, rank, skillValue, maxValue); SetSkill(skillId, rank, skillValue, maxValue);
@@ -12081,7 +12081,7 @@ bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
return false; return false;
// limit check leel to dbc compatible level range // limit check leel to dbc compatible level range
uint32 level = getLevel(); uint32 level = GetLevel();
if (level > DEFAULT_MAX_LEVEL) if (level > DEFAULT_MAX_LEVEL)
level = DEFAULT_MAX_LEVEL; level = DEFAULT_MAX_LEVEL;
@@ -12418,8 +12418,8 @@ uint32 Player::GetResurrectionSpellId()
// Used in triggers for check "Only to targets that grant experience or honor" req // Used in triggers for check "Only to targets that grant experience or honor" req
bool Player::isHonorOrXPTarget(Unit* victim) const bool Player::isHonorOrXPTarget(Unit* victim) const
{ {
uint8 v_level = victim->getLevel(); uint8 v_level = victim->GetLevel();
uint8 k_grey = Acore::XP::GetGrayLevel(getLevel()); uint8 k_grey = Acore::XP::GetGrayLevel(GetLevel());
// Victim level less gray level // Victim level less gray level
if (v_level <= k_grey) if (v_level <= k_grey)
@@ -12438,7 +12438,7 @@ bool Player::isHonorOrXPTarget(Unit* victim) const
bool Player::GetsRecruitAFriendBonus(bool forXP) bool Player::GetsRecruitAFriendBonus(bool forXP)
{ {
bool recruitAFriend = false; bool recruitAFriend = false;
if (getLevel() <= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL) || !forXP) if (GetLevel() <= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL) || !forXP)
{ {
if (Group* group = this->GetGroup()) if (Group* group = this->GetGroup())
{ {
@@ -12454,12 +12454,12 @@ bool Player::GetsRecruitAFriendBonus(bool forXP)
if (forXP) if (forXP)
{ {
// level must be allowed to get RaF bonus // level must be allowed to get RaF bonus
if (player->getLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) if (player->GetLevel() > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
continue; continue;
// level difference must be small enough to get RaF bonus, UNLESS we are lower level // level difference must be small enough to get RaF bonus, UNLESS we are lower level
if (player->getLevel() < getLevel()) if (player->GetLevel() < GetLevel())
if (uint8(getLevel() - player->getLevel()) > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE)) if (uint8(GetLevel() - player->GetLevel()) > sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE))
continue; continue;
} }
@@ -12978,8 +12978,11 @@ bool Player::CanUseBattlegroundObject(GameObject* gameobject) const
return false; return false;
} }
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet /**
// Note: Mount, stealth and invisibility will be removed when used * @bug
* sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
* Note: Mount, stealth and invisibility will be removed when used
*/
return (!isTotalImmune() && // Damage immune return (!isTotalImmune() && // Damage immune
!HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // Still has recently held flag debuff !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // Still has recently held flag debuff
IsAlive()); // Alive IsAlive()); // Alive
@@ -12995,7 +12998,7 @@ bool Player::CanCaptureTowerPoint() const
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin) uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin)
{ {
uint8 level = getLevel(); uint8 level = GetLevel();
if (level > GT_MAX_LEVEL) if (level > GT_MAX_LEVEL)
level = GT_MAX_LEVEL; // max level in this dbc level = GT_MAX_LEVEL; // max level in this dbc
@@ -13037,7 +13040,7 @@ void Player::InitGlyphsForLevel()
if (gs->Order) if (gs->Order)
SetGlyphSlot(gs->Order - 1, gs->Id); SetGlyphSlot(gs->Order - 1, gs->Id);
uint8 level = getLevel(); uint8 level = GetLevel();
uint32 value = 0; uint32 value = 0;
// 0x3F = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 for 80 level // 0x3F = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 for 80 level
@@ -13360,7 +13363,7 @@ LootItem* Player::StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg
uint32 Player::CalculateTalentsPoints() const uint32 Player::CalculateTalentsPoints() const
{ {
uint32 base_talent = getLevel() < 10 ? 0 : getLevel() - 9; uint32 base_talent = GetLevel() < 10 ? 0 : GetLevel() - 9;
uint32 talentPointsForLevel = 0; uint32 talentPointsForLevel = 0;
if (getClass() != CLASS_DEATH_KNIGHT || GetMapId() != 609) if (getClass() != CLASS_DEATH_KNIGHT || GetMapId() != 609)
@@ -13369,7 +13372,7 @@ uint32 Player::CalculateTalentsPoints() const
} }
else else
{ {
talentPointsForLevel = getLevel() < 56 ? 0 : getLevel() - 55; talentPointsForLevel = GetLevel() < 56 ? 0 : GetLevel() - 55;
talentPointsForLevel += m_questRewardTalentCount; talentPointsForLevel += m_questRewardTalentCount;
if (talentPointsForLevel > base_talent) if (talentPointsForLevel > base_talent)
@@ -14433,7 +14436,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, getRace(true)); stmt->SetData(index++, getRace(true));
stmt->SetData(index++, getClass()); stmt->SetData(index++, getClass());
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt->SetData(index++, getLevel()); stmt->SetData(index++, GetLevel());
stmt->SetData(index++, GetUInt32Value(PLAYER_XP)); stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
stmt->SetData(index++, GetMoney()); stmt->SetData(index++, GetMoney());
stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
@@ -14550,7 +14553,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, getRace(true)); stmt->SetData(index++, getRace(true));
stmt->SetData(index++, getClass()); stmt->SetData(index++, getClass());
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect stmt->SetData(index++, GetByteValue(PLAYER_BYTES_3, 0)); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt->SetData(index++, getLevel()); stmt->SetData(index++, GetLevel());
stmt->SetData(index++, GetUInt32Value(PLAYER_XP)); stmt->SetData(index++, GetUInt32Value(PLAYER_XP));
stmt->SetData(index++, GetMoney()); stmt->SetData(index++, GetMoney());
stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES, 0));
@@ -15459,7 +15462,7 @@ float Player::GetAverageItemLevel()
{ {
float sum = 0; float sum = 0;
uint32 count = 0; uint32 count = 0;
uint8 level = getLevel(); uint8 level = GetLevel();
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{ {
@@ -15480,7 +15483,7 @@ float Player::GetAverageItemLevelForDF()
{ {
float sum = 0; float sum = 0;
uint32 count = 0; uint32 count = 0;
uint8 level = getLevel(); uint8 level = GetLevel();
for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{ {
+2 -2
View File
@@ -1121,7 +1121,7 @@ public:
PlayerSocial* GetSocial() { return m_social; } PlayerSocial* GetSocial() { return m_social; }
PlayerTaxi m_taxi; PlayerTaxi m_taxi;
void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); } void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), GetLevel()); }
bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 1); bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = nullptr, uint32 spellid = 1);
bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 1); bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 1);
void CleanupAfterTaxiFlight(); void CleanupAfterTaxiFlight();
@@ -1388,7 +1388,7 @@ public:
/*** QUEST SYSTEM ***/ /*** QUEST SYSTEM ***/
/*********************************************************/ /*********************************************************/
int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : getLevel(); } int32 GetQuestLevel(Quest const* quest) const { return quest && (quest->GetQuestLevel() > 0) ? quest->GetQuestLevel() : GetLevel(); }
void PrepareQuestMenu(ObjectGuid guid); void PrepareQuestMenu(ObjectGuid guid);
void SendPreparedQuest(ObjectGuid guid); void SendPreparedQuest(ObjectGuid guid);
@@ -89,7 +89,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
} }
case GOSSIP_OPTION_LEARNDUALSPEC: case GOSSIP_OPTION_LEARNDUALSPEC:
case GOSSIP_OPTION_DUALSPEC_INFO: case GOSSIP_OPTION_DUALSPEC_INFO:
if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(GetLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
canTalk = false; canTalk = false;
break; break;
case GOSSIP_OPTION_UNLEARNTALENTS: case GOSSIP_OPTION_UNLEARNTALENTS:
@@ -332,7 +332,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
GetSession()->SendTrainerList(guid); GetSession()->SendTrainerList(guid);
break; break;
case GOSSIP_OPTION_LEARNDUALSPEC: case GOSSIP_OPTION_LEARNDUALSPEC:
if (GetSpecsCount() == 1 && getLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL)) if (GetSpecsCount() == 1 && GetLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
{ {
// Cast spells that teach dual spec // Cast spells that teach dual spec
// Both are also ImplicitTarget self and must be cast by player // Both are also ImplicitTarget self and must be cast by player
+11 -11
View File
@@ -241,7 +241,7 @@ bool Player::CanSeeStartQuest(Quest const* quest)
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) && SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false)) SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
{ {
return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel(); return GetLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
} }
return false; return false;
@@ -735,7 +735,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest(); bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
// Not give XP in case already completed once repeatable quest // Not give XP in case already completed once repeatable quest
uint32 XP = rewarded ? 0 : uint32(quest->XPValue(getLevel()) * GetQuestRate(quest->IsDFQuest())); uint32 XP = rewarded ? 0 : uint32(quest->XPValue(GetLevel()) * GetQuestRate(quest->IsDFQuest()));
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras // handle SPELL_AURA_MOD_XP_QUEST_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT); Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
@@ -744,7 +744,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
sScriptMgr->OnQuestComputeXP(this, quest, XP); sScriptMgr->OnQuestComputeXP(this, quest, XP);
int32 moneyRew = 0; int32 moneyRew = 0;
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this)) if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this))
{ {
moneyRew = quest->GetRewMoneyMaxLevel(); moneyRew = quest->GetRewMoneyMaxLevel();
} }
@@ -754,7 +754,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
} }
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(getLevel())) if (int32 rewOrReqMoney = quest->GetRewOrReqMoney(GetLevel()))
{ {
moneyRew += rewOrReqMoney; moneyRew += rewOrReqMoney;
} }
@@ -768,7 +768,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
} }
// honor reward // honor reward
if (uint32 honor = quest->CalculateHonorGain(getLevel())) if (uint32 honor = quest->CalculateHonorGain(GetLevel()))
RewardHonor(nullptr, 0, honor); RewardHonor(nullptr, 0, honor);
// title reward // title reward
@@ -957,13 +957,13 @@ bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const
bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) const bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) const
{ {
if (getLevel() < qInfo->GetMinLevel()) if (GetLevel() < qInfo->GetMinLevel())
{ {
if (msg) if (msg)
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL); SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL);
return false; return false;
} }
else if (qInfo->GetMaxLevel() > 0 && getLevel() > qInfo->GetMaxLevel()) else if (qInfo->GetMaxLevel() > 0 && GetLevel() > qInfo->GetMaxLevel())
{ {
if (msg) if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
@@ -1656,7 +1656,7 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
{ {
if (SatisfyQuestLevel(quest, false)) if (SatisfyQuestLevel(quest, false))
{ {
bool isNotLowLevelQuest = getLevel() <= (GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)); bool isNotLowLevelQuest = GetLevel() <= (GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF));
if (quest->IsRepeatable()) if (quest->IsRepeatable())
{ {
@@ -2339,15 +2339,15 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP)
WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4 + 4 + 4 + 4 + 4)); WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4 + 4 + 4 + 4 + 4));
data << uint32(questid); data << uint32(questid);
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
data << uint32(XP); data << uint32(XP);
data << uint32(quest->GetRewOrReqMoney(getLevel())); data << uint32(quest->GetRewOrReqMoney(GetLevel()));
} }
else else
{ {
data << uint32(0); data << uint32(0);
data << uint32(quest->GetRewOrReqMoney(getLevel()) + quest->GetRewMoneyMaxLevel()); data << uint32(quest->GetRewOrReqMoney(GetLevel()) + quest->GetRewMoneyMaxLevel());
} }
data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest))); data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
@@ -1890,7 +1890,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
ScalingStatDistributionEntry const* ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0; ScalingStatDistributionEntry const* ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0;
// check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items) // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel()) if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < GetLevel())
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
uint8 eslot = FindEquipSlot(pProto, slot, swap); uint8 eslot = FindEquipSlot(pProto, slot, swap);
@@ -2342,7 +2342,7 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY; return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
} }
if (getLevel() < proto->RequiredLevel) if (GetLevel() < proto->RequiredLevel)
{ {
return EQUIP_ERR_CANT_EQUIP_LEVEL_I; return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
} }
@@ -4348,7 +4348,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
if (!ignore_condition && pEnchant->EnchantmentCondition && !EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1)) if (!ignore_condition && pEnchant->EnchantmentCondition && !EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
return; return;
if (pEnchant->requiredLevel > getLevel()) if (pEnchant->requiredLevel > GetLevel())
return; return;
if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill)) if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
@@ -6737,9 +6737,9 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
if (!sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_LEVEL)) if (!sWorld->getBoolConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
{ {
if (ar->levelMin && getLevel() < ar->levelMin) if (ar->levelMin && GetLevel() < ar->levelMin)
LevelMin = ar->levelMin; LevelMin = ar->levelMin;
if (ar->levelMax && getLevel() > ar->levelMax) if (ar->levelMax && GetLevel() > ar->levelMax)
LevelMax = ar->levelMax; LevelMax = ar->levelMax;
} }
@@ -7758,7 +7758,7 @@ void Player::_SaveSpells(CharacterDatabaseTransaction trans)
void Player::_SaveStats(CharacterDatabaseTransaction trans) void Player::_SaveStats(CharacterDatabaseTransaction trans)
{ {
// check if stat saving is enabled and if char level is high enough // check if stat saving is enabled and if char level is high enough
if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE)) if (!sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE) || GetLevel() < sWorld->getIntConfig(CONFIG_MIN_LEVEL_STAT_SAVE))
return; return;
CharacterDatabasePreparedStatement* stmt = nullptr; CharacterDatabasePreparedStatement* stmt = nullptr;
@@ -980,7 +980,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item /*= nullptr*/) void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence, Item* item /*= nullptr*/)
{ {
uint8 playerLevel = getLevel(); uint8 playerLevel = GetLevel();
uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType); uint16 currentSkillValue = defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType);
uint16 currentSkillMax = 5 * playerLevel; uint16 currentSkillMax = 5 * playerLevel;
int32 skillDiff = currentSkillMax - currentSkillValue; int32 skillDiff = currentSkillMax - currentSkillValue;
@@ -993,7 +993,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
} }
uint8 greylevel = Acore::XP::GetGrayLevel(playerLevel); uint8 greylevel = Acore::XP::GetGrayLevel(playerLevel);
uint8 moblevel = defence ? victim->getLevelForTarget(this) : victim->getLevel(); // if defense than victim == attacker uint8 moblevel = defence ? victim->getLevelForTarget(this) : victim->GetLevel(); // if defense than victim == attacker
/*if (moblevel < greylevel) /*if (moblevel < greylevel)
return;*/ return;*/
// Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage. // Patch 3.0.8 (2009-01-20): You can no longer skill up weapons on mobs that are immune to damage.
@@ -242,7 +242,7 @@ void SocialMgr::GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo&
if (pFriend->isDND()) if (pFriend->isDND())
friendInfo.Status = FRIEND_STATUS_DND; friendInfo.Status = FRIEND_STATUS_DND;
friendInfo.Area = pFriend->GetZoneId(); friendInfo.Area = pFriend->GetZoneId();
friendInfo.Level = pFriend->getLevel(); friendInfo.Level = pFriend->GetLevel();
friendInfo.Class = pFriend->getClass(); friendInfo.Class = pFriend->getClass();
} }
} }
+1 -1
View File
@@ -64,7 +64,7 @@ void Totem::InitStats(uint32 duration)
SetDisplayId(owner->GetModelForTotem(PlayerTotemType(m_Properties->Id))); SetDisplayId(owner->GetModelForTotem(PlayerTotemType(m_Properties->Id)));
} }
SetLevel(owner->getLevel()); SetLevel(owner->GetLevel());
} }
Minion::InitStats(duration); Minion::InitStats(duration);
+5 -5
View File
@@ -330,7 +330,7 @@ void Player::ApplyFeralAPBonus(int32 amount, bool apply)
void Player::UpdateAttackPowerAndDamage(bool ranged) void Player::UpdateAttackPowerAndDamage(bool ranged)
{ {
float val2 = 0.0f; float val2 = 0.0f;
float level = float(getLevel()); float level = float(GetLevel());
sScriptMgr->OnBeforeUpdateAttackPowerAndDamage(this, level, val2, ranged); sScriptMgr->OnBeforeUpdateAttackPowerAndDamage(this, level, val2, ranged);
@@ -454,14 +454,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
switch (GetShapeshiftForm()) switch (GetShapeshiftForm())
{ {
case FORM_CAT: case FORM_CAT:
val2 = (getLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f + weapon_bonus + m_baseFeralAP; val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f + weapon_bonus + m_baseFeralAP;
break; break;
case FORM_BEAR: case FORM_BEAR:
case FORM_DIREBEAR: case FORM_DIREBEAR:
val2 = (getLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + weapon_bonus + m_baseFeralAP; val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + weapon_bonus + m_baseFeralAP;
break; break;
case FORM_MOONKIN: case FORM_MOONKIN:
val2 = (getLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP; val2 = (GetLevel() * mLevelMult) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f + m_baseFeralAP;
break; break;
default: default:
val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f; val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
@@ -576,7 +576,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
if (IsInFeralForm()) // check if player is druid and in cat or bear forms if (IsInFeralForm()) // check if player is druid and in cat or bear forms
{ {
uint8 lvl = getLevel(); uint8 lvl = GetLevel();
if (lvl > 60) if (lvl > 60)
lvl = 60; lvl = 60;
+18 -18
View File
@@ -1707,7 +1707,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->HitInfo |= HITINFO_GLANCING; damageInfo->HitInfo |= HITINFO_GLANCING;
damageInfo->TargetState = VICTIMSTATE_HIT; damageInfo->TargetState = VICTIMSTATE_HIT;
damageInfo->procEx |= PROC_EX_NORMAL_HIT; damageInfo->procEx |= PROC_EX_NORMAL_HIT;
int32 leveldif = int32(victim->getLevel()) - int32(getLevel()); int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
if (leveldif > 3) if (leveldif > 3)
leveldif = 3; leveldif = 3;
float reducePercent = 1 - leveldif * 0.1f; float reducePercent = 1 - leveldif * 0.1f;
@@ -1880,8 +1880,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
float Probability = 20.0f; float Probability = 20.0f;
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (victim->getLevel() < 30) if (victim->GetLevel() < 30)
Probability = 0.65f * victim->getLevel() + 0.5f; Probability = 0.65f * victim->GetLevel() + 0.5f;
uint32 VictimDefense = victim->GetDefenseSkillValue(); uint32 VictimDefense = victim->GetDefenseSkillValue();
uint32 AttackerMeleeSkill = GetUnitMeleeSkill(); uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
@@ -2036,10 +2036,10 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co
} }
float maxArmorPen = 0; float maxArmorPen = 0;
if (victim->getLevel() < 60) if (victim->GetLevel() < 60)
maxArmorPen = float(400 + 85 * victim->getLevel()); maxArmorPen = float(400 + 85 * victim->GetLevel());
else else
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59); maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
// Cap armor penetration to this number // Cap armor penetration to this number
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor); maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
@@ -2053,7 +2053,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co
if (armor < 0.0f) if (armor < 0.0f)
armor = 0.0f; armor = 0.0f;
float levelModifier = attacker ? attacker->getLevel() : attackerLevel; float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
if (levelModifier > 59) if (levelModifier > 59)
levelModifier = levelModifier + (4.5f * (levelModifier - 59)); levelModifier = levelModifier + (4.5f * (levelModifier - 59));
@@ -2087,11 +2087,11 @@ float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMa
victimResistance = std::max(victimResistance, 0.0f); victimResistance = std::max(victimResistance, 0.0f);
if (owner) if (owner)
victimResistance += std::max((float(victim->getLevel()) - float(owner->getLevel())) * 5.0f, 0.0f); victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
static uint32 const BOSS_LEVEL = 83; static uint32 const BOSS_LEVEL = 83;
static float const BOSS_RESISTANCE_CONSTANT = 510.0f; static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
uint32 level = victim->getLevel(); uint32 level = victim->GetLevel();
float resistanceConstant = 0.0f; float resistanceConstant = 0.0f;
if (level == BOSS_LEVEL) if (level == BOSS_LEVEL)
@@ -2872,7 +2872,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
if (attType != RANGED_ATTACK && if (attType != RANGED_ATTACK &&
(GetTypeId() == TYPEID_PLAYER || IsPet()) && (GetTypeId() == TYPEID_PLAYER || IsPet()) &&
victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() && victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() &&
getLevel() < victim->getLevelForTarget(this)) GetLevel() < victim->getLevelForTarget(this))
{ {
// cap possible value (with bonuses > max skill) // cap possible value (with bonuses > max skill)
int32 skill = attackerWeaponSkill; int32 skill = attackerWeaponSkill;
@@ -3001,7 +3001,7 @@ float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const
if (spellProto->SpellLevel < 20) if (spellProto->SpellLevel < 20)
LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f; LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(getLevel()); float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
if (LvlFactor > 1.0f) if (LvlFactor > 1.0f)
LvlFactor = 1.0f; LvlFactor = 1.0f;
@@ -3110,7 +3110,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
int32 attackerWeaponSkill; int32 attackerWeaponSkill;
// skill value for these spells (for example judgements) is 5* level // skill value for these spells (for example judgements) is 5* level
if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell()) if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
attackerWeaponSkill = getLevel() * 5; attackerWeaponSkill = GetLevel() * 5;
// bonus from skills is 0.04% per skill Diff // bonus from skills is 0.04% per skill Diff
else else
attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim)); attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
@@ -11436,7 +11436,7 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
{ {
// Glyph of Ice Lance // Glyph of Ice Lance
if (owner->HasAura(56377) && victim->getLevel() > owner->getLevel()) if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
DoneTotalMod *= 4.0f; DoneTotalMod *= 4.0f;
else else
DoneTotalMod *= 3.0f; DoneTotalMod *= 3.0f;
@@ -17456,7 +17456,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id)
return nullptr; return nullptr;
} }
uint8 level = creatureTarget->getLevel() + 5 < getLevel() ? (getLevel() - 5) : creatureTarget->getLevel(); uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
if (!InitTamedPet(pet, level, spell_id)) if (!InitTamedPet(pet, level, spell_id))
{ {
@@ -17478,7 +17478,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
Pet* pet = new Pet(ToPlayer(), HUNTER_PET); 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; delete pet;
return nullptr; return nullptr;
@@ -20208,11 +20208,11 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
{ {
float addRage; float addRage;
float rageconversion = ((0.0091107836f * getLevel() * getLevel()) + 3.225598133f * getLevel()) + 4.2652911f; float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
// Unknown if correct, but lineary adjust rage conversion above level 70 // Unknown if correct, but lineary adjust rage conversion above level 70
if (getLevel() > 70) if (GetLevel() > 70)
rageconversion += 13.27f * (getLevel() - 70); rageconversion += 13.27f * (GetLevel() - 70);
if (attacker) if (attacker)
{ {
+5 -3
View File
@@ -1415,8 +1415,10 @@ public:
[[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; } [[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; }
[[nodiscard]] bool IsVehicle() const { return m_unitTypeMask & UNIT_MASK_VEHICLE; } [[nodiscard]] bool IsVehicle() const { return m_unitTypeMask & UNIT_MASK_VEHICLE; }
/// @deprecated Use GetLevel() instead!
[[nodiscard]] uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); } [[nodiscard]] uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return getLevel(); } [[nodiscard]] uint8 GetLevel() const { return getLevel(); }
uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); }
void SetLevel(uint8 lvl, bool showLevelChange = true); void SetLevel(uint8 lvl, bool showLevelChange = true);
[[nodiscard]] uint8 getRace(bool original = false) const; [[nodiscard]] uint8 getRace(bool original = false) const;
void setRace(uint8 race); void setRace(uint8 race);
@@ -1542,7 +1544,7 @@ public:
void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0); void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0);
void Dismount(); void Dismount();
uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb); static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb);
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr); static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr);
static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr); static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr);
@@ -1630,7 +1632,7 @@ public:
return value; return value;
} }
uint32 GetUnitMeleeSkill(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } uint32 GetUnitMeleeSkill(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
uint32 GetDefenseSkillValue(Unit const* target = nullptr) const; uint32 GetDefenseSkillValue(Unit const* target = nullptr) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = nullptr) const; uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = nullptr) const;
[[nodiscard]] float GetWeaponProcChance() const; [[nodiscard]] float GetWeaponProcChance() const;
+2 -1
View File
@@ -6198,6 +6198,7 @@ void ObjectMgr::LoadQuestGreetings()
LOG_INFO("server.loading", " "); LOG_INFO("server.loading", " ");
} }
/// @bug Does not load Locale greetings. See https://github.com/azerothcore/azerothcore-wotlk/issues/10913
void ObjectMgr::LoadQuestGreetingsLocales() void ObjectMgr::LoadQuestGreetingsLocales()
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
@@ -9872,7 +9873,7 @@ void ObjectMgr::SendServerMail(Player* player, uint32 id, uint32 reqLevel, uint3
{ {
if (active) if (active)
{ {
if (player->getLevel() < reqLevel) if (player->GetLevel() < reqLevel)
return; return;
if (player->GetTotalPlayedTime() < reqPlayTime) if (player->GetTotalPlayedTime() < reqPlayTime)
+3 -3
View File
@@ -283,7 +283,7 @@ bool Group::CheckLevelForRaid()
{ {
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
if (Player* player = ObjectAccessor::FindPlayer(citr->guid)) if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
if (player->getLevel() < sConfigMgr->GetOption<int32>("Group.Raid.LevelRestriction", 10)) if (player->GetLevel() < sConfigMgr->GetOption<int32>("Group.Raid.LevelRestriction", 10))
return true; return true;
return false; return false;
@@ -1915,7 +1915,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
if (!reference) if (!reference)
return ERR_BATTLEGROUND_JOIN_FAILED; return ERR_BATTLEGROUND_JOIN_FAILED;
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), reference->getLevel()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), reference->GetLevel());
if (!bracketEntry) if (!bracketEntry)
return ERR_BATTLEGROUND_JOIN_FAILED; return ERR_BATTLEGROUND_JOIN_FAILED;
@@ -1946,7 +1946,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
return ERR_BATTLEGROUND_JOIN_FAILED; return ERR_BATTLEGROUND_JOIN_FAILED;
// not in the same battleground level braket, don't let join // not in the same battleground level braket, don't let join
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->getLevel()); PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->GetLevel());
if (memberBracketEntry != bracketEntry) if (memberBracketEntry != bracketEntry)
return ERR_BATTLEGROUND_JOIN_RANGE_INDEX; return ERR_BATTLEGROUND_JOIN_RANGE_INDEX;
+3 -3
View File
@@ -523,7 +523,7 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const
void Guild::Member::SetStats(Player* player) void Guild::Member::SetStats(Player* player)
{ {
m_name = player->GetName(); m_name = player->GetName();
m_level = player->getLevel(); m_level = player->GetLevel();
m_class = player->getClass(); m_class = player->getClass();
m_gender = player->getGender(); m_gender = player->getGender();
m_zoneId = player->GetZoneId(); m_zoneId = player->GetZoneId();
@@ -1672,7 +1672,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
if (amount > 10 * GOLD) // receiver_acc = Guild id, receiver_name = Guild name if (amount > 10 * GOLD) // receiver_acc = Guild id, receiver_name = Guild name
CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"(guild members: {}, new amount: {}, leader guid low: {}, sender level: {})\", NOW(), {})", CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"(guild members: {}, new amount: {}, leader guid low: {}, sender level: {})\", NOW(), {})",
session->GetAccountId(), player->GetGUID().GetCounter(), player->GetName(), session->GetRemoteAddress(), GetId(), GetName(), amount, GetMemberCount(), GetTotalBankMoney(), GetLeaderGUID().GetCounter(), player->getLevel(), 3); session->GetAccountId(), player->GetGUID().GetCounter(), player->GetName(), session->GetRemoteAddress(), GetId(), GetName(), amount, GetMemberCount(), GetTotalBankMoney(), GetLeaderGUID().GetCounter(), player->GetLevel(), 3);
} }
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair) bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
@@ -1716,7 +1716,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool
if (amount > 10 * GOLD) // sender_acc = 0 (guild has no account), sender_guid = Guild id, sender_name = Guild name if (amount > 10 * GOLD) // sender_acc = 0 (guild has no account), sender_guid = Guild id, sender_name = Guild name
CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"(guild, members: {}, new amount: {}, leader guid low: {}, withdrawer level: {})\", NOW(), {})", CharacterDatabase.Execute("INSERT INTO log_money VALUES({}, {}, \"{}\", \"{}\", {}, \"{}\", {}, \"(guild, members: {}, new amount: {}, leader guid low: {}, withdrawer level: {})\", NOW(), {})",
0, GetId(), GetName(), session->GetRemoteAddress(), session->GetAccountId(), player->GetName(), amount, GetMemberCount(), GetTotalBankMoney(), GetLeaderGUID().GetCounter(), player->getLevel(), 4); 0, GetId(), GetName(), session->GetRemoteAddress(), session->GetAccountId(), player->GetName(), amount, GetMemberCount(), GetTotalBankMoney(), GetLeaderGUID().GetCounter(), player->GetLevel(), 4);
std::string aux = Acore::Impl::ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); std::string aux = Acore::Impl::ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true);
_BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str()); _BroadcastEvent(GE_BANK_MONEY_SET, ObjectGuid::Empty, aux.c_str());
@@ -97,7 +97,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
return; return;
} }
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (player->GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", invitedName, ERR_ARENA_TEAM_TARGET_TOO_LOW_S); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", invitedName, ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return; return;
@@ -53,7 +53,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
//this void causes that auction window is opened //this void causes that auction window is opened
void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit) void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
{ {
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ)) if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_AUCTION_REQ), sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_AUCTION_REQ), sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ));
return; return;
@@ -122,7 +122,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
return; return;
// expected bracket entry // expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel());
if (!bracketEntry) if (!bracketEntry)
return; return;
@@ -464,7 +464,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
GetPlayerInfo(), arenaType, unk2, bgTypeId_, action); GetPlayerInfo(), arenaType, unk2, bgTypeId_, action);
// expected bracket entry // expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel());
if (!bracketEntry) if (!bracketEntry)
return; return;
@@ -481,10 +481,10 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
LOG_DEBUG("bg.battleground", "Player {} {} has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUID().ToString()); LOG_DEBUG("bg.battleground", "Player {} {} has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUID().ToString());
} }
if (_player->getLevel() > bg->GetMaxLevel()) if (_player->GetLevel() > bg->GetMaxLevel())
{ {
LOG_ERROR("network", "Player {} {} has level ({}) higher than maxlevel ({}) of battleground ({})! Do not port him to battleground!", LOG_ERROR("network", "Player {} {} has level ({}) higher than maxlevel ({}) of battleground ({})! Do not port him to battleground!",
_player->GetName(), _player->GetGUID().ToString(), _player->getLevel(), bg->GetMaxLevel(), bg->GetBgTypeID()); _player->GetName(), _player->GetGUID().ToString(), _player->GetLevel(), bg->GetMaxLevel(), bg->GetBgTypeID());
action = 0; action = 0;
} }
} }
@@ -650,7 +650,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recvData*/)
continue; continue;
// expected bracket entry // expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->getLevel()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->GetLevel());
if (!bracketEntry) if (!bracketEntry)
continue; continue;
@@ -726,7 +726,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
BattlegroundTypeId bgTypeId = bgt->GetBgTypeID(); BattlegroundTypeId bgTypeId = bgt->GetBgTypeID();
// expected bracket entry // expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->getLevel()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->GetLevel());
if (!bracketEntry) if (!bracketEntry)
return; return;
@@ -581,7 +581,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
{ {
LOG_INFO("entities.player.character", "Account: {} (IP: {}) Create Character: {} {}", GetAccountId(), GetRemoteAddress(), newChar->GetName(), newChar->GetGUID().ToString()); LOG_INFO("entities.player.character", "Account: {} (IP: {}) Create Character: {} {}", GetAccountId(), GetRemoteAddress(), newChar->GetName(), newChar->GetGUID().ToString());
sScriptMgr->OnPlayerCreate(newChar.get()); sScriptMgr->OnPlayerCreate(newChar.get());
sCharacterCache->AddCharacterCacheEntry(newChar->GetGUID(), GetAccountId(), newChar->GetName(), newChar->getGender(), newChar->getRace(), newChar->getClass(), newChar->getLevel()); sCharacterCache->AddCharacterCacheEntry(newChar->GetGUID(), GetAccountId(), newChar->GetName(), newChar->getGender(), newChar->getRace(), newChar->getClass(), newChar->GetLevel());
SendCharCreate(CHAR_CREATE_SUCCESS); SendCharCreate(CHAR_CREATE_SUCCESS);
} }
else else
@@ -1045,7 +1045,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
std::string IP_str = GetRemoteAddress(); std::string IP_str = GetRemoteAddress();
LOG_INFO("entities.player", "Account: {} (IP: {}) Login Character:[{}] ({}) Level: {}", LOG_INFO("entities.player", "Account: {} (IP: {}) Login Character:[{}] ({}) Level: {}",
GetAccountId(), IP_str, pCurrChar->GetName(), pCurrChar->GetGUID().ToString(), pCurrChar->getLevel()); GetAccountId(), IP_str, pCurrChar->GetName(), pCurrChar->GetGUID().ToString(), pCurrChar->GetLevel());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
+3 -3
View File
@@ -351,7 +351,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (!sender->IsAlive()) if (!sender->IsAlive())
return; return;
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ)) if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_SAY_REQ), sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_SAY_REQ), sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
return; return;
@@ -367,7 +367,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
break; break;
case CHAT_MSG_WHISPER: case CHAT_MSG_WHISPER:
{ {
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ)) if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
return; return;
@@ -579,7 +579,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
{ {
if (AccountMgr::IsPlayerAccount(GetSecurity())) if (AccountMgr::IsPlayerAccount(GetSecurity()))
{ {
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) if (sender->GetLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
return; return;
+3 -3
View File
@@ -124,7 +124,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
return; return;
} }
if (!player->GetSocial()->HasFriend(GetPlayer()->GetGUID()) && GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_PARTY_LEVEL_REQ)) if (!player->GetSocial()->HasFriend(GetPlayer()->GetGUID()) && GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_PARTY_LEVEL_REQ))
{ {
SendPartyResult(PARTY_OP_INVITE, player->GetName(), ERR_INVITE_RESTRICTED); SendPartyResult(PARTY_OP_INVITE, player->GetName(), ERR_INVITE_RESTRICTED);
return; return;
@@ -853,7 +853,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
*data << uint16(player->GetMaxPower(powerType)); *data << uint16(player->GetMaxPower(powerType));
if (mask & GROUP_UPDATE_FLAG_LEVEL) if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << uint16(player->getLevel()); *data << uint16(player->GetLevel());
if (mask & GROUP_UPDATE_FLAG_ZONE) if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << uint16(player->GetZoneId()); *data << uint16(player->GetZoneId());
@@ -1044,7 +1044,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL data << uint16(player->GetLevel()); // GROUP_UPDATE_FLAG_LEVEL
data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE
data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION
+5 -5
View File
@@ -152,7 +152,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
LOG_DEBUG("network", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [{}]", guid.ToString()); LOG_DEBUG("network", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [{}]", guid.ToString());
// Get Random dungeons that can be done at a certain level and expansion // Get Random dungeons that can be done at a certain level and expansion
uint8 level = GetPlayer()->getLevel(); uint8 level = GetPlayer()->GetLevel();
lfg::LfgDungeonSet const& randomDungeons = lfg::LfgDungeonSet const& randomDungeons =
sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion()); sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion());
@@ -185,7 +185,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
if (quest) if (quest)
{ {
uint8 playerLevel = GetPlayer() ? GetPlayer()->getLevel() : 0; uint8 playerLevel = GetPlayer() ? GetPlayer()->GetLevel() : 0;
data << uint8(done); data << uint8(done);
data << uint32(quest->GetRewOrReqMoney(playerLevel)); data << uint32(quest->GetRewOrReqMoney(playerLevel));
data << uint32(quest->XPValue(playerLevel)); data << uint32(quest->XPValue(playerLevel));
@@ -410,7 +410,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
data << uint8(roles > 0); // Ready data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles data << uint32(roles); // Roles
Player* player = ObjectAccessor::FindConnectedPlayer(guid); Player* player = ObjectAccessor::FindConnectedPlayer(guid);
data << uint8(player ? player->getLevel() : 0); // Level data << uint8(player ? player->GetLevel() : 0); // Level
for (lfg::LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) for (lfg::LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{ {
@@ -423,7 +423,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
data << uint8(roles > 0); // Ready data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles data << uint32(roles); // Roles
player = ObjectAccessor::FindConnectedPlayer(guid); player = ObjectAccessor::FindConnectedPlayer(guid);
data << uint8(player ? player->getLevel() : 0);// Level data << uint8(player ? player->GetLevel() : 0);// Level
} }
} }
SendPacket(&data); SendPacket(&data);
@@ -473,7 +473,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat
uint8 itemNum = rewardData.quest->GetRewItemsCount(); uint8 itemNum = rewardData.quest->GetRewItemsCount();
uint8 playerLevel = GetPlayer() ? GetPlayer()->getLevel() : 0; uint8 playerLevel = GetPlayer() ? GetPlayer()->GetLevel() : 0;
WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4)); WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4));
data << uint32(rewardData.rdungeonEntry); // Random Dungeon Finished data << uint32(rewardData.rdungeonEntry); // Random Dungeon Finished
+1 -1
View File
@@ -115,7 +115,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
Player* player = _player; Player* player = _player;
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ)) if (player->GetLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
return; return;
@@ -92,7 +92,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
else else
{ {
// TODO: find correct opcode // TODO: find correct opcode
if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (_player->GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return; return;
@@ -426,7 +426,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
if (type != GUILD_CHARTER_TYPE) if (type != GUILD_CHARTER_TYPE)
{ {
if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (_player->GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName().c_str(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName().c_str(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return; return;
@@ -576,7 +576,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
if (petition->petitionType != GUILD_CHARTER_TYPE) if (petition->petitionType != GUILD_CHARTER_TYPE)
{ {
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (player->GetLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
// player is too low level to join an arena team // player is too low level to join an arena team
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
@@ -40,9 +40,9 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
error = ERR_REFER_A_FRIEND_NOT_REFERRED_BY; error = ERR_REFER_A_FRIEND_NOT_REFERRED_BY;
else if (target->GetTeamId() != _player->GetTeamId()) else if (target->GetTeamId() != _player->GetTeamId())
error = ERR_REFER_A_FRIEND_DIFFERENT_FACTION; error = ERR_REFER_A_FRIEND_DIFFERENT_FACTION;
else if (target->getLevel() >= _player->getLevel()) else if (target->GetLevel() >= _player->GetLevel())
error = ERR_REFER_A_FRIEND_TARGET_TOO_HIGH; error = ERR_REFER_A_FRIEND_TARGET_TOO_HIGH;
else if (target->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) else if (target->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
error = ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I; error = ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I;
else if (target->GetGroup() != _player->GetGroup()) else if (target->GetGroup() != _player->GetGroup())
error = ERR_REFER_A_FRIEND_NOT_IN_GROUP; error = ERR_REFER_A_FRIEND_NOT_IN_GROUP;
@@ -82,5 +82,5 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
else else
return; return;
_player->GiveLevel(_player->getLevel() + 1); _player->GiveLevel(_player->GetLevel() + 1);
} }
+1 -1
View File
@@ -458,7 +458,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// auto-selection buff level base at target level (in spellInfo) // auto-selection buff level base at target level (in spellInfo)
if (targets.GetUnitTarget()) if (targets.GetUnitTarget())
{ {
SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel()); SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->GetLevel());
// if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message
if (actualSpellInfo) if (actualSpellInfo)
+1 -1
View File
@@ -33,7 +33,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED) if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
return; return;
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ)) if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_TICKET_REQ), sWorld->getIntConfig(CONFIG_TICKET_LEVEL_REQ));
return; return;
+2 -2
View File
@@ -570,7 +570,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return; return;
} }
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ)) if (GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_TRADE_REQ), sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_TRADE_REQ), sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
return; return;
@@ -635,7 +635,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return; return;
} }
if (pOther->getLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ)) if (pOther->GetLevel() < sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ))
{ {
SendNotification(GetAcoreString(LANG_TRADE_OTHER_REQ), sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ)); SendNotification(GetAcoreString(LANG_TRADE_OTHER_REQ), sWorld->getIntConfig(CONFIG_TRADE_LEVEL_REQ));
return; return;
+1 -1
View File
@@ -78,7 +78,7 @@ uint32 Acore::XP::Gain(Player* player, Unit* unit, bool isBattleGround /*= false
{ {
float xpMod = 1.0f; float xpMod = 1.0f;
gain = BaseGain(player->getLevel(), unit->getLevel(), GetContentLevelsForMapAndZone(unit->GetMapId(), unit->GetZoneId())); gain = BaseGain(player->GetLevel(), unit->GetLevel(), GetContentLevelsForMapAndZone(unit->GetMapId(), unit->GetZoneId()));
if (gain && creature) if (gain && creature)
{ {
+1 -1
View File
@@ -686,7 +686,7 @@ void WorldSession::LogoutPlayer(bool save)
METRIC_EVENT("player_events", "Logout", _player->GetName()); METRIC_EVENT("player_events", "Logout", _player->GetName());
LOG_INFO("entities.player", "Account: {} (IP: {}) Logout Character:[{}] ({}) Level: {}", LOG_INFO("entities.player", "Account: {} (IP: {}) Logout Character:[{}] ({}) Level: {}",
GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().ToString(), _player->getLevel()); GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().ToString(), _player->GetLevel());
//! Remove the player from the world //! Remove the player from the world
// the player may not be in the world when logging out // the player may not be in the world when logging out
@@ -390,7 +390,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* cast
CalculatePeriodicData(); CalculatePeriodicData();
m_amount = CalculateAmount(caster); m_amount = CalculateAmount(caster);
m_casterLevel = caster ? caster->getLevel() : 0; m_casterLevel = caster ? caster->GetLevel() : 0;
m_applyResilience = caster && caster->CanApplyResilience(); m_applyResilience = caster && caster->CanApplyResilience();
m_auraGroup = sSpellMgr->GetSpellGroup(GetId()); m_auraGroup = sSpellMgr->GetSpellGroup(GetId());
+3 -3
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_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_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_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) 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)) 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; m_timeCla -= diff;
else if (caster) 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; m_timeCla += 1000 - diff;
@@ -1531,7 +1531,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_SHAMAN: case SPELLFAMILY_SHAMAN:
{ {
// Ghost Wolf Speed (PvP 58 lvl set) // 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; int32 bp0 = 15;
target->CastCustomSpell(target, 47017, &bp0, 0, 0, true); target->CastCustomSpell(target, 47017, &bp0, 0, 0, true);
+9 -9
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) if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target)
{ {
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell(); SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
ihit->scaleAura = true; 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) if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target)
{ {
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell(); SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) if (uint32(target->GetLevel() + 10) >= auraSpell->SpellLevel)
targetInfo.scaleAura = true; targetInfo.scaleAura = true;
} }
@@ -3105,7 +3105,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
int32 basePoints[3]; int32 basePoints[3];
if (scaleAura) if (scaleAura)
{ {
aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel()); aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->GetLevel());
ASSERT(aurSpellInfo); ASSERT(aurSpellInfo);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{ {
@@ -6097,7 +6097,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!learn_spellproto) if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN; return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel()) if (m_spellInfo->SpellLevel > pet->GetLevel())
return SPELL_FAILED_LOWLEVEL; return SPELL_FAILED_LOWLEVEL;
break; break;
@@ -6119,7 +6119,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!learn_spellproto) if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN; return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel()) if (m_spellInfo->SpellLevel > pet->GetLevel())
return SPELL_FAILED_LOWLEVEL; return SPELL_FAILED_LOWLEVEL;
} }
break; break;
@@ -6240,7 +6240,7 @@ SpellCastResult Spell::CheckCast(bool strict)
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill(); uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill); 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); int32 ReqValue = (skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5);
if (ReqValue > skillValue) if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL; return SPELL_FAILED_LOW_CASTLEVEL;
@@ -6619,7 +6619,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_CANT_BE_CHARMED; return SPELL_FAILED_CANT_BE_CHARMED;
int32 damage = CalculateSpellDamage(i, target); int32 damage = CalculateSpellDamage(i, target);
if (damage && int32(target->getLevel()) > damage) if (damage && int32(target->GetLevel()) > damage)
return SPELL_FAILED_HIGHLEVEL; return SPELL_FAILED_HIGHLEVEL;
} }
@@ -7886,7 +7886,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
if (target->GetCharmerGUID()) if (target->GetCharmerGUID())
return false; return false;
if (int32 damage = CalculateSpellDamage(eff, target)) if (int32 damage = CalculateSpellDamage(eff, target))
if ((int32)target->getLevel() > damage) if ((int32)target->GetLevel() > damage)
return false; return false;
break; break;
default: default:
@@ -7958,7 +7958,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
return false; return false;
if (m_caster->ToPlayer()->GetSession()->GetRecruiterId() != target->ToPlayer()->GetSession()->GetAccountId() && target->ToPlayer()->GetSession()->IsARecruiter()) if (m_caster->ToPlayer()->GetSession()->GetRecruiterId() != target->ToPlayer()->GetSession()->GetAccountId() && target->ToPlayer()->GetSession()->IsARecruiter())
return false; 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; return false;
break; break;
default: // normal case default: // normal case
+15 -15
View File
@@ -352,7 +352,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Shield Slam // Shield Slam
if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->GetCategory() == 1209) 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 // xinef: shield block should increase the limit
float limit = m_caster->HasAura(2565) ? 2.0f : 1.0f; 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)); 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 // Shield of Righteousness
if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000) 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)); uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 34.5f));
if (m_caster->GetAuraEffect(64882, EFFECT_0)) if (m_caster->GetAuraEffect(64882, EFFECT_0))
block_value += 225; block_value += 225;
@@ -1911,15 +1911,15 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
switch (m_spellInfo->Id) switch (m_spellInfo->Id)
{ {
case 9512: // Restore Energy case 9512: // Restore Energy
level_diff = m_caster->getLevel() - 40; level_diff = m_caster->GetLevel() - 40;
level_multiplier = 2; level_multiplier = 2;
break; break;
case 24571: // Blood Fury case 24571: // Blood Fury
level_diff = m_caster->getLevel() - 60; level_diff = m_caster->GetLevel() - 60;
level_multiplier = 10; level_multiplier = 10;
break; break;
case 24532: // Burst of Energy case 24532: // Burst of Energy
level_diff = m_caster->getLevel() - 60; level_diff = m_caster->GetLevel() - 60;
level_multiplier = 4; level_multiplier = 4;
break; break;
case 31930: // Judgements of the Wise 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();) for (std::set<uint32>::iterator itr = availableElixirs.begin(); itr != availableElixirs.end();)
{ {
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*itr); 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++); availableElixirs.erase(itr++);
else else
++itr; ++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 // 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) 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); unitTarget->ToPlayer()->RewardHonor(nullptr, 1, honor_reward, false);
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id {}) rewards {} honor points (scale) to player: {}", LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id {}) rewards {} honor points (scale) to player: {}",
m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUID().ToString()); m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUID().ToString());
@@ -3127,7 +3127,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
// "kill" original creature // "kill" original creature
creatureTarget->DespawnOrUnsummon(); 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 // prepare visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1); 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_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(); int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetSpellId(m_spellInfo->Id);
@@ -4391,7 +4391,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
minLevel = 80; minLevel = 80;
break; break;
} }
if (minLevel && m_caster->getLevel() < minLevel) if (minLevel && m_caster->GetLevel() < minLevel)
{ {
SendCastResult(SPELL_FAILED_GLYPH_SOCKET_LOCKED); SendCastResult(SPELL_FAILED_GLYPH_SOCKET_LOCKED);
return; return;
@@ -4648,7 +4648,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
return; return;
} }
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel());
int32 duration = m_spellInfo->GetDuration(); int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetSpellId(m_spellInfo->Id);
@@ -4922,7 +4922,7 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
return; return;
Creature* creature = unitTarget->ToCreature(); Creature* creature = unitTarget->ToCreature();
int32 targetLevel = creature->getLevel(); int32 targetLevel = creature->GetLevel();
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill(); uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
@@ -5511,7 +5511,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
pGameObj->SetOwnerGUID(m_caster->GetGUID()); pGameObj->SetOwnerGUID(m_caster->GetGUID());
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel());
pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetSpellId(m_spellInfo->Id);
ExecuteLogEffectSummonObject(effIndex, pGameObj); ExecuteLogEffectSummonObject(effIndex, pGameObj);
@@ -6015,7 +6015,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
caster = caster->ToTotem()->GetOwner(); caster = caster->ToTotem()->GetOwner();
// in another case summon new // 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 // level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER) if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER)
@@ -6113,7 +6113,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
summon->SetLevel(summonLevel); summon->SetLevel(summonLevel);
// if summonLevel changed, set stats for calculated level // if summonLevel changed, set stats for calculated level
if (summonLevel != caster->getLevel()) if (summonLevel != caster->GetLevel())
{ {
((Guardian*)summon)->InitStatsForLevel(summonLevel); ((Guardian*)summon)->InitStatsForLevel(summonLevel);
} }
+5 -5
View File
@@ -414,7 +414,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
// xinef: added basePointsPerLevel check // xinef: added basePointsPerLevel check
if (caster && basePointsPerLevel != 0.0f) if (caster && basePointsPerLevel != 0.0f)
{ {
int32 level = int32(caster->getLevel()); int32 level = int32(caster->GetLevel());
if (level > int32(_spellInfo->MaxLevel) && _spellInfo->MaxLevel > 0) if (level > int32(_spellInfo->MaxLevel) && _spellInfo->MaxLevel > 0)
level = int32(_spellInfo->MaxLevel); level = int32(_spellInfo->MaxLevel);
else if (level < int32(_spellInfo->BaseLevel)) 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 // amount multiplication based on caster's level
if (!caster->IsControlledByPlayer() && if (!caster->IsControlledByPlayer() &&
_spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->getLevel() && _spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->GetLevel() &&
!basePointsPerLevel && _spellInfo->HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL)) !basePointsPerLevel && _spellInfo->HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL))
{ {
bool canEffectScale = false; bool canEffectScale = false;
@@ -502,7 +502,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
if (canEffectScale) if (canEffectScale)
{ {
GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(_spellInfo->SpellLevel - 1); 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) if (spellScaler && casterScaler)
value *= casterScaler->ratio / spellScaler->ratio; value *= casterScaler->ratio / spellScaler->ratio;
} }
@@ -549,7 +549,7 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
float radius = RadiusEntry->RadiusMin; float radius = RadiusEntry->RadiusMin;
if (caster) if (caster)
{ {
radius += RadiusEntry->RadiusPerLevel * caster->getLevel(); radius += RadiusEntry->RadiusPerLevel * caster->GetLevel();
radius = std::min(radius, RadiusEntry->RadiusMax); radius = std::min(radius, RadiusEntry->RadiusMax);
if (Player* modOwner = caster->GetSpellModOwner()) if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell); 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)) if (HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL))
{ {
GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(SpellLevel - 1); 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) if (spellScaler && casterScaler)
powerCost *= casterScaler->ratio / spellScaler->ratio; powerCost *= casterScaler->ratio / spellScaler->ratio;
} }
+1 -1
View File
@@ -2675,7 +2675,7 @@ void World::SendGMText(uint32 string_id, ...)
va_end(ap); va_end(ap);
} }
/// DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned) /// @deprecated only for debug purpose. Send a System Message to all players (except self if mentioned)
void World::SendGlobalText(const char* text, WorldSession* self) void World::SendGlobalText(const char* text, WorldSession* self)
{ {
WorldPacket data; WorldPacket data;
+1 -1
View File
@@ -120,7 +120,7 @@ public:
else else
{ {
sCharacterCache->AddCharacterCacheEntry(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId(), cPlayer->GetName(), sCharacterCache->AddCharacterCacheEntry(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId(), cPlayer->GetName(),
cPlayer->getGender(), cPlayer->getRace(), cPlayer->getClass(), cPlayer->getLevel()); cPlayer->getGender(), cPlayer->getRace(), cPlayer->getClass(), cPlayer->GetLevel());
} }
sCharacterCache->UpdateCharacterAccountId(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId()); sCharacterCache->UpdateCharacterAccountId(cPlayer->GetGUID(), cPlayer->GetSession()->GetAccountId());
+2 -2
View File
@@ -437,7 +437,7 @@ public:
if (!player) if (!player)
return false; return false;
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID()); uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
if (newlevel < 1) if (newlevel < 1)
return false; // invalid level return false; // invalid level
@@ -762,7 +762,7 @@ public:
if (!player) if (!player)
return false; return false;
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID()); uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
int16 newlevel = static_cast<int16>(oldlevel) + level; int16 newlevel = static_cast<int16>(oldlevel) + level;
if (newlevel < 1) if (newlevel < 1)
+1 -1
View File
@@ -1966,7 +1966,7 @@ public:
accId = playerTarget->GetSession()->GetAccountId(); accId = playerTarget->GetSession()->GetAccountId();
money = playerTarget->GetMoney(); money = playerTarget->GetMoney();
totalPlayerTime = playerTarget->GetTotalPlayedTime(); totalPlayerTime = playerTarget->GetTotalPlayedTime();
level = playerTarget->getLevel(); level = playerTarget->GetLevel();
latency = playerTarget->GetSession()->GetLatency(); latency = playerTarget->GetSession()->GetLatency();
raceid = playerTarget->getRace(); raceid = playerTarget->getRace();
classid = playerTarget->getClass(); classid = playerTarget->getClass();
+1 -1
View File
@@ -612,7 +612,7 @@ public:
std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true); std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), entry, id1, id2, id3, displayid, nativeid, faction, npcflags); handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetSpawnId(), target->GetGUID().GetCounter(), entry, id1, id2, id3, displayid, nativeid, faction, npcflags);
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->GetLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId()); handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUnitFlags(), target->GetUnitFlags2(), target->GetDynamicFlags(), target->GetFaction()); handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUnitFlags(), target->GetUnitFlags2(), target->GetDynamicFlags(), target->GetFaction());
@@ -59,7 +59,7 @@ public:
} }
else if (type == "autobroadcast") else if (type == "autobroadcast")
{ {
if (player->getLevel() < sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE)) if (player->GetLevel() < sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE))
{ {
handler->SetSentErrorMessage(true); handler->SetSentErrorMessage(true);
handler->PSendSysMessage(LANG_CMD_AUTOBROADCAST_LVL_ERROR, sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE)); handler->PSendSysMessage(LANG_CMD_AUTOBROADCAST_LVL_ERROR, sWorld->getIntConfig(CONFIG_AUTOBROADCAST_MIN_LEVEL_DISABLE));
+1 -1
View File
@@ -337,7 +337,7 @@ public:
} }
// If the quest requires money // If the quest requires money
int32 ReqOrRewMoney = quest->GetRewOrReqMoney(player->getLevel()); int32 ReqOrRewMoney = quest->GetRewOrReqMoney(player->GetLevel());
if (ReqOrRewMoney < 0) if (ReqOrRewMoney < 0)
{ {
player->ModifyMoney(-ReqOrRewMoney); player->ModifyMoney(-ReqOrRewMoney);
+1 -1
View File
@@ -132,7 +132,7 @@ public:
if (!HandleResetStatsOrLevelHelper(target)) if (!HandleResetStatsOrLevelHelper(target))
return false; return false;
uint8 oldLevel = target->getLevel(); uint8 oldLevel = target->GetLevel();
// set starting level // set starting level
uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT uint32 startLevel = target->getClass() != CLASS_DEATH_KNIGHT
@@ -846,7 +846,7 @@ public:
if (Creature* creature = player->FindNearestCreature(NPC_SCARSHIELD_INFILTRATOR, 100.0f, true)) if (Creature* creature = player->FindNearestCreature(NPC_SCARSHIELD_INFILTRATOR, 100.0f, true))
{ {
bool transformHasStarted = creature->AI()->GetData(0) == 1; bool transformHasStarted = creature->AI()->GetData(0) == 1;
if ((player->getLevel() < 57 || !player->HasItemCount(ITEM_UNADORNED_SEAL)) && !transformHasStarted) if ((player->GetLevel() < 57 || !player->HasItemCount(ITEM_UNADORNED_SEAL)) && !transformHasStarted)
{ {
// Send whisper if not already sent // Send whisper if not already sent
std::list<ObjectGuid>::iterator itr = std::find(whisperedTargets.begin(), whisperedTargets.end(), player->GetGUID()); std::list<ObjectGuid>::iterator itr = std::find(whisperedTargets.begin(), whisperedTargets.end(), player->GetGUID());
@@ -876,7 +876,7 @@ public:
{ {
if (Creature* creature = player->FindNearestCreature(NPC_SCARSHIELD_INFILTRATOR, 100.0f, true)) if (Creature* creature = player->FindNearestCreature(NPC_SCARSHIELD_INFILTRATOR, 100.0f, true))
{ {
if (player->getLevel() >= 57 && player->HasItemCount(ITEM_UNADORNED_SEAL)) if (player->GetLevel() >= 57 && player->HasItemCount(ITEM_UNADORNED_SEAL))
{ {
creature->AI()->SetData(0, 1); // Start transform into Vaelan creature->AI()->SetData(0, 1); // Start transform into Vaelan
return true; return true;
@@ -624,7 +624,12 @@ public:
DoCast(target, SPELL_FLASH_HEAL, false); DoCast(target, SPELL_FLASH_HEAL, false);
else else
{ {
// bugged /**
* @bug
* Bugged
* //me->GetMotionMaster()->Clear();
* //me->GetMotionMaster()->MoveChase(target, 20);
*/
//me->GetMotionMaster()->Clear(); //me->GetMotionMaster()->Clear();
//me->GetMotionMaster()->MoveChase(target, 20); //me->GetMotionMaster()->MoveChase(target, 20);
} }
@@ -162,7 +162,7 @@ public:
case 2: case 2:
{ {
Talk(SAY_TURMOIL_1, summoner->ToPlayer()); Talk(SAY_TURMOIL_1, summoner->ToPlayer());
me->SetLevel(summoner->getLevel()); me->SetLevel(summoner->GetLevel());
me->SetFaction(FACTION_MONSTER); me->SetFaction(FACTION_MONSTER);
if (me->GetExactDist(summoner) < 50.0f) if (me->GetExactDist(summoner) < 50.0f)
{ {
@@ -748,7 +748,7 @@ public:
{ {
if (quest->IsAutoComplete()) if (quest->IsAutoComplete())
result2 = DIALOG_STATUS_REWARD_REP; result2 = DIALOG_STATUS_REWARD_REP;
else if (player->getLevel() <= (player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) else if (player->GetLevel() <= (player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)))
{ {
if (quest->IsDaily()) if (quest->IsDaily())
result2 = DIALOG_STATUS_AVAILABLE_REP; result2 = DIALOG_STATUS_AVAILABLE_REP;
@@ -1047,7 +1047,7 @@ public:
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer(); Player* target = GetHitPlayer();
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (!wintergrasp || !target || target->getLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId())) if (!wintergrasp || !target || target->GetLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId()))
return; return;
target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true); target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true);
@@ -108,7 +108,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
} }
UpdateWorldState(); UpdateWorldState();
// reward player, xinef: has no effect on characters above level 70 // reward player, xinef: has no effect on characters above level 70
if (player->getLevel() < 70) if (player->GetLevel() < 70)
player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
// add 19 honor // add 19 honor
player->RewardHonor(nullptr, 1, 19); player->RewardHonor(nullptr, 1, 19);
@@ -134,7 +134,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
} }
UpdateWorldState(); UpdateWorldState();
// reward player, xinef: has no effect on characters above level 70 // reward player, xinef: has no effect on characters above level 70
if (player->getLevel() < 70) if (player->GetLevel() < 70)
player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); player->CastSpell(player, SI_TRACES_OF_SILITHYST, true);
// add 19 honor // add 19 honor
player->RewardHonor(nullptr, 1, 19); player->RewardHonor(nullptr, 1, 19);
+2 -2
View File
@@ -316,9 +316,9 @@ class spell_pet_dk_gargoyle_strike : public SpellScript
int32 damage = 60; int32 damage = 60;
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
if (caster->getLevel() >= 60) if (caster->GetLevel() >= 60)
{ {
damage += (caster->getLevel() - 60) * 4; damage += (caster->GetLevel() - 60) * 4;
} }
} }
+2 -2
View File
@@ -97,8 +97,8 @@ struct npc_pet_hunter_snake_trap : public ScriptedAI
_init = true; _init = true;
CreatureTemplate const* Info = me->GetCreatureTemplate(); CreatureTemplate const* Info = me->GetCreatureTemplate();
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(me->getLevel(), Info->unit_class); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(me->GetLevel(), Info->unit_class);
uint32 health = uint32(107 * (me->getLevel() - 40) * 0.025f); uint32 health = uint32(107 * (me->GetLevel() - 40) * 0.025f);
me->SetCreateHealth(health); me->SetCreateHealth(health);
for (uint8 stat = 0; stat < MAX_STATS; ++stat) for (uint8 stat = 0; stat < MAX_STATS; ++stat)
+1 -1
View File
@@ -45,7 +45,7 @@ struct npc_pet_pri_lightwell : public TotemAI
uint32 hp = uint32(owner->GetMaxHealth() * 0.3f); uint32 hp = uint32(owner->GetMaxHealth() * 0.3f);
me->SetMaxHealth(hp); me->SetMaxHealth(hp);
me->SetHealth(hp); me->SetHealth(hp);
me->SetLevel(owner->getLevel()); me->SetLevel(owner->GetLevel());
} }
me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges
+3 -3
View File
@@ -149,7 +149,7 @@ class spell_dk_raise_ally : public SpellScript
if (Unit* ghoul = unitTarget->GetCharm()) if (Unit* ghoul = unitTarget->GetCharm())
{ {
//health, mana, armor and resistance //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 if (pInfo) // exist in DB
{ {
ghoul->SetCreateHealth(pInfo->health); ghoul->SetCreateHealth(pInfo->health);
@@ -159,8 +159,8 @@ class spell_dk_raise_ally : public SpellScript
ghoul->SetCreateStat(Stats(stat), float(pInfo->stats[stat])); ghoul->SetCreateStat(Stats(stat), float(pInfo->stats[stat]));
} }
ghoul->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 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))); ghoul->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(ghoul->GetLevel() + (ghoul->GetLevel() / 4)));
// Avoidance, Night of the Dead // Avoidance, Night of the Dead
if (Aura* aur = ghoul->AddAura(62137, ghoul)) if (Aura* aur = ghoul->AddAura(62137, ghoul))
+11 -11
View File
@@ -273,10 +273,10 @@ class spell_gen_reduced_above_60 : public SpellScript
void RecalculateDamage() void RecalculateDamage()
{ {
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
if (target->getLevel() > 60) if (target->GetLevel() > 60)
{ {
int32 damage = GetHitDamage(); 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); SetHitDamage(damage);
} }
} }
@@ -294,8 +294,8 @@ class spell_gen_reduced_above_60_aura : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
if (Unit* owner = GetUnitOwner()) if (Unit* owner = GetUnitOwner())
if (owner->getLevel() > 60) if (owner->GetLevel() > 60)
AddPct(amount, -4 * int8(std::min(owner->getLevel(), uint8(85)) - 60)); // prevents reduce by more than 100% AddPct(amount, -4 * int8(std::min(owner->GetLevel(), uint8(85)) - 60)); // prevents reduce by more than 100%
} }
void Register() override void Register() override
@@ -417,7 +417,7 @@ public:
SpellCastResult CheckRequirement() SpellCastResult CheckRequirement()
{ {
if (Unit* target = GetExplTargetUnit()) if (Unit* target = GetExplTargetUnit())
if (target->getLevel() >= _level) if (target->GetLevel() >= _level)
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
return SPELL_CAST_OK; 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*/) void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
Unit* target = GetUnitOwner(); Unit* target = GetUnitOwner();
if (target->getLevel() <= 63) if (target->GetLevel() <= 63)
amount = amount * target->getLevel() / 60; amount = amount * target->GetLevel() / 60;
else else
SetDuration(1); SetDuration(1);
} }
@@ -693,7 +693,7 @@ class spell_gen_use_spell_base_level_check : public SpellScript
SpellCastResult CheckRequirement() SpellCastResult CheckRequirement()
{ {
if (GetCaster()->getLevel() < GetSpellInfo()->BaseLevel) if (GetCaster()->GetLevel() < GetSpellInfo()->BaseLevel)
return SPELL_FAILED_LEVEL_REQUIREMENT; return SPELL_FAILED_LEVEL_REQUIREMENT;
return SPELL_CAST_OK; return SPELL_CAST_OK;
} }
@@ -857,7 +857,7 @@ class spell_gen_proc_above_75 : public SpellScript
SpellCastResult CheckLevel() SpellCastResult CheckLevel()
{ {
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (caster->getLevel() < 75) if (caster->GetLevel() < 75)
{ {
return SPELL_FAILED_LOWLEVEL; return SPELL_FAILED_LOWLEVEL;
} }
@@ -934,8 +934,8 @@ class spell_gen_proc_reduced_above_60 : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo) bool CheckProc(ProcEventInfo& eventInfo)
{ {
// Xinef: mostly its 33.(3)% reduce by 70 and 66.(6)% by 80 // Xinef: mostly its 33.(3)% reduce by 70 and 66.(6)% by 80
if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() > 60) if (eventInfo.GetActor() && eventInfo.GetActor()->GetLevel() > 60)
if (roll_chance_f((eventInfo.GetActor()->getLevel() - 60) * 3.33f)) if (roll_chance_f((eventInfo.GetActor()->GetLevel() - 60) * 3.33f))
return false; return false;
return true; return true;
+1 -1
View File
@@ -950,7 +950,7 @@ class spell_hun_tame_beast : public SpellScript
if (Creature* target = GetExplTargetUnit()->ToCreature()) if (Creature* target = GetExplTargetUnit()->ToCreature())
{ {
if (target->getLevel() > player->getLevel()) if (target->GetLevel() > player->GetLevel())
{ {
player->SendTameFailure(PET_TAME_TOO_HIGHLEVEL); player->SendTameFailure(PET_TAME_TOO_HIGHLEVEL);
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
+10 -10
View File
@@ -123,10 +123,10 @@ class spell_item_mind_amplify_dish : public SpellScript
return; return;
if (GetSpellInfo()->Id != SPELL_AMPLIFY_10S) if (GetSpellInfo()->Id != SPELL_AMPLIFY_10S)
if (target->getLevel() > 60) if (target->GetLevel() > 60)
return; 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)) if (roll_chance_i(pct))
player->CastSpell(target, SPELL_MENTAL_BATTLE, true); player->CastSpell(target, SPELL_MENTAL_BATTLE, true);
else if (roll_chance_i(pct)) else if (roll_chance_i(pct))
@@ -156,7 +156,7 @@ class spell_item_runescroll_of_fortitude : public SpellScript
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{ {
if (target->getLevel() < 70) if (target->GetLevel() < 70)
return; return;
target->CastSpell(target, SPELL_FORTITUDE, true); 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*/) void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{ {
Unit* target = GetTarget(); Unit* target = GetTarget();
if (target->getLevel() <= 70) if (target->GetLevel() <= 70)
{ {
if (auto spellId = getMountSpellId()) if (auto spellId = getMountSpellId())
{ {
@@ -297,9 +297,9 @@ class spell_item_magic_dust : public SpellScript
{ {
if (Unit* target = GetHitUnit()) 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)) if (!roll_chance_i(chance))
{ {
PreventHitAura(); PreventHitAura();
@@ -1362,7 +1362,7 @@ class spell_item_arcane_shroud : public AuraScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
int32 diff = GetUnitOwner()->getLevel() - 60; int32 diff = GetUnitOwner()->GetLevel() - 60;
if (diff > 0) if (diff > 0)
amount += 2 * diff; amount += 2 * diff;
} }
@@ -2142,7 +2142,7 @@ class spell_item_scroll_of_recall : public SpellScript
break; break;
} }
if (caster->getLevel() > maxSafeLevel) if (caster->GetLevel() > maxSafeLevel)
{ {
caster->CastSpell(caster, SPELL_LOST, true); 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*/) void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{ {
int32 diff = GetUnitOwner()->getLevel() - 60; int32 diff = GetUnitOwner()->GetLevel() - 60;
if (diff > 0) if (diff > 0)
amount += diff; amount += diff;
} }
@@ -3745,7 +3745,7 @@ class spell_item_green_whelp_armor : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo) bool CheckProc(ProcEventInfo& eventInfo)
{ {
if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() <= 50) if (eventInfo.GetActor() && eventInfo.GetActor()->GetLevel() <= 50)
return true; return true;
return false; return false;
+1 -1
View File
@@ -337,7 +337,7 @@ private:
uint32 defenseSkillValue = victim->GetDefenseSkillValue(); uint32 defenseSkillValue = victim->GetDefenseSkillValue();
// Max heal when defense skill denies critical hits from raid bosses // Max heal when defense skill denies critical hits from raid bosses
// Formula: max defense at level + 140 (raiting from gear) // 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) float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
? 1.0f ? 1.0f
: float(defenseSkillValue) / float(reqDefForMaxHeal); : float(defenseSkillValue) / float(reqDefForMaxHeal);
+1 -1
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)) if (AuraEffect const* aegis = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0))
absorb += aegis->GetAmount(); 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); GetTarget()->CastCustomSpell(SPELL_PRIEST_DIVINE_AEGIS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff);
} }
+2 -2
View File
@@ -255,11 +255,11 @@ public:
bool OnCastItemCombatSpell(Player* /*player*/, Unit* victim, SpellInfo const* /*spellInfo*/, Item* /*item*/) override bool OnCastItemCombatSpell(Player* /*player*/, Unit* victim, SpellInfo const* /*spellInfo*/, Item* /*item*/) override
{ {
// spell proc chance gets severely reduced on victims > 60 (formula unknown) // spell proc chance gets severely reduced on victims > 60 (formula unknown)
if (victim->getLevel() > 60) if (victim->GetLevel() > 60)
{ {
// gives ~0.1% proc chance at lvl 70 // gives ~0.1% proc chance at lvl 70
float const lvlPenaltyFactor = 9.93f; float const lvlPenaltyFactor = 9.93f;
float const failureChance = (victim->getLevel() - 60) * lvlPenaltyFactor; float const failureChance = (victim->GetLevel() - 60) * lvlPenaltyFactor;
// base ppm chance was already rolled, only roll success chance // base ppm chance was already rolled, only roll success chance
return !roll_chance_f(failureChance); return !roll_chance_f(failureChance);
+8 -8
View File
@@ -273,7 +273,7 @@ int32 DoHighUnlearnCost(Player* /*player*/) //tailor, alchemy
int32 DoMedUnlearnCost(Player* player) //blacksmith, leatherwork int32 DoMedUnlearnCost(Player* player) //blacksmith, leatherwork
{ {
uint8 level = player->getLevel(); uint8 level = player->GetLevel();
if (level < 51) if (level < 51)
return 250000; return 250000;
else if (level < 66) else if (level < 66)
@@ -284,7 +284,7 @@ int32 DoMedUnlearnCost(Player* player) //blacksmith, leather
int32 DoLowUnlearnCost(Player* player) //blacksmith int32 DoLowUnlearnCost(Player* player) //blacksmith
{ {
uint8 level = player->getLevel(); uint8 level = player->GetLevel();
if (level < 66) if (level < 66)
return 50000; return 50000;
else else
@@ -486,7 +486,7 @@ public:
if (creature->IsTrainer()) if (creature->IsTrainer())
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
if (player->HasSkill(SKILL_ALCHEMY) && player->GetBaseSkillValue(SKILL_ALCHEMY) >= 350 && player->getLevel() > 67) if (player->HasSkill(SKILL_ALCHEMY) && player->GetBaseSkillValue(SKILL_ALCHEMY) >= 350 && player->GetLevel() > 67)
{ {
if (player->GetQuestRewardStatus(Q_MASTER_TRANSMUTE) || player->GetQuestRewardStatus(Q_MASTER_ELIXIR) || player->GetQuestRewardStatus(Q_MASTER_POTION)) if (player->GetQuestRewardStatus(Q_MASTER_TRANSMUTE) || player->GetQuestRewardStatus(Q_MASTER_ELIXIR) || player->GetQuestRewardStatus(Q_MASTER_POTION))
{ {
@@ -683,7 +683,7 @@ public:
} }
} }
//WEAPONSMITH SPEC //WEAPONSMITH SPEC
if (player->HasSpell(S_WEAPON) && player->getLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250) if (player->HasSpell(S_WEAPON) && player->GetLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250)
{ {
switch (creatureId) switch (creatureId)
{ {
@@ -992,7 +992,7 @@ public:
player->PrepareQuestMenu(creature->GetGUID()); player->PrepareQuestMenu(creature->GetGUID());
} }
if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->getLevel() > 40) if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->GetLevel() > 40)
{ {
switch (creature->GetEntry()) switch (creature->GetEntry())
{ {
@@ -1085,7 +1085,7 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
//TAILORING SPEC //TAILORING SPEC
if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 350 && player->getLevel() > 59) if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 350 && player->GetLevel() > 59)
{ {
if (player->GetQuestRewardStatus(10831) || player->GetQuestRewardStatus(10832) || player->GetQuestRewardStatus(10833)) if (player->GetQuestRewardStatus(10831) || player->GetQuestRewardStatus(10832) || player->GetQuestRewardStatus(10833))
{ {
@@ -1247,7 +1247,7 @@ public:
bool OnGossipHello(Player* player, GameObject* gameobject) override bool OnGossipHello(Player* player, GameObject* gameobject) override
{ {
//ENGINEERING SPEC //ENGINEERING SPEC
if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 225 && player->getLevel() >= 35) if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 225 && player->GetLevel() >= 35)
{ {
if (player->GetQuestRewardStatus(3643) || player->GetQuestRewardStatus(3641) || player->GetQuestRewardStatus(3639)) if (player->GetQuestRewardStatus(3643) || player->GetQuestRewardStatus(3641) || player->GetQuestRewardStatus(3639))
{ {
@@ -1268,7 +1268,7 @@ public:
} }
//LEATHERWORKING SPEC //LEATHERWORKING SPEC
if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->getLevel() >= 40) if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->GetLevel() >= 40)
{ {
if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5143) || player->GetQuestRewardStatus(5144) || player->GetQuestRewardStatus(5145) || player->GetQuestRewardStatus(5146) || player->GetQuestRewardStatus(5148))) if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5143) || player->GetQuestRewardStatus(5144) || player->GetQuestRewardStatus(5145) || player->GetQuestRewardStatus(5146) || player->GetQuestRewardStatus(5148)))
{ {
+1 -1
View File
@@ -34,7 +34,7 @@ public:
{ {
if (quest->GetQuestId() == QUEST_APPRENTICE_ANGLER) if (quest->GetQuestId() == QUEST_APPRENTICE_ANGLER)
{ {
uint32 level = player->getLevel(); uint32 level = player->GetLevel();
int32 moneyRew = 0; int32 moneyRew = 0;
if (level <= 10) if (level <= 10)
moneyRew = 85; moneyRew = 85;