mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
WIP(shop): add timings to categories
This commit is contained in:
@@ -24,7 +24,7 @@ function inListMatcher (list) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [
|
export const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [
|
||||||
'animalSkins',
|
'animalSkins',
|
||||||
'rainbowSkins',
|
'rainbowSkins',
|
||||||
'rainbowHairColors',
|
'rainbowHairColors',
|
||||||
@@ -851,10 +851,10 @@ export function getScheduleMatchingGroup (type, date) {
|
|||||||
if (!cachedScheduleMatchers[matcher.type]) {
|
if (!cachedScheduleMatchers[matcher.type]) {
|
||||||
cachedScheduleMatchers[matcher.type] = makeMatcherClass();
|
cachedScheduleMatchers[matcher.type] = makeMatcherClass();
|
||||||
}
|
}
|
||||||
const end = moment(checkedDate);
|
let end = moment(checkedDate);
|
||||||
end.date(TYPE_SCHEDULE[type]);
|
end.date(TYPE_SCHEDULE[type]);
|
||||||
if (end.date() <= moment(checkedDate).date()) {
|
if (end.date() <= moment(checkedDate).date()) {
|
||||||
moment(end).add(1, 'months');
|
end = moment(end).add(1, 'months');
|
||||||
}
|
}
|
||||||
cachedScheduleMatchers[matcher.type].end = end.toDate();
|
cachedScheduleMatchers[matcher.type].end = end.toDate();
|
||||||
if (matcher.matcher instanceof Function) {
|
if (matcher.matcher instanceof Function) {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import isPinned from './isPinned';
|
|||||||
import isFreeRebirth from './isFreeRebirth';
|
import isFreeRebirth from './isFreeRebirth';
|
||||||
import getOfficialPinnedItems from './getOfficialPinnedItems';
|
import getOfficialPinnedItems from './getOfficialPinnedItems';
|
||||||
|
|
||||||
|
import { ALWAYS_AVAILABLE_CUSTOMIZATIONS } from '../content/constants/schedule';
|
||||||
|
|
||||||
function lockQuest (quest, user) {
|
function lockQuest (quest, user) {
|
||||||
// checks series quests, including Masterclasser
|
// checks series quests, including Masterclasser
|
||||||
if (quest.prereqQuests) {
|
if (quest.prereqQuests) {
|
||||||
@@ -490,7 +492,7 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang
|
|||||||
throw new BadRequest(i18n.t('wrongItemType', { type }, language));
|
throw new BadRequest(i18n.t('wrongItemType', { type }, language));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matcher) {
|
if (matcher && (!itemInfo.set || ALWAYS_AVAILABLE_CUSTOMIZATIONS.indexOf(itemInfo.set.key) === -1)) {
|
||||||
itemInfo.end = matcher.end;
|
itemInfo.end = matcher.end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -618,6 +618,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
hairStyle,
|
hairStyle,
|
||||||
officialPinnedItems,
|
officialPinnedItems,
|
||||||
language,
|
language,
|
||||||
|
hairType === 'color' ? customizationMatcher : null,
|
||||||
);
|
);
|
||||||
category.items.push(item);
|
category.items.push(item);
|
||||||
}
|
}
|
||||||
@@ -643,6 +644,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
|
|||||||
appearance,
|
appearance,
|
||||||
officialPinnedItems,
|
officialPinnedItems,
|
||||||
language,
|
language,
|
||||||
|
type === 'skin' ? customizationMatcher : null,
|
||||||
);
|
);
|
||||||
category.items.push(item);
|
category.items.push(item);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user