mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Implement schedule for quest bundles
This commit is contained in:
committed by
Sabe Jones
parent
b3521be629
commit
f223b5dd2a
@@ -265,14 +265,18 @@ shops.getQuestShopCategories = function getQuestShopCategories (user, language)
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
const scheduledMatchers = assembleScheduledMatchers(new Date());
|
||||
|
||||
const bundleCategory = {
|
||||
identifier: 'bundle',
|
||||
text: i18n.t('questBundles', language),
|
||||
};
|
||||
|
||||
const bundleMatchers = scheduledMatchers.filter(matcher => matcher.type === 'bundles').map(matcher => matcher.matcher);
|
||||
console.log(bundleMatchers);
|
||||
bundleCategory.items = sortBy(values(content.bundles)
|
||||
.filter(bundle => bundle.type === 'quests' && bundle.canBuy())
|
||||
.filter(bundle => bundle.type === 'quests'
|
||||
&& bundleMatchers.map(matcher => matcher(bundle.key)).every(matcher => matcher === true))
|
||||
.map(bundle => getItemInfo(user, 'bundles', bundle, officialPinnedItems, language)));
|
||||
|
||||
if (bundleCategory.items.length > 0) {
|
||||
@@ -289,7 +293,7 @@ shops.getQuestShopCategories = function getQuestShopCategories (user, language)
|
||||
.filter(quest => quest.canBuy(user) && quest.category === type);
|
||||
|
||||
if (type === 'pet' || type === 'hatchingPotion') {
|
||||
const matchers = assembleScheduledMatchers(new Date())
|
||||
const matchers = scheduledMatchers
|
||||
.filter(matcher => matcher.type === `${type}Quests`).map(matcher => matcher.matcher);
|
||||
filteredQuests = filteredQuests.filter(quest => matchers.map(matcher => matcher(quest.key))
|
||||
.every(matcher => matcher === true));
|
||||
|
||||
Reference in New Issue
Block a user