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
This commit is contained in:
Sabe Jones
2021-04-09 15:14:18 -05:00
parent c349719303
commit 46b8e7f725
3 changed files with 24 additions and 4 deletions

View File

@@ -28,10 +28,10 @@
"seasonalShopClosedTitle": "<%= linkStart %>Leslie<%= linkEnd %>",
"seasonalShopTitle": "<%= linkStart %>Seasonal Sorceress<%= linkEnd %>",
"seasonalShopClosedText": "The Seasonal Shop is currently closed!! Its only open during Habiticas four Grand Galas.",
"seasonalShopSummerText": "Happy Summer Splash!! Would you like to buy some rare items? Theyll only be available until July 31st!",
"seasonalShopFallText": "Happy Fall Festival!! Would you like to buy some rare items? Theyll only be available until October 31st!",
"seasonalShopWinterText": "Happy Winter Wonderland!! Would you like to buy some rare items? Theyll only be available until January 31st!",
"seasonalShopSpringText": "Happy Spring Fling!! Would you like to buy some rare items? Theyll only be available until April 30th!",
"seasonalShopSummerText": "Happy Summer Splash!! Would you like to buy some rare items? Theyll only be available during the Gala!",
"seasonalShopFallText": "Happy Fall Festival!! Would you like to buy some rare items? Theyll only be available during the Gala!",
"seasonalShopWinterText": "Happy Winter Wonderland!! Would you like to buy some rare items? Theyll only be available during the Gala!",
"seasonalShopSpringText": "Happy Spring Fling!! Would you like to buy some rare items? Theyll 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... <strong>*sigh*</strong>",
"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.",

View File

@@ -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;

View File

@@ -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;
});