diff options
author | Treeston <treeston.mmoc@gmail.com> | 2019-07-08 21:35:57 +0200 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2019-07-08 21:35:57 +0200 |
commit | a1fd404b64fe46925cf5ab3e3af267ce9ba1badd (patch) | |
tree | 46989329dca3e981d122c78ab5a5e86728d63be6 | |
parent | f2cd721d5358f7febf36dc757f5e3e9693a6a7b6 (diff) |
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.
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 452f84c4d91..242318372bc 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14799,6 +14799,10 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest) bool Player::CanRewardQuest(Quest const* quest, bool msg) { + // 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() && !(quest->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE) return false; @@ -14807,6 +14811,10 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) 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; @@ -22508,13 +22516,6 @@ bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/) return true; } -bool Player::HasEnoughMoney(int32 amount) const -{ - if (amount > 0) - return (GetMoney() >= (uint32) amount); - return true; -} - void Player::SetMoney(uint32 value) { SetUInt32Value(PLAYER_FIELD_COINAGE, value); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 98622df90cc..74bf97fd81c 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1360,7 +1360,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> uint32 GetMoney() const { return GetUInt32Value(PLAYER_FIELD_COINAGE); } bool ModifyMoney(int32 amount, bool sendError = true); bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); } - bool HasEnoughMoney(int32 amount) const; + bool HasEnoughMoney(int32 amount) const { return (amount < 0) || HasEnoughMoney(uint32(amount)); } void SetMoney(uint32 value); RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; } |