mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/Quest: Do not allow quests to be turned in if the player no longer satisfies level/skill/reputation requirements. Fixes #226. Yes, you read that issue tag right.
(cherry picked from commit a1fd404b64)
This commit is contained in:
@@ -15179,6 +15179,10 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest)
|
||||
|
||||
bool Player::CanRewardQuest(Quest const* quest, bool msg) const
|
||||
{
|
||||
// quest is disabled
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this))
|
||||
return false;
|
||||
|
||||
// not auto complete quest and not completed quest (only cheating case, then ignore without message)
|
||||
if (!quest->IsDFQuest() && !quest->IsAutoComplete() && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE)
|
||||
return false;
|
||||
@@ -15187,6 +15191,10 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) const
|
||||
if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestMonth(quest, true) || !SatisfyQuestSeasonal(quest, true))
|
||||
return false;
|
||||
|
||||
// player no longer satisfies the quest's requirements (skill level etc.)
|
||||
if (!SatisfyQuestLevel(quest, true) || !SatisfyQuestSkill(quest, true) || !SatisfyQuestReputation(quest, true))
|
||||
return false;
|
||||
|
||||
// rewarded and not repeatable quest (only cheating case, then ignore without message)
|
||||
if (GetQuestRewardStatus(quest->GetQuestId()))
|
||||
return false;
|
||||
@@ -24288,13 +24296,6 @@ bool Player::ModifyMoney(int64 amount, bool sendError /*= true*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::HasEnoughMoney(int64 amount) const
|
||||
{
|
||||
if (amount > 0)
|
||||
return (GetMoney() >= (uint64) amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::SetMoney(uint64 value)
|
||||
{
|
||||
MoneyChanged(value);
|
||||
|
||||
@@ -1692,7 +1692,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
uint64 GetMoney() const { return m_activePlayerData->Coinage; }
|
||||
bool ModifyMoney(int64 amount, bool sendError = true);
|
||||
bool HasEnoughMoney(uint64 amount) const { return (GetMoney() >= amount); }
|
||||
bool HasEnoughMoney(int64 amount) const;
|
||||
bool HasEnoughMoney(int64 amount) const{ return (amount < 0) || HasEnoughMoney(uint64(amount)); }
|
||||
void SetMoney(uint64 value);
|
||||
|
||||
RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
|
||||
|
||||
Reference in New Issue
Block a user