mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Add pets and egss as modules
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
50
common/script/src/content/eggs/quest.js
Normal file
50
common/script/src/content/eggs/quest.js
Normal 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;
|
||||
29
common/script/src/content/pets-mounts/index.js
Normal file
29
common/script/src/content/pets-mounts/index.js
Normal 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,
|
||||
}
|
||||
13
common/script/src/content/pets-mounts/special-mounts.js
Normal file
13
common/script/src/content/pets-mounts/special-mounts.js
Normal 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;
|
||||
15
common/script/src/content/pets-mounts/special-pets.js
Normal file
15
common/script/src/content/pets-mounts/special-pets.js
Normal 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;
|
||||
Reference in New Issue
Block a user