Fix: Inconsistent Quest Unlock Behavior (#13734)

* remove quest refactoring, created new branch for that task

* remove quest refactoring, created new branch for that task

* More trying to figure out how buying a quest actually works

* rolling back changes

* updated shops/quests/index.vue to disable clicking on locked quests

* removed console.log(item)

* misc fixes per review comments

* changes as requested

* incorporated quest refactors updates

* removing a couple lines of code
This commit is contained in:
Natalie L
2022-05-05 17:51:47 -04:00
committed by GitHub
parent de4ebbac7b
commit 5e12b7b042
6 changed files with 101 additions and 85 deletions

View File

@@ -9,13 +9,24 @@ import isFreeRebirth from './isFreeRebirth';
import getOfficialPinnedItems from './getOfficialPinnedItems';
function lockQuest (quest, user) {
if (quest.key === 'lostMasterclasser1') return !(user.achievements.quests.dilatoryDistress3 && user.achievements.quests.mayhemMistiflying3 && user.achievements.quests.stoikalmCalamity3 && user.achievements.quests.taskwoodsTerror3);
if (quest.lvl && user.stats.lvl < quest.lvl) return true;
if (quest.unlockCondition && (quest.key === 'moon1' || quest.key === 'moon2' || quest.key === 'moon3')) {
return user.loginIncentives < quest.unlockCondition.incentiveThreshold;
// checks series quests, including Masterclasser
if (quest.prereqQuests) {
if (!user.achievements.quests) return true;
for (const prereq of quest.prereqQuests) {
if (!user.achievements.quests[prereq]) return true;
}
}
if (user.achievements.quests) return quest.previous && !user.achievements.quests[quest.previous];
return quest.previous;
// checks quest & user level against quest level
if (quest.lvl && user.stats.lvl < quest.lvl) return true;
// checks unlockCondition.incentiveThreshold for Lunar Battle
if (
quest.unlockCondition
&& quest.unlockCondition.incentiveThreshold
&& user.loginIncentives < quest.unlockCondition.incentiveThreshold
) return true;
// // then if we've passed all the checks
return false;
}
function isItemSuggested (officialPinnedItems, itemInfo) {