From 46b8e7f725fcc3d452e9ce9443d105a3f7dd1bfe Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Fri, 9 Apr 2021 15:14:18 -0500 Subject: [PATCH] fix(event): filter out past seasonal sets in Market also block purchase of special spells outside their events also remove hardcoded dates from seasonal shop intro text used on mobile --- website/common/locales/en/limited.json | 8 ++++---- website/common/script/content/spells.js | 19 +++++++++++++++++++ website/common/script/libs/shops.js | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/website/common/locales/en/limited.json b/website/common/locales/en/limited.json index 7ad85cc377..179b6d7cd7 100644 --- a/website/common/locales/en/limited.json +++ b/website/common/locales/en/limited.json @@ -28,10 +28,10 @@ "seasonalShopClosedTitle": "<%= linkStart %>Leslie<%= linkEnd %>", "seasonalShopTitle": "<%= linkStart %>Seasonal Sorceress<%= linkEnd %>", "seasonalShopClosedText": "The Seasonal Shop is currently closed!! It’s only open during Habitica’s four Grand Galas.", - "seasonalShopSummerText": "Happy Summer Splash!! Would you like to buy some rare items? They’ll only be available until July 31st!", - "seasonalShopFallText": "Happy Fall Festival!! Would you like to buy some rare items? They’ll only be available until October 31st!", - "seasonalShopWinterText": "Happy Winter Wonderland!! Would you like to buy some rare items? They’ll only be available until January 31st!", - "seasonalShopSpringText": "Happy Spring Fling!! Would you like to buy some rare items? They’ll only be available until April 30th!", + "seasonalShopSummerText": "Happy Summer Splash!! Would you like to buy some rare items? They’ll only be available during the Gala!", + "seasonalShopFallText": "Happy Fall Festival!! Would you like to buy some rare items? They’ll only be available during the Gala!", + "seasonalShopWinterText": "Happy Winter Wonderland!! Would you like to buy some rare items? They’ll only be available during the Gala!", + "seasonalShopSpringText": "Happy Spring Fling!! Would you like to buy some rare items? They’ll only be available during the Gala!", "seasonalShopFallTextBroken": "Oh.... Welcome to the Seasonal Shop... We're stocking autumn Seasonal Edition goodies, or something... Everything here will be available to purchase during the Fall Festival event each year, but we're only open until October 31... I guess you should to stock up now, or you'll have to wait... and wait... and wait... *sigh*", "seasonalShopBrokenText": "My pavilion!!!!!!! My decorations!!!! Oh, the Dysheartener's destroyed everything :( Please help defeat it in the Tavern so I can rebuild!", "seasonalShopRebirth": "If you bought any of this equipment in the past but don't currently own it, you can repurchase it in the Rewards Column. Initially, you'll only be able to purchase the items for your current class (Warrior by default), but fear not, the other class-specific items will become available if you switch to that class.", diff --git a/website/common/script/content/spells.js b/website/common/script/content/spells.js index 495b1f07e1..f208c519a1 100644 --- a/website/common/script/content/spells.js +++ b/website/common/script/content/spells.js @@ -1,4 +1,5 @@ import each from 'lodash/each'; +import moment from 'moment'; import t from './translation'; import { NotAuthorized, BadRequest } from '../libs/errors'; import statsComputed from '../libs/statsComputed'; // eslint-disable-line import/no-cycle @@ -287,6 +288,9 @@ spells.special = { previousPurchase: true, target: 'user', notes: t('spellSpecialSnowballAuraNotes'), + canOwn () { + return false; + }, cast (user, target, req) { if (!user.items.special.snowball) throw new NotAuthorized(t('spellNotOwned')(req.language)); target.stats.buffs.snowball = true; @@ -320,6 +324,9 @@ spells.special = { previousPurchase: true, target: 'user', notes: t('spellSpecialSpookySparklesNotes'), + canOwn () { + return false; + }, cast (user, target, req) { if (!user.items.special.spookySparkles) throw new NotAuthorized(t('spellNotOwned')(req.language)); target.stats.buffs.snowball = false; @@ -354,6 +361,9 @@ spells.special = { target: 'user', notes: t('spellSpecialShinySeedNotes'), event: EVENTS.spring2021, + canOwn () { + return moment().isBetween('2021-04-06T08:00-05:00', EVENTS.spring2021.end); + }, cast (user, target, req) { if (!user.items.special.shinySeed) throw new NotAuthorized(t('spellNotOwned')(req.language)); target.stats.buffs.snowball = false; @@ -387,6 +397,9 @@ spells.special = { previousPurchase: true, target: 'user', notes: t('spellSpecialSeafoamNotes'), + canOwn () { + return false; + }, cast (user, target, req) { if (!user.items.special.seafoam) throw new NotAuthorized(t('spellNotOwned')(req.language)); target.stats.buffs.snowball = false; @@ -421,6 +434,9 @@ spells.special = { silent: true, target: 'user', notes: t('nyeCardNotes'), + canOwn () { + return false; + }, cast (user, target) { if (user === target) { if (!user.achievements.nye) user.achievements.nye = 0; @@ -458,6 +474,9 @@ spells.special = { silent: true, target: 'user', notes: t('valentineCardNotes'), + canOwn () { + return false; + }, cast (user, target) { if (user === target) { if (!user.achievements.valentine) user.achievements.valentine = 0; diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js index 41d0cd466d..397506381a 100644 --- a/website/common/script/libs/shops.js +++ b/website/common/script/libs/shops.js @@ -157,6 +157,7 @@ shops.getMarketGearCategories = function getMarketGear (user, language) { if ( gearItem.specialClass === classType && user.items.gear.owned[gearItem.key] !== false + && gearItem.set === seasonalShopConfig.pinnedSets[gearItem.specialClass] ) return gearItem.canOwn(classShift); return false; });