diff --git a/website/common/script/ops/buy/buyQuestGem.js b/website/common/script/ops/buy/buyQuestGem.js index dbc5c100cf..01b3bf7792 100644 --- a/website/common/script/ops/buy/buyQuestGem.js +++ b/website/common/script/ops/buy/buyQuestGem.js @@ -53,7 +53,8 @@ export class BuyQuestWithGemOperation extends AbstractGemItemOperation { // esli } const matchers = getScheduleMatchingGroup(`${item.category}Quests`); - if (matchers.match(item.key)) { + console.log(matchers); + if (!matchers.match(item.key)) { throw new NotAuthorized(this.i18n('notAvailable', { key: item.key })); } diff --git a/website/common/script/ops/buy/purchase.js b/website/common/script/ops/buy/purchase.js index 028755d035..8e83574850 100644 --- a/website/common/script/ops/buy/purchase.js +++ b/website/common/script/ops/buy/purchase.js @@ -55,10 +55,6 @@ async function purchaseItem (user, item, price, type, key) { if (user.markModified) user.markModified('items.gear.owned'); } else if (type === 'bundles') { const subType = item.type; - const matchers = getScheduleMatchingGroup('bundles'); - if (!matchers.match(item.key)) { - throw new NotAuthorized(i18n.t('notAvailable', { key: item.key })); - } forEach(item.bundleKeys, bundledKey => { if (!user.items[subType][bundledKey] || user.items[subType][bundledKey] < 0) { user.items[subType][bundledKey] = 0; @@ -101,7 +97,7 @@ export default async function purchase (user, req = {}, analytics) { const { price, item } = getItemAndPrice(user, type, key, req); - if (item.type === 'hatchingPotion' && item.premium === true) { + if (type === 'hatchingPotions' && item.premium === true) { const matchers = getScheduleMatchingGroup('premiumHatchingPotions'); if (!matchers.match(item.key)) { throw new NotAuthorized(i18n.t('messageNotAvailable', req.language)); @@ -111,6 +107,11 @@ export default async function purchase (user, req = {}, analytics) { if (!matchers.match(item.set)) { throw new NotAuthorized(i18n.t('messageNotAvailable', req.language)); } + } else if (type === 'bundles') { + const matchers = getScheduleMatchingGroup('bundles'); + if (!matchers.match(item.key)) { + throw new NotAuthorized(i18n.t('notAvailable', { key: item.key })); + } } else if (!item.canBuy(user)) { throw new NotAuthorized(i18n.t('messageNotAvailable', req.language)); } diff --git a/website/server/libs/worldState.js b/website/server/libs/worldState.js index 93901ada92..36b4ff8d0f 100644 --- a/website/server/libs/worldState.js +++ b/website/server/libs/worldState.js @@ -4,7 +4,6 @@ import { // eslint-disable-line import/no-cycle model as Group, TAVERN_ID as tavernId, } from '../models/group'; -import common from '../../common'; import { REPEATING_EVENTS } from '../../common/script/content/constants'; import { getCurrentGalaEvent } from '../../common/script/content/constants/schedule';