Add pets and egss as modules

This commit is contained in:
Blade Barringer
2015-09-21 08:57:35 -05:00
parent 1d4159ebf3
commit 9b8e6534d0
8 changed files with 159 additions and 82 deletions

View File

@@ -44,12 +44,15 @@
"dropEggBearCubAdjective": "cuddly",
"questEggGryphonText": "Gryphon",
"questEggGryphonMountText": "Gryphon",
"questEggGryphonAdjective": "proud",
"questEggHedgehogText": "Hedgehog",
"questEggHedgehogMountText": "Hedgehog",
"questEggHedgehogAdjective": "spiky",
"questEggDeerText": "Deer",
"questEggDeerMountText": "Deer",
"questEggDeerAdjective": "elegant",
"questEggEggText": "Egg",
@@ -57,54 +60,71 @@
"questEggEggAdjective": "colorful",
"questEggRatText": "Rat",
"questEggRatMountText": "Rat",
"questEggRatAdjective": "dirty",
"questEggOctopusText": "Octopus",
"questEggOctopusMountText": "Octopus",
"questEggOctopusAdjective": "slippery",
"questEggSeahorseText": "Seahorse",
"questEggSeahorseMountText": "Seahorse",
"questEggSeahorseAdjective": "prize",
"questEggParrotText": "Parrot",
"questEggParrotMountText": "Parrot",
"questEggParrotAdjective": "vibrant",
"questEggRoosterText": "Rooster",
"questEggRoosterMountText": "Rooster",
"questEggRoosterAdjective": "strutting",
"questEggSpiderText": "Spider",
"questEggSpiderMountText": "Spider",
"questEggSpiderAdjective": "creepy",
"questEggOwlText": "Owl",
"questEggOwlMountText": "Owl",
"questEggOwlAdjective": "wise",
"questEggPenguinText": "Penguin",
"questEggPenguinMountText": "Penguin",
"questEggPenguinAdjective": "perspicacious",
"questEggTRexText": "Tyrannosaur",
"questEggTRexMountText": "Tyrannosaur",
"questEggTRexAdjective": "tiny-armed",
"questEggRockText": "Rock",
"questEggRockMountText": "Rock",
"questEggRockAdjective": "lively",
"questEggBunnyText": "Bunny",
"questEggBunnyMountText": "Bunny",
"questEggBunnyAdjective": "snuggly",
"questEggSlimeText": "Marshmallow Slime",
"questEggSlimeMountText": "Marshmallow Slime",
"questEggSlimeAdjective": "sweet",
"questEggSheepText": "Sheep",
"questEggSheepMountText": "Sheep",
"questEggSheepAdjective": "woolly",
"questEggCuttlefishText": "Cuttlefish",
"questEggCuttlefishMountText": "Cuttlefish",
"questEggCuttlefishAdjective": "cuddly",
"questEggWhaleText": "Whale",
"questEggWhaleMountText": "Whale",
"questEggWhaleAdjective": "splashy",
"questEggCheetahText": "Cheetah",
"questEggCheetahMountText": "Cheetah",
"questEggCheetahAdjective": "honest",
"questEggHorseText": "Horse",
"questEggHorseMountText": "Horse",
"questEggHorseAdjective": "galloping",
"eggNotes": "Find a hatching potion to pour on this egg, and it will hatch into a <%= eggAdjective(locale) %> <%= eggText(locale) %>.",

View File

