From 8b96e2ed1ad29ebfa66f9a1f62a7aa9697a15859 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 20 Sep 2015 07:46:30 -0500 Subject: [PATCH] Move hatching potions to separate module --- common/script/content/index.coffee | 14 +----- common/script/src/content/hatcing-potions.js | 48 ++++++++++++++++++++ 2 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 common/script/src/content/hatcing-potions.js diff --git a/common/script/content/index.coffee b/common/script/content/index.coffee index b5309f191a..a7eac79718 100644 --- a/common/script/content/index.coffee +++ b/common/script/content/index.coffee @@ -629,19 +629,7 @@ api.specialMounts = api.timeTravelStable = require('../../dist/scripts/content/time-traveler-stable') -api.hatchingPotions = - Base: value: 2, text: t('hatchingPotionBase') - White: value: 2, text: t('hatchingPotionWhite') - Desert: value: 2, text: t('hatchingPotionDesert') - Red: value: 3, text: t('hatchingPotionRed') - Shade: value: 3, text: t('hatchingPotionShade') - Skeleton: value: 3, text: t('hatchingPotionSkeleton') - Zombie: value: 4, text: t('hatchingPotionZombie') - CottonCandyPink: value: 4, text: t('hatchingPotionCottonCandyPink') - CottonCandyBlue: value: 4, text: t('hatchingPotionCottonCandyBlue') - Golden: value: 5, text: t('hatchingPotionGolden') -_.each api.hatchingPotions, (pot,key) -> - _.defaults pot, {key, value: 2, notes: t('hatchingPotionNotes', {potText: pot.text})} +api.hatchingPotions = require('../../dist/scripts/content/hatching-potions') api.pets = _.transform api.dropEggs, (m, egg) -> _.defaults m, _.transform api.hatchingPotions, (m2, pot) -> diff --git a/common/script/src/content/hatcing-potions.js b/common/script/src/content/hatcing-potions.js new file mode 100644 index 0000000000..77f0d96d81 --- /dev/null +++ b/common/script/src/content/hatcing-potions.js @@ -0,0 +1,48 @@ +import {each, defaults} from 'lodash'; +import t from '../helpers/translator'; + +let hatchingPotions = { + Base: { + value: 2, + }, + White: { + value: 2, + }, + Desert: { + value: 2, + }, + Red: { + value: 3, + }, + Shade: { + value: 3, + }, + Skeleton: { + value: 3, + }, + Zombie: { + value: 4, + }, + CottonCandyPink: { + value: 4, + }, + CottonCandyBlue: { + value: 4, + }, + Golden: { + value: 5, + } +}; + +each(hatchingPotions, function(potion, key) { + defaults(potion, { + key: key, + value: 2, + text: t(`hatchingPotion${key}`), + notes: t('hatchingPotionNotes', { + potText: potion.text + }), + }); +}); + +export default hatchingPotions;