mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Implement new content schedule for magic hatching potions
This commit is contained in:
committed by
Sabe Jones
parent
f223b5dd2a
commit
129cb7627c
@@ -67,6 +67,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Aurora',
|
||||
'Moonglow',
|
||||
'IcySnow',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
1: {
|
||||
@@ -106,6 +114,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'PolkaDot',
|
||||
'Cupid',
|
||||
'RoseGold',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
2: {
|
||||
@@ -144,6 +160,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Birch',
|
||||
'StainedGlass',
|
||||
'Porcelain',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
3: {
|
||||
@@ -183,6 +207,13 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Shimmer',
|
||||
'Glass',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
4: {
|
||||
@@ -221,6 +252,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Floral',
|
||||
'Fairy',
|
||||
'RoseQuartz',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
5: {
|
||||
@@ -266,6 +305,13 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Rainbow',
|
||||
'Sunshine',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
6: {
|
||||
@@ -311,6 +357,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Celestial',
|
||||
'SandCastle',
|
||||
'Watery',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
7: {
|
||||
@@ -350,6 +404,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Aquatic',
|
||||
'StarryNight',
|
||||
'Sunset',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
8: {
|
||||
@@ -389,6 +451,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Glow',
|
||||
'AutumnLeaf',
|
||||
'Shadow',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
9: {
|
||||
@@ -428,6 +498,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Vampire',
|
||||
'Ghost',
|
||||
'Spooky',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
10: {
|
||||
@@ -468,6 +546,14 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Ember',
|
||||
'Frost',
|
||||
'Thunderstorm',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
11: {
|
||||
@@ -502,6 +588,13 @@ export const MONTHLY_SCHEDULE = {
|
||||
},
|
||||
],
|
||||
[FOURTH_RELEASE_DAY]: [
|
||||
{
|
||||
type: 'premiumHatchingPotions',
|
||||
matcher: inListMatcher([
|
||||
'Peppermint',
|
||||
'Holly',
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -71,8 +71,10 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||
text: i18n.t('magicHatchingPotions', language),
|
||||
notes: i18n.t('premiumPotionNoDropExplanation', language),
|
||||
};
|
||||
const matchers = assembleScheduledMatchers(new Date()).filter(matcher => matcher.type === 'premiumHatchingPotions').map(matcher => matcher.matcher);
|
||||
premiumHatchingPotionsCategory.items = sortBy(values(content.hatchingPotions)
|
||||
.filter(hp => hp.limited && hp.canBuy(user))
|
||||
.filter(hp => hp.limited
|
||||
&& matchers.map(matcher => matcher(hp.key)).every(matcher => matcher === true))
|
||||
.map(premiumHatchingPotion => getItemInfo(user, 'premiumHatchingPotion', premiumHatchingPotion, officialPinnedItems, language)), 'key');
|
||||
if (premiumHatchingPotionsCategory.items.length > 0) {
|
||||
categories.push(premiumHatchingPotionsCategory);
|
||||
|
||||
@@ -101,7 +101,12 @@ export default async function purchase (user, req = {}, analytics) {
|
||||
|
||||
const { price, item } = getItemAndPrice(user, type, key, req);
|
||||
|
||||
if (!item.canBuy(user)) {
|
||||
if (item.type === 'hatchingPotion' && item.premium === true) {
|
||||
const matchers = assembleScheduledMatchers(new Date()).filter(matcher => matcher.type === 'premiumHatchingPotions').map(matcher => matcher.matcher);
|
||||
if (matchers.length && !matchers.some(matcher => matcher(item.key))) {
|
||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||
}
|
||||
} else if (!item.canBuy(user)) {
|
||||
throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user