diff --git a/website/client/src/components/shops/quests/index.vue b/website/client/src/components/shops/quests/index.vue index 7fc11588c7..e1a9134278 100644 --- a/website/client/src/components/shops/quests/index.vue +++ b/website/client/src/components/shops/quests/index.vue @@ -560,14 +560,8 @@ export default { this.selectedItemToBuy = null; } }, - isGearLocked (gear) { - if (gear.value > this.userStats.gp) { - return true; - } - - return false; - }, selectItem (item) { + if (item.locked) return; this.selectedItemToBuy = item; this.$root.$emit('bv::show::modal', 'buy-quest-modal'); diff --git a/website/common/script/content/quests.js b/website/common/script/content/quests.js index be62c01be9..31b1b52c4b 100644 --- a/website/common/script/content/quests.js +++ b/website/common/script/content/quests.js @@ -2,17 +2,15 @@ import defaults from 'lodash/defaults'; import each from 'lodash/each'; import sortBy from 'lodash/sortBy'; import t from './translation'; -import { - USER_CAN_OWN_QUEST_CATEGORIES, - QUEST_GENERIC, - QUEST_MASTERCLASSER, - QUEST_PETS, - QUEST_POTIONS, - QUEST_SEASONAL, - QUEST_SERIES, - QUEST_TIME_TRAVEL, - QUEST_WORLD, -} from './constants'; +import { USER_CAN_OWN_QUEST_CATEGORIES } from './constants'; +import QUEST_GENERIC from './quests/generic'; +import QUEST_MASTERCLASSER from './quests/masterclasser'; +import QUEST_PETS from './quests/pets'; +import QUEST_POTIONS from './quests/potions'; +import QUEST_SEASONAL from './quests/seasonal'; +import QUEST_SERIES from './quests/series'; +import QUEST_TIME_TRAVEL from './quests/timeTravel'; +import QUEST_WORLD from './quests/world'; const userCanOwnQuestCategories = USER_CAN_OWN_QUEST_CATEGORIES; const questGeneric = QUEST_GENERIC; diff --git a/website/common/script/content/quests/potions.js b/website/common/script/content/quests/potions.js index 5bd146cf71..0b615f46a4 100644 --- a/website/common/script/content/quests/potions.js +++ b/website/common/script/content/quests/potions.js @@ -335,5 +335,4 @@ const QUEST_POTIONS = { }, }, }; - export default QUEST_POTIONS; diff --git a/website/common/script/content/quests/seasonal.js b/website/common/script/content/quests/seasonal.js index 0c736f1bcb..8182fbd63a 100644 --- a/website/common/script/content/quests/seasonal.js +++ b/website/common/script/content/quests/seasonal.js @@ -33,9 +33,6 @@ const QUEST_SEASONAL = { gp: 20, exp: 100, }, - canBuy () { - return this.event && moment().isBetween(this.event.start, this.event.end); - }, }, evilsanta2: { event: CURRENT_EVENT && CURRENT_EVENT.season === 'winter' ? CURRENT_EVENT : null, @@ -66,9 +63,6 @@ const QUEST_SEASONAL = { gp: 20, exp: 100, }, - canBuy () { - return this.event && moment().isBetween(this.event.start, this.event.end); - }, }, // spring egg: { @@ -131,8 +125,45 @@ const QUEST_SEASONAL = { gp: 0, exp: 0, }, - canBuy () { - return this.event && moment().isBetween(this.event.start, this.event.end); + }, + waffle: { + text: t('questWaffleText'), + notes: t('questWaffleNotes'), + completion: t('questWaffleCompletion'), + value: 4, + category: 'hatchingPotion', + event: CURRENT_EVENT && CURRENT_EVENT.season === 'spring' ? CURRENT_EVENT : null, + boss: { + name: t('questWaffleBoss'), + hp: 500, + str: 2, + rage: { + title: t('questWaffleRageTitle'), + description: t('questWaffleRageDescription'), + value: 50, + progressDrain: 0.5, + effect: t('questWaffleRageEffect'), + }, + }, + drop: { + items: [ + { + type: 'hatchingPotions', + key: 'Dessert', + text: t('questWaffleDropDessertPotion'), + }, { + type: 'hatchingPotions', + key: 'Dessert', + text: t('questWaffleDropDessertPotion'), + }, { + type: 'hatchingPotions', + key: 'Dessert', + text: t('questWaffleDropDessertPotion'), + }, + ], + gp: 40, + exp: 500, + unlock: t('questWaffleUnlockText'), }, }, virtualpet: { @@ -178,49 +209,6 @@ const QUEST_SEASONAL = { unlock: t('questVirtualPetUnlockText'), }, }, - waffle: { - text: t('questWaffleText'), - notes: t('questWaffleNotes'), - completion: t('questWaffleCompletion'), - value: 4, - category: 'hatchingPotion', - event: CURRENT_EVENT && CURRENT_EVENT.season === 'spring' ? CURRENT_EVENT : null, - boss: { - name: t('questWaffleBoss'), - hp: 500, - str: 2, - rage: { - title: t('questWaffleRageTitle'), - description: t('questWaffleRageDescription'), - value: 50, - progressDrain: 0.5, - effect: t('questWaffleRageEffect'), - }, - }, - drop: { - items: [ - { - type: 'hatchingPotions', - key: 'Dessert', - text: t('questWaffleDropDessertPotion'), - }, { - type: 'hatchingPotions', - key: 'Dessert', - text: t('questWaffleDropDessertPotion'), - }, { - type: 'hatchingPotions', - key: 'Dessert', - text: t('questWaffleDropDessertPotion'), - }, - ], - gp: 40, - exp: 500, - unlock: t('questWaffleUnlockText'), - }, - canBuy () { - return this.event && moment().isBetween(this.event.start, this.event.end); - }, - }, }; export default QUEST_SEASONAL; diff --git a/website/common/script/content/quests/series.js b/website/common/script/content/quests/series.js index 0dc75d650a..09a107ec8c 100644 --- a/website/common/script/content/quests/series.js +++ b/website/common/script/content/quests/series.js @@ -36,11 +36,10 @@ const QUEST_SERIES = { notes: t('questAtom2Notes'), completion: t('questAtom2Completion'), group: 'questGroupAtom', - prerequisite: { - lvl: 15, - atom1: true, - }, previous: 'atom1', + prereqQuests: [ + 'atom1', + ], value: 4, lvl: 15, category: 'unlockable', @@ -67,12 +66,11 @@ const QUEST_SERIES = { notes: t('questAtom3Notes'), group: 'questGroupAtom', previous: 'atom2', + prereqQuests: [ + 'atom1', + 'atom2', + ], completion: t('questAtom3Completion'), - prerequisite: { - lvl: 15, - atom1: true, - atom2: true, - }, value: 4, lvl: 15, category: 'unlockable', @@ -135,6 +133,9 @@ const QUEST_SERIES = { group: 'questGroupGoldenknight', value: 4, previous: 'goldenknight1', + prereqQuests: [ + 'goldenknight1', + ], lvl: 40, category: 'unlockable', boss: { @@ -161,6 +162,10 @@ const QUEST_SERIES = { group: 'questGroupGoldenknight', completion: t('questGoldenknight3Completion'), previous: 'goldenknight2', + prereqQuests: [ + 'goldenknight1', + 'goldenknight2', + ], value: 4, lvl: 40, category: 'unlockable', @@ -237,6 +242,9 @@ const QUEST_SERIES = { group: 'questGroupMoon', completion: t('questMoon2Completion'), previous: 'moon1', + prereqQuests: [ + 'moon1', + ], value: 4, category: 'unlockable', unlockCondition: { @@ -267,6 +275,10 @@ const QUEST_SERIES = { group: 'questGroupMoon', completion: t('questMoon3Completion'), previous: 'moon2', + prereqQuests: [ + 'moon1', + 'moon2', + ], value: 4, category: 'unlockable', unlockCondition: { @@ -326,6 +338,9 @@ const QUEST_SERIES = { value: 4, lvl: 60, previous: 'moonstone1', + prereqQuests: [ + 'moonstone1', + ], category: 'unlockable', boss: { name: t('questMoonstone2Boss'), @@ -351,6 +366,10 @@ const QUEST_SERIES = { group: 'questGroupMoonstone', completion: t('questMoonstone3Completion'), previous: 'moonstone2', + prereqQuests: [ + 'moonstone1', + 'moonstone2', + ], value: 4, lvl: 60, category: 'unlockable', @@ -438,6 +457,9 @@ const QUEST_SERIES = { lvl: 30, category: 'unlockable', previous: 'vice1', + prereqQuests: [ + 'vice1', + ], collect: { lightCrystal: { text: t('questVice2CollectLightCrystal'), @@ -463,6 +485,10 @@ const QUEST_SERIES = { group: 'questGroupVice', completion: t('questVice3Completion'), previous: 'vice2', + prereqQuests: [ + 'vice1', + 'vice2', + ], value: 4, lvl: 30, category: 'unlockable', diff --git a/website/common/script/libs/getItemInfo.js b/website/common/script/libs/getItemInfo.js index e7ffb300b6..1d63c53ce1 100644 --- a/website/common/script/libs/getItemInfo.js +++ b/website/common/script/libs/getItemInfo.js @@ -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) {