fix(content): item type handling

This commit is contained in:
Sabe Jones
2016-08-10 05:18:30 +00:00
parent 0d1bff5dda
commit 64c8e4d16d
4 changed files with 5 additions and 3 deletions

View File

@@ -35,7 +35,7 @@
"mustPurchaseToSet": "Must purchase <%= val %> to set it on <%= key %>.", "mustPurchaseToSet": "Must purchase <%= val %> to set it on <%= key %>.",
"typeRequired": "Type is required", "typeRequired": "Type is required",
"keyRequired": "Key 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 %>", "contentKeyNotFound": "Key not found for Content <%= type %>",
"plusOneGem": "+1 Gem", "plusOneGem": "+1 Gem",
"typeNotSellable": "Type is not sellable. Must be one of the following <%= acceptedTypes %>", "typeNotSellable": "Type is not sellable. Must be one of the following <%= acceptedTypes %>",

View File

@@ -48,6 +48,7 @@ export const ITEM_LIST = {
headAccessory: { localeKey: 'headAccessory', isEquipment: true }, headAccessory: { localeKey: 'headAccessory', isEquipment: true },
eyewear: { localeKey: 'eyewear', isEquipment: true }, eyewear: { localeKey: 'eyewear', isEquipment: true },
hatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false }, hatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false },
premiumHatchingPotions: { localeKey: 'hatchingPotion', isEquipment: false },
eggs: { localeKey: 'eggSingular', isEquipment: false }, eggs: { localeKey: 'eggSingular', isEquipment: false },
quests: { localeKey: 'quest', isEquipment: false }, quests: { localeKey: 'quest', isEquipment: false },
food: { localeKey: 'foodText', isEquipment: false }, food: { localeKey: 'foodText', isEquipment: false },

View File

@@ -59,7 +59,7 @@ shops.getMarketCategories = function getMarket (user, language) {
categories.push(hatchingPotionsCategory); categories.push(hatchingPotionsCategory);
let premiumHatchingPotionsCategory = { let premiumHatchingPotionsCategory = {
identifier: 'magicHatchingPotions', identifier: 'premiumHatchingPotions',
text: i18n.t('magicHatchingPotions', language), text: i18n.t('magicHatchingPotions', language),
notes: i18n.t('premiumPotionNoDropExplanation', language), notes: i18n.t('premiumPotionNoDropExplanation', language),
}; };

View File

@@ -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) { if (acceptedTypes.indexOf(type) === -1) {
throw new NotFound(i18n.t('notAccteptedType', req.language)); throw new NotFound(i18n.t('notAccteptedType', req.language));
} }
if (type === 'premiumHatchingPotions') type = 'hatchingPotions';
if (type === 'gear') { if (type === 'gear') {
item = content.gear.flat[key]; item = content.gear.flat[key];