@@ -572,81 +572,27 @@ eggs = require('../../dist/scripts/content/eggs/index')
api.dropEggs = eggs.dropEggs
api.questEggs =
# value & other defaults set below
Gryphon: text: t('questEggGryphonText'), adjective: t('questEggGryphonAdjective'), canBuy: false
Hedgehog: text: t('questEggHedgehogText'), adjective: t('questEggHedgehogAdjective'), canBuy: false
Deer: text: t('questEggDeerText'), adjective: t('questEggDeerAdjective'), canBuy: false
Egg: text: t('questEggEggText'), adjective: t('questEggEggAdjective'), canBuy: false, mountText: t('questEggEggMountText')
Rat: text: t('questEggRatText'), adjective: t('questEggRatAdjective'), canBuy: false
Octopus: text: t('questEggOctopusText'), adjective: t('questEggOctopusAdjective'), canBuy: false
Seahorse: text: t('questEggSeahorseText'), adjective: t('questEggSeahorseAdjective'), canBuy: false
Parrot: text: t('questEggParrotText'), adjective: t('questEggParrotAdjective'), canBuy: false
Rooster: text: t('questEggRoosterText'), adjective: t('questEggRoosterAdjective'), canBuy: false
Spider: text: t('questEggSpiderText'), adjective: t('questEggSpiderAdjective'), canBuy: false
Owl: text: t('questEggOwlText'), adjective: t('questEggOwlAdjective'), canBuy: false
Penguin: text: t('questEggPenguinText'), adjective: t('questEggPenguinAdjective'), canBuy: false
TRex: text: t('questEggTRexText'), adjective: t('questEggTRexAdjective'), canBuy: false
Rock: text: t('questEggRockText'), adjective: t('questEggRockAdjective'), canBuy: false
Bunny: text: t('questEggBunnyText'), adjective: t('questEggBunnyAdjective'), canBuy: false
Slime: text: t('questEggSlimeText'), adjective: t('questEggSlimeAdjective'), canBuy: false
Sheep: text: t('questEggSheepText'), adjective: t('questEggSheepAdjective'), canBuy: false
Cuttlefish: text: t('questEggCuttlefishText'), adjective: t('questEggCuttlefishAdjective'), canBuy: false
Whale: text: t('questEggWhaleText'), adjective: t('questEggWhaleAdjective'), canBuy: false
Cheetah: text: t('questEggCheetahText'), adjective: t('questEggCheetahAdjective'), canBuy: false
Horse: text: t('questEggHorseText'), adjective: t('questEggHorseAdjective'), canBuy: false
api.questEggs = eggs.questEggs
_.each api.questEggs, (egg,key) ->
_.defaults egg,
canBuy:false
value: 3
key: key
notes: t('eggNotes', {eggText: egg.text, eggAdjective: egg.adjective})
mountText: egg.text
api.eggs = eggs.allEggs
api.eggs = _.assign(_.cloneDeep(api.dropEggs), api.questEggs)
pets_mounts = require('../../dist/scripts/content/pets-mounts/index')
# special pets & mounts are {key:i18n}
api.specialPets =
'Wolf-Veteran': 'veteranWolf'
'Wolf-Cerberus': 'cerberusPup'
'Dragon-Hydra': 'hydra'
'Turkey-Base': 'turkey'
'BearCub-Polar': 'polarBearPup'
'MantisShrimp-Base': 'mantisShrimp'
'JackOLantern-Base': 'jackolantern'
'Mammoth-Base': 'mammoth'
'Tiger-Veteran': 'veteranTiger'
api.specialPets = pets_mounts.specialPets
api.specialMounts =
'BearCub-Polar': 'polarBear'
'LionCub-Ethereal': 'etherealLion'
'MantisShrimp-Base': 'mantisShrimp'
'Turkey-Base': 'turkey'
'Mammoth-Base': 'mammoth'
'Orca-Base': 'orca'
'Gryphon-RoyalPurple': 'royalPurpleGryphon'
api.specialMounts = pets_mounts.specialMounts
api.timeTravelStable = require('../../dist/scripts/content/time-traveler-stable')
api.hatchingPotions = require('../../dist/scripts/content/hatching-potions')
api.pets = _.transform api.dropEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
m2[egg.key + "-" + pot.key] = true
api.pets = pets_mounts.dropPets
api.questPets = _.transform api.questEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
m2[egg.key + "-" + pot.key] = true
api.questPets = pets_mounts.questPets
## added for mountmaster -- yes, the transforms are correct, since the same strings are used for both pets and mounts
api.mounts = _.transform api.dropEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
m2[egg.key + "-" + pot.key] = true
api.mounts = pets_mounts.dropMounts
api.questMounts = _.transform api.questEggs, (m, egg) ->
_.defaults m, _.transform api.hatchingPotions, (m2, pot) ->
m2[egg.key + "-" + pot.key] = true
api.questMounts = pets_mounts.questMounts
api.food = require('../../dist/scripts/content/food/index')

View File

