mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 06:06:23 +00:00
fix(Core): Correct Quest Details Display at Max Level (#13046)
* fix(Core): Quest Details Display at Max Level * Add OnSetMaxLevel hook
This commit is contained in:
@@ -450,10 +450,25 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
|
||||
data << uint32(0);
|
||||
}
|
||||
|
||||
uint8 playerLevel = _session->GetPlayer() ? _session->GetPlayer()->getLevel() : 0;
|
||||
data << uint32(quest->GetRewOrReqMoney(playerLevel));
|
||||
uint32 questXp = uint32(quest->XPValue(playerLevel) * _session->GetPlayer()->GetQuestRate());
|
||||
sScriptMgr->OnQuestComputeXP(_session->GetPlayer(), quest, questXp);
|
||||
uint32 moneyRew = 0;
|
||||
Player* player = _session->GetPlayer();
|
||||
uint8 playerLevel = player ? player->getLevel() : 0;
|
||||
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
|
||||
{
|
||||
moneyRew = quest->GetRewMoneyMaxLevel();
|
||||
}
|
||||
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl)
|
||||
data << moneyRew;
|
||||
uint32 questXp;
|
||||
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
|
||||
{
|
||||
questXp = uint32(quest->XPValue(playerLevel) * player->GetQuestRate());
|
||||
}
|
||||
else
|
||||
{
|
||||
questXp = 0;
|
||||
}
|
||||
sScriptMgr->OnQuestComputeXP(player, quest, questXp);
|
||||
data << questXp;
|
||||
}
|
||||
|
||||
@@ -535,7 +550,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
||||
if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
|
||||
data << uint32(0); // Hide money rewarded
|
||||
else
|
||||
data << uint32(quest->GetRewOrReqMoney(_session->GetPlayer() ? _session->GetPlayer()->getLevel() : 0)); // reward money (below max lvl)
|
||||
{
|
||||
uint32 moneyRew = 0;
|
||||
Player* player = _session->GetPlayer();
|
||||
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
|
||||
{
|
||||
moneyRew = quest->GetRewMoneyMaxLevel();
|
||||
}
|
||||
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl)
|
||||
data << moneyRew;
|
||||
}
|
||||
|
||||
data << uint32(quest->GetRewMoneyMaxLevel()); // used in XP calculation at client
|
||||
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (cast if RewSpellCast == 0)
|
||||
@@ -679,11 +703,25 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
|
||||
data << uint32(0);
|
||||
}
|
||||
|
||||
uint8 playerLevel = _session->GetPlayer() ? _session->GetPlayer()->getLevel() : 0;
|
||||
|
||||
data << uint32(quest->GetRewOrReqMoney(playerLevel));
|
||||
uint32 questXp = uint32(quest->XPValue(playerLevel) * _session->GetPlayer()->GetQuestRate());
|
||||
sScriptMgr->OnQuestComputeXP(_session->GetPlayer(), quest, questXp);
|
||||
uint32 moneyRew = 0;
|
||||
Player* player = _session->GetPlayer();
|
||||
uint8 playerLevel = player ? player->getLevel() : 0;
|
||||
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
|
||||
{
|
||||
moneyRew = quest->GetRewMoneyMaxLevel();
|
||||
}
|
||||
moneyRew += quest->GetRewOrReqMoney(player ? player->getLevel() : 0); // reward money (below max lvl)
|
||||
data << moneyRew;
|
||||
uint32 questXp;
|
||||
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
|
||||
{
|
||||
questXp = uint32(quest->XPValue(playerLevel) * player->GetQuestRate());
|
||||
}
|
||||
else
|
||||
{
|
||||
questXp = 0;
|
||||
}
|
||||
sScriptMgr->OnQuestComputeXP(player, quest, questXp);
|
||||
data << questXp;
|
||||
|
||||
// rewarded honor points. Multiply with 10 to satisfy client
|
||||
|
||||
@@ -2537,7 +2537,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
PlayerLevelInfo info;
|
||||
sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), getLevel(), &info);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||
uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel);
|
||||
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel);
|
||||
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(getLevel()));
|
||||
|
||||
// reset before any aura state sources (health set/aura apply)
|
||||
|
||||
@@ -637,6 +637,14 @@ void ScriptMgr::OnFirstLogin(Player* player)
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnSetMaxLevel(Player* player, uint32& maxPlayerLevel)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnSetMaxLevel(player, maxPlayerLevel);
|
||||
});
|
||||
}
|
||||
|
||||
bool ScriptMgr::CanJoinInBattlegroundQueue(Player* player, ObjectGuid BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err)
|
||||
{
|
||||
auto ret = IsValidBoolScript<PlayerScript>([&](PlayerScript* script)
|
||||
|
||||
@@ -1224,6 +1224,8 @@ public:
|
||||
|
||||
virtual void OnFirstLogin(Player* /*player*/) { }
|
||||
|
||||
virtual void OnSetMaxLevel(Player* /*player*/, uint32& /*maxPlayerLevel*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanJoinInBattlegroundQueue(Player* /*player*/, ObjectGuid /*BattlemasterGuid*/, BattlegroundTypeId /*BGTypeID*/, uint8 /*joinAsGroup*/, GroupJoinBattlegroundResult& /*err*/) { return true; }
|
||||
virtual bool ShouldBeRewardedWithMoneyInsteadOfExp(Player* /*player*/) { return false; }
|
||||
|
||||
@@ -2295,6 +2297,7 @@ public: /* PlayerScript */
|
||||
void OnAfterUpdateAttackPowerAndDamage(Player* player, float& level, float& base_attPower, float& attPowerMod, float& attPowerMultiplier, bool ranged);
|
||||
void OnBeforeInitTalentForLevel(Player* player, uint8& level, uint32& talentPointsForLevel);
|
||||
void OnFirstLogin(Player* player);
|
||||
void OnSetMaxLevel(Player* player, uint32& maxPlayerLevel);
|
||||
void OnPlayerCompleteQuest(Player* player, Quest const* quest);
|
||||
void OnBattlegroundDesertion(Player* player, BattlegroundDesertionType const desertionType);
|
||||
bool CanJoinInBattlegroundQueue(Player* player, ObjectGuid BattlemasterGuid, BattlegroundTypeId BGTypeID, uint8 joinAsGroup, GroupJoinBattlegroundResult& err);
|
||||
|
||||
Reference in New Issue
Block a user