mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Merge branch 'develop' into refactor-content
This commit is contained in:
@@ -12,6 +12,15 @@ const DROP_EGGS = [
|
||||
'BearCub',
|
||||
];
|
||||
|
||||
let eggs = generateEggs(DROP_EGGS, {type: 'drop', canBuy: true});
|
||||
let eggDefaults = {
|
||||
type: 'drop',
|
||||
canBuy: () => {
|
||||
return () => {
|
||||
return true;
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
let eggs = generateEggs(DROP_EGGS, eggDefaults);
|
||||
|
||||
export default eggs;
|
||||
|
||||
@@ -24,6 +24,41 @@ const QUEST_EGGS = [
|
||||
'Horse',
|
||||
];
|
||||
|
||||
let eggs = generateEggs(QUEST_EGGS, {type: 'quest', canBuy: false});
|
||||
let eggDefaults = {
|
||||
type: 'quest',
|
||||
canBuy: (key) => {
|
||||
return _generateQuestAchievementRequirement(key);
|
||||
},
|
||||
};
|
||||
|
||||
let eggs = generateEggs(QUEST_EGGS, eggDefaults);
|
||||
|
||||
// Exceptions to normal defaults
|
||||
eggs.TRex.canBuy = (user) => {
|
||||
let achievements = user.achievements.quests;
|
||||
|
||||
if (achievements) {
|
||||
return achievements.trex > 0 ||
|
||||
achievements.trex_undead > 0;
|
||||
}
|
||||
}
|
||||
|
||||
eggs.Deer.canBuy = _generateQuestAchievementRequirement('ghost_stag');
|
||||
eggs.Seahorse.canBuy = _generateQuestAchievementRequirement('dilatory_derby');
|
||||
eggs.Parrot.canBuy = _generateQuestAchievementRequirement('harpy');
|
||||
eggs.Cuttlefish.canBuy = _generateQuestAchievementRequirement('kraken');
|
||||
|
||||
eggs.Egg.canBuy = () => { return false; }
|
||||
|
||||
function _generateQuestAchievementRequirement(name) {
|
||||
return (user) => {
|
||||
let achievements = user.achievements.quests;
|
||||
let questKey = name.toLowerCase();
|
||||
|
||||
if (achievements) {
|
||||
return achievements[questKey] > 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default eggs;
|
||||
|
||||
@@ -194,7 +194,29 @@ let head = {
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.head_armoire_plagueDoctorHat != null;
|
||||
})
|
||||
}
|
||||
},
|
||||
blackCat: {
|
||||
notes: t('headArmoireBlackCatNotes', {
|
||||
attrs: 9
|
||||
}),
|
||||
value: 100,
|
||||
int: 9,
|
||||
per: 9,
|
||||
canOwn: (function(u) {
|
||||
return u.items.gear.owned.head_armoire_blackCat != null;
|
||||
})
|
||||
},
|
||||
orangeCat: {
|
||||
notes: t('headArmoireOrangeCatNotes', {
|
||||
attrs: 9
|
||||
}),
|
||||
value: 100,
|
||||
con: 9,
|
||||
str: 9,
|
||||
canOwn: (function(u) {
|
||||
return u.items.gear.owned.head_armoire_orangeCat != null;
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
let shield = {
|
||||
@@ -279,6 +301,14 @@ let weapon = {
|
||||
canOwn: (function(u) {
|
||||
return u.items.gear.owned.weapon_armoire_goldWingStaff != null;
|
||||
})
|
||||
},
|
||||
batWand: {
|
||||
value: 100,
|
||||
int: 10,
|
||||
per: 2,
|
||||
canOwn: (function(u) {
|
||||
return u.items.gear.owned.weapon_armoire_batWand != null;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -126,24 +126,28 @@ let armor = {
|
||||
event: events.fall,
|
||||
specialClass: 'rogue',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
per: 15
|
||||
},
|
||||
fallWarrior: {
|
||||
event: events.fall,
|
||||
specialClass: 'warrior',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
con: 9
|
||||
},
|
||||
fallMage: {
|
||||
event: events.fall,
|
||||
specialClass: 'wizard',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
int: 9
|
||||
},
|
||||
fallHealer: {
|
||||
event: events.fall,
|
||||
specialClass: 'healer',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
con: 15
|
||||
},
|
||||
winter2015Rogue: {
|
||||
@@ -453,24 +457,28 @@ let head = {
|
||||
event: events.fall,
|
||||
specialClass: 'rogue',
|
||||
value: 60,
|
||||
canBuy: () => { return true; },
|
||||
per: 9
|
||||
},
|
||||
fallWarrior: {
|
||||
event: events.fall,
|
||||
specialClass: 'warrior',
|
||||
value: 60,
|
||||
canBuy: () => { return true; },
|
||||
str: 9
|
||||
},
|
||||
fallMage: {
|
||||
event: events.fall,
|
||||
specialClass: 'wizard',
|
||||
value: 60,
|
||||
canBuy: () => { return true; },
|
||||
per: 7
|
||||
},
|
||||
fallHealer: {
|
||||
event: events.fall,
|
||||
specialClass: 'healer',
|
||||
value: 60,
|
||||
canBuy: () => { return true; },
|
||||
int: 7
|
||||
},
|
||||
winter2015Rogue: {
|
||||
@@ -627,6 +635,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryBearEarsText'),
|
||||
notes: t('headAccessoryBearEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_bearEars != null;
|
||||
})
|
||||
@@ -636,6 +645,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryCactusEarsText'),
|
||||
notes: t('headAccessoryCactusEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_cactusEars != null;
|
||||
})
|
||||
@@ -645,6 +655,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryFoxEarsText'),
|
||||
notes: t('headAccessoryFoxEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_foxEars != null;
|
||||
})
|
||||
@@ -654,6 +665,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryLionEarsText'),
|
||||
notes: t('headAccessoryLionEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_lionEars != null;
|
||||
})
|
||||
@@ -663,6 +675,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryPandaEarsText'),
|
||||
notes: t('headAccessoryPandaEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_pandaEars != null;
|
||||
})
|
||||
@@ -672,6 +685,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryPigEarsText'),
|
||||
notes: t('headAccessoryPigEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_pigEars != null;
|
||||
})
|
||||
@@ -681,6 +695,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryTigerEarsText'),
|
||||
notes: t('headAccessoryTigerEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_tigerEars != null;
|
||||
})
|
||||
@@ -690,6 +705,7 @@ let headAccessory = {
|
||||
text: t('headAccessoryWolfEarsText'),
|
||||
notes: t('headAccessoryWolfEarsNotes'),
|
||||
value: 20,
|
||||
canBuy: () => { return true; },
|
||||
canOwn: ((u) => {
|
||||
return u.items.gear.owned.headAccessory_special_wolfEars != null;
|
||||
})
|
||||
@@ -799,18 +815,21 @@ let shield = {
|
||||
event: events.fall,
|
||||
specialClass: 'rogue',
|
||||
value: 80,
|
||||
canBuy: () => { return true; },
|
||||
str: 8
|
||||
},
|
||||
fallWarrior: {
|
||||
event: events.fall,
|
||||
specialClass: 'warrior',
|
||||
value: 70,
|
||||
canBuy: () => { return true; },
|
||||
con: 7
|
||||
},
|
||||
fallHealer: {
|
||||
event: events.fall,
|
||||
specialClass: 'healer',
|
||||
value: 70,
|
||||
canBuy: () => { return true; },
|
||||
con: 9
|
||||
},
|
||||
winter2015Rogue: {
|
||||
@@ -1036,12 +1055,14 @@ let weapon = {
|
||||
event: events.fall,
|
||||
specialClass: 'rogue',
|
||||
value: 80,
|
||||
canBuy: () => { return true; },
|
||||
str: 8
|
||||
},
|
||||
fallWarrior: {
|
||||
event: events.fall,
|
||||
specialClass: 'warrior',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
str: 15
|
||||
},
|
||||
fallMage: {
|
||||
@@ -1049,6 +1070,7 @@ let weapon = {
|
||||
specialClass: 'wizard',
|
||||
twoHanded: true,
|
||||
value: 160,
|
||||
canBuy: () => { return true; },
|
||||
int: 15,
|
||||
per: 7
|
||||
},
|
||||
@@ -1056,6 +1078,7 @@ let weapon = {
|
||||
event: events.fall,
|
||||
specialClass: 'healer',
|
||||
value: 90,
|
||||
canBuy: () => { return true; },
|
||||
int: 9
|
||||
},
|
||||
winter2015Rogue: {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {setHatchingPotionDefaults} from './helpers';
|
||||
import {
|
||||
merge,
|
||||
translator as t,
|
||||
setHatchingPotionDefaults
|
||||
} from './helpers';
|
||||
|
||||
let hatchingPotions = {
|
||||
let dropPotions = {
|
||||
Base: {
|
||||
value: 2,
|
||||
},
|
||||
@@ -30,9 +34,25 @@ let hatchingPotions = {
|
||||
},
|
||||
Golden: {
|
||||
value: 5,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
setHatchingPotionDefaults(hatchingPotions);
|
||||
let premiumPotions = {
|
||||
Spooky: {
|
||||
value: 2,
|
||||
addlNotes: t('premiumPotionAddlNotes'),
|
||||
premium: true,
|
||||
limited: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default hatchingPotions;
|
||||
setHatchingPotionDefaults(dropPotions);
|
||||
setHatchingPotionDefaults(premiumPotions);
|
||||
|
||||
let allPotions = merge([dropPotions, premiumPotions]);
|
||||
|
||||
export default {
|
||||
all: allPotions,
|
||||
drop: dropPotions,
|
||||
premium: premiumPotions,
|
||||
};
|
||||
|
||||
@@ -59,13 +59,14 @@ export function setSpellDefaults (className, spells) {
|
||||
export function setFoodDefaults(food, options={}) {
|
||||
each(food, (item, name) => {
|
||||
let formattedName = formatForTranslator(name);
|
||||
let canBuy = () => { return options.canBuy; };
|
||||
|
||||
defaults(item, {
|
||||
key: name,
|
||||
text: translator(`food${formattedName}`),
|
||||
notes: translator('foodNotes'),
|
||||
value: 1,
|
||||
canBuy: options.canBuy || false,
|
||||
canBuy: canBuy,
|
||||
canDrop: options.canDrop || false,
|
||||
});
|
||||
});
|
||||
@@ -78,6 +79,7 @@ export function setHatchingPotionDefaults(hatchingPotions) {
|
||||
key: key,
|
||||
value: 2,
|
||||
text: text,
|
||||
canBuy: () => { return true },
|
||||
notes: translator('hatchingPotionNotes', {
|
||||
potText: text
|
||||
}),
|
||||
@@ -93,7 +95,7 @@ export function setQuestDefaults(quests) {
|
||||
key: key,
|
||||
text: translator(`quest${formattedName}Text`),
|
||||
notes: translator(`quest${formattedName}Notes`),
|
||||
canBuy: true,
|
||||
canBuy: () => { return true; },
|
||||
value: 4,
|
||||
};
|
||||
|
||||
@@ -149,6 +151,7 @@ export function setGearSetDefaults(gearSet, options={}) {
|
||||
let gearDefaults = {
|
||||
text: translator(text),
|
||||
notes: translator(notes, attributes),
|
||||
canBuy: () => { return false; },
|
||||
}
|
||||
|
||||
defaults(item, gearDefaults);
|
||||
@@ -183,11 +186,11 @@ export function generateBackgrounds(sets) {
|
||||
export function generateEggs(set, options={}) {
|
||||
let eggs = {};
|
||||
let type = options.type;
|
||||
let canBuy = options.canBuy;
|
||||
|
||||
each(set, (pet) => {
|
||||
let text = translator(`${type}Egg${pet}Text`);
|
||||
let adj = translator(`${type}Egg${pet}Adjective`);
|
||||
let canBuy = options.canBuy(pet);
|
||||
|
||||
eggs[pet] = {
|
||||
text: text,
|
||||
|
||||
@@ -26,7 +26,11 @@ import {
|
||||
specialMounts,
|
||||
} from './pets-mounts/index';
|
||||
import timeTravelStable from './time-traveler-stable';
|
||||
import hatchingPotions from './hatching-potions';
|
||||
import {
|
||||
all as allHatchingPotions,
|
||||
drop as dropHatchingPotions,
|
||||
premium as premiumHatchingPotions,
|
||||
} from './hatching-potions';
|
||||
import food from './food/index';
|
||||
import {
|
||||
all as allQuests,
|
||||
@@ -66,7 +70,9 @@ export default {
|
||||
special: special,
|
||||
|
||||
// Item Drops
|
||||
hatchingPotions: hatchingPotions,
|
||||
dropHatchingPotions: dropHatchingPotions,
|
||||
premiumHatchingPotions: premiumHatchingPotions,
|
||||
hatchingPotions: allHatchingPotions,
|
||||
food: food,
|
||||
|
||||
// Eggs
|
||||
|
||||
@@ -16,21 +16,26 @@ import {transform, defaults} from 'lodash';
|
||||
// <fake_potion> - if a unique animal, potion is Base, if it's a special version of an existing animal, the fake potion is a different from a normal hatching potion
|
||||
//--------------------------------------------------
|
||||
|
||||
import hatchingPotions from '../hatching-potions';
|
||||
import {
|
||||
drop as dropHatchingPotions,
|
||||
premium as premiumHatchingPotions,
|
||||
} 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);
|
||||
let dropPets = generateAnimalSet(dropEggs, dropHatchingPotions);
|
||||
let premiumPets = generateAnimalSet(dropEggs, premiumHatchingPotions);
|
||||
let questPets = generateAnimalSet(questEggs, dropHatchingPotions);
|
||||
let dropMounts = generateAnimalSet(dropEggs, dropHatchingPotions);
|
||||
let premiumMounts = generateAnimalSet(dropEggs, premiumHatchingPotions);
|
||||
let questMounts = generateAnimalSet(questEggs, dropHatchingPotions);
|
||||
|
||||
function generateAnimalSet(set) {
|
||||
return transform(set, (m, egg) => {
|
||||
defaults(m, transform(hatchingPotions, (m2, pot) => {
|
||||
function generateAnimalSet(eggSet, potionSet) {
|
||||
return transform(eggSet, (m, egg) => {
|
||||
defaults(m, transform(potionSet, (m2, pot) => {
|
||||
return m2[egg.key + "-" + pot.key] = true;
|
||||
}));
|
||||
});
|
||||
@@ -39,6 +44,8 @@ function generateAnimalSet(set) {
|
||||
export default {
|
||||
dropPets: dropPets,
|
||||
dropMounts: dropMounts,
|
||||
premiumPets: premiumPets,
|
||||
premiumMounts: premiumMounts,
|
||||
questPets: questPets,
|
||||
questMounts: questMounts,
|
||||
specialPets: specialPets,
|
||||
|
||||
@@ -117,7 +117,7 @@ let holidayQuests = {
|
||||
let questDefaults = (name) => {
|
||||
return {
|
||||
completion: t(`quest${name}Completion`),
|
||||
canBuy: false,
|
||||
canBuy: () => { return false; },
|
||||
category: 'pet',
|
||||
}
|
||||
};
|
||||
|
||||
@@ -160,7 +160,7 @@ let questDefaults = (name) => {
|
||||
return {
|
||||
completion: t(`quest${name}Completion`),
|
||||
value: 0,
|
||||
canBuy: false,
|
||||
canBuy: () => { return false; },
|
||||
category: 'world',
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user