@@ -1,4 +1,4 @@
import {each} from 'lodash';
import {each, defaults} from 'lodash';
import t from '../helpers/translator';
const DROP_EGGS = [
@@ -23,4 +23,16 @@ each(DROP_EGGS, (pet) => {
}
});
each(eggs, (egg, key) => {
return defaults(egg, {
canBuy: true,
value: 3,
key: key,
notes: t('eggNotes', {
eggText: egg.text,
eggAdjective: egg.adjective
}),
});
});
export default eggs;

View File

@@ -1,23 +1,15 @@
// value & other defaults set below
let each = require('lodash').each;
let defaults = require('lodash').defaults;
let t = require('../helpers/translator');
import {assign} from 'lodash';
let dropEggs = require('./drops');
import dropEggs from './drops';
import questEggs from './quest';
each(dropEggs, (egg, key) => {
return defaults(egg, {
canBuy: true,
value: 3,
key: key,
notes: t('eggNotes', {
eggText: egg.text,
eggAdjective: egg.adjective
}),
mountText: egg.text
});
});
let allEggs = {};
assign(allEggs, dropEggs);
assign(allEggs, questEggs);
export default {
dropEggs: dropEggs
allEggs: allEggs,
dropEggs: dropEggs,
questEggs: questEggs,
}

View File

@@ -0,0 +1,50 @@
import {each, defaults} from 'lodash';
import t from '../helpers/translator';
const QUEST_EGGS = [
'Gryphon',
'Hedgehog',
'Deer',
'Egg',
'Rat',
'Octopus',
'Seahorse',
'Parrot',
'Rooster',
'Spider',
'Owl',
'Penguin',
'TRex',
'Rock',
'Bunny',
'Slime',
'Sheep',
'Cuttlefish',
'Whale',
'Cheetah',
'Horse',
];
let eggs = { };
each(QUEST_EGGS, (pet) => {
eggs[pet] = {
text: t(`questEgg${pet}Text`),
mountText: t(`questEgg${pet}MountText`),
adjective: t(`questEgg${pet}Adjective`),
}
});
each(eggs, (egg, key) => {
return defaults(egg, {
canBuy: false,
value: 3,
key: key,
notes: t('eggNotes', {
eggText: egg.text,
eggAdjective: egg.adjective
}),
});
});
export default eggs;

View File

@@ -0,0 +1,29 @@
import {transform, defaults} from 'lodash';
import hatchingPotions from '../hatching-potions';
import dropEggs from '../eggs/drops';
import questEggs from '../eggs/quest';
import specialPets from './special-pets';
import specialMounts from './special-mounts';
let dropPets = generateAnimalSet(dropEggs);
let questPets = generateAnimalSet(questEggs);
let dropMounts = generateAnimalSet(dropEggs);
let questMounts = generateAnimalSet(questEggs);
function generateAnimalSet(set) {
return transform(set, function(m, egg) {
defaults(m, transform(hatchingPotions, function(m2, pot) {
return m2[egg.key + "-" + pot.key] = true;
}));
});
}
export default {
dropPets: dropPets,
dropMounts: dropMounts,
questPets: questPets,
questMounts: questMounts,
specialPets: specialPets,
specialMounts: specialMounts,
}

View File

@@ -0,0 +1,13 @@
// special mounts are {key:i18n}
let specialMounts = {
'BearCub-Polar': 'polarBear',
'LionCub-Ethereal': 'etherealLion',
'MantisShrimp-Base': 'mantisShrimp',
'Turkey-Base': 'turkey',
'Mammoth-Base': 'mammoth',
'Orca-Base': 'orca',
'Gryphon-RoyalPurple': 'royalPurpleGryphon',
}
export default specialMounts;

View File

@@ -0,0 +1,15 @@
// special mounts are {key:i18n}
let specialPets = {
'Wolf-Veteran': 'veteranWolf',
'Wolf-Cerberus': 'cerberusPup',
'Dragon-Hydra': 'hydra',
'Turkey-Base': 'turkey',
'BearCub-Polar': 'polarBearPup',
'MantisShrimp-Base': 'mantisShrimp',
'JackOLantern-Base': 'jackolantern',
'Mammoth-Base': 'mammoth',
'Tiger-Veteran': 'veteranTiger',
}
export default specialPets;