mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Implement new content schedule for magic hatching potions
This commit is contained in:
committed by
Sabe Jones
parent
f223b5dd2a
commit
129cb7627c
@@ -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