mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Implement new schedule system for seasonal shop
This commit is contained in:
committed by
Sabe Jones
parent
736ef16430
commit
db4bec37e3
@@ -46,35 +46,35 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'nudibranch',
|
'nudibranch',
|
||||||
'seaserpent',
|
'seaserpent',
|
||||||
'gryphon',
|
'gryphon',
|
||||||
'yarn',
|
'yarn',
|
||||||
'axolotl',
|
'axolotl',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'silver',
|
'silver',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'winterQuests',
|
'winterQuests',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Aurora',
|
'Aurora',
|
||||||
'Moonglow',
|
'Moonglow',
|
||||||
'IcySnow',
|
'IcySnow',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -94,34 +94,34 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'rooster',
|
'rooster',
|
||||||
'slime',
|
'slime',
|
||||||
'peacock',
|
'peacock',
|
||||||
'bunny',
|
'bunny',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'pinkMarble',
|
'pinkMarble',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'cuddleBuddies',
|
'cuddleBuddies',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'PolkaDot',
|
'PolkaDot',
|
||||||
'Cupid',
|
'Cupid',
|
||||||
'RoseGold',
|
'RoseGold',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -141,33 +141,33 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'frog',
|
'frog',
|
||||||
'spider',
|
'spider',
|
||||||
'cow',
|
'cow',
|
||||||
'pterodactyl',
|
'pterodactyl',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'birdBuddies',
|
'birdBuddies',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Birch',
|
'Birch',
|
||||||
'StainedGlass',
|
'StainedGlass',
|
||||||
'Porcelain',
|
'Porcelain',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -187,33 +187,33 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'snake',
|
'snake',
|
||||||
'monkey',
|
'monkey',
|
||||||
'falcon',
|
'falcon',
|
||||||
'aligator',
|
'aligator',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'mossyStone',
|
'mossyStone',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'hugabug',
|
'hugabug',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Shimmer',
|
'Shimmer',
|
||||||
'Glass',
|
'Glass',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -233,33 +233,33 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'octopus',
|
'octopus',
|
||||||
'horse',
|
'horse',
|
||||||
'kraken',
|
'kraken',
|
||||||
'sloth',
|
'sloth',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'splashyPals',
|
'splashyPals',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Floral',
|
'Floral',
|
||||||
'Fairy',
|
'Fairy',
|
||||||
'RoseQuartz',
|
'RoseQuartz',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -279,39 +279,39 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'trex',
|
'trex',
|
||||||
'unicorn',
|
'unicorn',
|
||||||
'veolociraptor',
|
'veolociraptor',
|
||||||
'hippo',
|
'hippo',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'turquiose',
|
'turquiose',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'rockingReptiles',
|
'rockingReptiles',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'delightfulDinos',
|
'delightfulDinos',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Rainbow',
|
'Rainbow',
|
||||||
'Sunshine',
|
'Sunshine',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -331,40 +331,40 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'whale',
|
'whale',
|
||||||
'seahorse',
|
'seahorse',
|
||||||
'armadillo',
|
'armadillo',
|
||||||
'guineapig',
|
'guineapig',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'fluorite',
|
'fluorite',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'winterQuests',
|
'winterQuests',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'aquaticAmigos',
|
'aquaticAmigos',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Celestial',
|
'Celestial',
|
||||||
'SandCastle',
|
'SandCastle',
|
||||||
'Watery',
|
'Watery',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -384,34 +384,34 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'turtle',
|
'turtle',
|
||||||
'penguin',
|
'penguin',
|
||||||
'butterfly',
|
'butterfly',
|
||||||
'cheetah',
|
'cheetah',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'blackPearl',
|
'blackPearl',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'featheredFriends',
|
'featheredFriends',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Aquatic',
|
'Aquatic',
|
||||||
'StarryNight',
|
'StarryNight',
|
||||||
'Sunset',
|
'Sunset',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -431,34 +431,34 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'squirrel',
|
'squirrel',
|
||||||
'triceratops',
|
'triceratops',
|
||||||
'treeling',
|
'treeling',
|
||||||
'beetle',
|
'beetle',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'bronze',
|
'bronze',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'farmFriends',
|
'farmFriends',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Glow',
|
'Glow',
|
||||||
'AutumnLeaf',
|
'AutumnLeaf',
|
||||||
'Shadow',
|
'Shadow',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -478,34 +478,34 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'snail',
|
'snail',
|
||||||
'rock',
|
'rock',
|
||||||
'ferret',
|
'ferret',
|
||||||
'hedgehog',
|
'hedgehog',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'onyx',
|
'onyx',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'witchyFamiliars',
|
'witchyFamiliars',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Vampire',
|
'Vampire',
|
||||||
'Ghost',
|
'Ghost',
|
||||||
'Spooky',
|
'Spooky',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -525,35 +525,35 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'sheep',
|
'sheep',
|
||||||
'kangaroo',
|
'kangaroo',
|
||||||
'owl',
|
'owl',
|
||||||
'rat',
|
'rat',
|
||||||
'badger',
|
'badger',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'amber',
|
'amber',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'bundles',
|
type: 'bundles',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'forestFriends',
|
'forestFriends',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Ember',
|
'Ember',
|
||||||
'Frost',
|
'Frost',
|
||||||
'Thunderstorm',
|
'Thunderstorm',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -573,28 +573,28 @@ export const MONTHLY_SCHEDULE = {
|
|||||||
[THIRD_RELEASE_DAY]: [
|
[THIRD_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'petQuests',
|
type: 'petQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'ghost_stag',
|
'ghost_stag',
|
||||||
'trex_undead',
|
'trex_undead',
|
||||||
'harpy',
|
'harpy',
|
||||||
'sabretooth',
|
'sabretooth',
|
||||||
'dolphin',
|
'dolphin',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'hatchingPotionQuests',
|
type: 'hatchingPotionQuests',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'ruby',
|
'ruby',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[FOURTH_RELEASE_DAY]: [
|
[FOURTH_RELEASE_DAY]: [
|
||||||
{
|
{
|
||||||
type: 'premiumHatchingPotions',
|
type: 'premiumHatchingPotions',
|
||||||
matcher: inListMatcher([
|
items: [
|
||||||
'Peppermint',
|
'Peppermint',
|
||||||
'Holly',
|
'Holly',
|
||||||
]),
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -605,25 +605,56 @@ export const GALA_SCHEDULE = {
|
|||||||
0: [
|
0: [
|
||||||
{
|
{
|
||||||
type: 'seasonalGear',
|
type: 'seasonalGear',
|
||||||
matcher: inListMatcher(SEASONAL_SETS.winter),
|
items: SEASONAL_SETS.winter,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seasonalSpells',
|
||||||
|
items: [
|
||||||
|
'snowball',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seasonalQuests',
|
||||||
|
items: [
|
||||||
|
'evilsanta',
|
||||||
|
'evilsanta2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
1: [
|
1: [
|
||||||
{
|
{
|
||||||
type: 'seasonalGear',
|
type: 'seasonalGear',
|
||||||
matcher: inListMatcher(SEASONAL_SETS.spring),
|
items: SEASONAL_SETS.spring,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seasonalSpells',
|
||||||
|
items: [
|
||||||
|
'shinySeed',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
2: [
|
2: [
|
||||||
{
|
{
|
||||||
type: 'seasonalGear',
|
type: 'seasonalGear',
|
||||||
matcher: inListMatcher(SEASONAL_SETS.fall),
|
items: SEASONAL_SETS.fall,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seasonalSpells',
|
||||||
|
items: [
|
||||||
|
'spookySparkles',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
3: [
|
3: [
|
||||||
{
|
{
|
||||||
type: 'seasonalGear',
|
type: 'seasonalGear',
|
||||||
matcher: inListMatcher(SEASONAL_SETS.summer),
|
items: SEASONAL_SETS.summer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'seasonalSpells',
|
||||||
|
items: [
|
||||||
|
'seafoam',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@@ -659,17 +690,35 @@ export function getScheduleMatchingGroup (type, date) {
|
|||||||
if (!cachedScheduleMatchers) {
|
if (!cachedScheduleMatchers) {
|
||||||
cachedScheduleMatchers = {};
|
cachedScheduleMatchers = {};
|
||||||
assembleScheduledMatchers(date !== undefined ? date : new Date()).forEach(matcher => {
|
assembleScheduledMatchers(date !== undefined ? date : new Date()).forEach(matcher => {
|
||||||
if (cachedScheduleMatchers[matcher.type]) {
|
if (!cachedScheduleMatchers[matcher.type]) {
|
||||||
cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher);
|
|
||||||
} else {
|
|
||||||
cachedScheduleMatchers[matcher.type] = {
|
cachedScheduleMatchers[matcher.type] = {
|
||||||
matchers: [matcher.matcher],
|
matchers: [],
|
||||||
|
items: [],
|
||||||
match (key) {
|
match (key) {
|
||||||
|
if (this.items.length > 0 && !inListMatcher(this.items)(key)) {
|
||||||
|
console.log(this.items);
|
||||||
|
console.log(key, 'not in list');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log(this.matchers.every(m => m(key)));
|
||||||
return this.matchers.every(m => m(key));
|
return this.matchers.every(m => m(key));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (matcher.matcher instanceof Function) {
|
||||||
|
cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher);
|
||||||
|
} else if (matcher.items instanceof Array) {
|
||||||
|
cachedScheduleMatchers[matcher.type].items.push(...matcher.items);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!cachedScheduleMatchers[type]) {
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
match () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
return cachedScheduleMatchers[type];
|
return cachedScheduleMatchers[type];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,19 +474,15 @@ shops.getSeasonalShop = function getSeasonalShop (user, language) {
|
|||||||
shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language) {
|
shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, language) {
|
||||||
const officialPinnedItems = getOfficialPinnedItems(user);
|
const officialPinnedItems = getOfficialPinnedItems(user);
|
||||||
|
|
||||||
const AVAILABLE_SPELLS = [
|
const spellMatcher = getScheduleMatchingGroup('seasonalSpells');
|
||||||
...seasonalShopConfig.availableSpells,
|
const questMatcher = getScheduleMatchingGroup('seasonalQuests');
|
||||||
];
|
const gearMatcher = getScheduleMatchingGroup('seasonalGear');
|
||||||
|
|
||||||
const AVAILABLE_QUESTS = [
|
|
||||||
...seasonalShopConfig.availableQuests,
|
|
||||||
];
|
|
||||||
|
|
||||||
const categories = [];
|
const categories = [];
|
||||||
|
|
||||||
const spells = pickBy(
|
const spells = pickBy(
|
||||||
content.spells.special,
|
content.spells.special,
|
||||||
(spell, key) => AVAILABLE_SPELLS.indexOf(key) !== -1,
|
(spell, key) => spellMatcher.match(key),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (keys(spells).length > 0) {
|
if (keys(spells).length > 0) {
|
||||||
@@ -503,7 +499,7 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang
|
|||||||
categories.push(category);
|
categories.push(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
const quests = pickBy(content.quests, (quest, key) => AVAILABLE_QUESTS.indexOf(key) !== -1);
|
const quests = pickBy(content.quests, (quest, key) => questMatcher.match(key));
|
||||||
|
|
||||||
if (keys(quests).length > 0) {
|
if (keys(quests).length > 0) {
|
||||||
const category = {
|
const category = {
|
||||||
@@ -516,7 +512,7 @@ shops.getSeasonalShopCategories = function getSeasonalShopCategories (user, lang
|
|||||||
categories.push(category);
|
categories.push(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const set of seasonalShopConfig.availableSets) {
|
for (const set of gearMatcher.items) {
|
||||||
const category = {
|
const category = {
|
||||||
identifier: set,
|
identifier: set,
|
||||||
text: i18n.t(set),
|
text: i18n.t(set),
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ export default async function purchase (user, req = {}, analytics) {
|
|||||||
if (!matchers.match(item.key)) {
|
if (!matchers.match(item.key)) {
|
||||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||||
}
|
}
|
||||||
|
} else if (item.event && item.event.gear) {
|
||||||
|
const matchers = getScheduleMatchingGroup('seasonalGear');
|
||||||
|
console.log(matchers);
|
||||||
|
if (!matchers.match(item.set)) {
|
||||||
|
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||||
|
}
|
||||||
} else if (!item.canBuy(user)) {
|
} else if (!item.canBuy(user)) {
|
||||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user