mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix(content): item type handling
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
"mustPurchaseToSet": "Must purchase <%= val %> to set it on <%= key %>.",
|
||||
"typeRequired": "Type is required",
|
||||
"keyRequired": "Key is required",
|
||||
"notAccteptedType": "Type must be in [eggs, hatchingPotions, food, quests, gear]",
|
||||
"notAccteptedType": "Type must be in [eggs, hatchingPotions, premiumHatchingPotions, food, quests, gear]",
|
||||
"contentKeyNotFound": "Key not found for Content <%= type %>",
|
||||
"plusOneGem": "+1 Gem",
|
||||
"typeNotSellable": "Type is not sellable. Must be one of the following <%= acceptedTypes %>",
|
||||
|
||||
@@ -48,6 +48,7 @@ export const ITEM_LIST = {
|
||||
headAccessory: { localeKey: 'headAccessory', isEquipment: true },
|
||||
eyewear: { localeKey: 'eyewear', isEquipment: true },
|
||||
hatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false },
|
||||
premiumHatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false },
|
||||
eggs: { localeKey: 'eggSingular', isEquipment: false },
|
||||
quests: { localeKey: 'quest', isEquipment: false },
|
||||
food: { localeKey: 'foodText', isEquipment: false },
|
||||
|
||||
@@ -59,7 +59,7 @@ shops.getMarketCategories = function getMarket (user, language) {
|
||||
categories.push(hatchingPotionsCategory);
|
||||
|
||||
let premiumHatchingPotionsCategory = {
|
||||
identifier: 'magicHatchingPotions',
|
||||
identifier: 'premiumHatchingPotions',
|
||||
text: i18n.t('magicHatchingPotions', language),
|
||||
notes: i18n.t('premiumPotionNoDropExplanation', language),
|
||||
};
|
||||
|
||||
@@ -60,10 +60,11 @@ module.exports = function purchase (user, req = {}, analytics) {
|
||||
];
|
||||
}
|
||||
|
||||
let acceptedTypes = ['eggs', 'hatchingPotions', 'food', 'quests', 'gear'];
|
||||
let acceptedTypes = ['eggs', 'hatchingPotions', 'premiumHatchingPotions', 'food', 'quests', 'gear'];
|
||||
if (acceptedTypes.indexOf(type) === -1) {
|
||||
throw new NotFound(i18n.t('notAccteptedType', req.language));
|
||||
}
|
||||
if (type === 'premiumHatchingPotions') type = 'hatchingPotions';
|
||||
|
||||
if (type === 'gear') {
|
||||
item = content.gear.flat[key];
|
||||
|
||||
Reference in New Issue
Block a user