Files
habitica/website/common/script/content/hatching-potions.js
2024-05-17 15:44:08 +02:00

201 lines
3.6 KiB
JavaScript

import assign from 'lodash/assign';
import defaults from 'lodash/defaults';
import each from 'lodash/each';
import t from './translation';
function hasQuestAchievementFunction (key) {
return user => user.achievements.quests && user.achievements.quests[key] > 0;
}
const drops = {
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,
},
};
const premium = {
RoyalPurple: {},
Cupid: {},
Shimmer: {},
Fairy: {},
Floral: {},
Aquatic: {},
Ember: {},
Thunderstorm: {},
Spooky: {},
Ghost: {},
Holly: {},
Peppermint: {},
StarryNight: {},
Rainbow: {},
Glass: {},
Glow: {},
Frost: {},
IcySnow: {},
RoseQuartz: {},
Celestial: {},
Sunshine: {},
Bronze: {
questPotion: true,
canBuy: hasQuestAchievementFunction('bronze'),
},
Watery: {},
Silver: {
questPotion: true,
canBuy: hasQuestAchievementFunction('silver'),
},
Shadow: {},
Amber: {
questPotion: true,
canBuy: hasQuestAchievementFunction('amber'),
},
Aurora: {},
Ruby: {
questPotion: true,
canBuy: hasQuestAchievementFunction('ruby'),
},
BirchBark: {},
Fluorite: {
questPotion: true,
canBuy: hasQuestAchievementFunction('fluorite'),
},
SandSculpture: {},
Windup: {
questPotion: true,
canBuy: hasQuestAchievementFunction('windup'),
},
Turquoise: {
questPotion: true,
canBuy: hasQuestAchievementFunction('turquoise'),
},
Vampire: {},
AutumnLeaf: {},
BlackPearl: {
questPotion: true,
canBuy: hasQuestAchievementFunction('blackPearl'),
},
StainedGlass: {},
PolkaDot: {},
MossyStone: {
questPotion: true,
canBuy: hasQuestAchievementFunction('stone'),
},
Sunset: {},
Moonglow: {},
SolarSystem: {
questPotion: true,
canBuy: hasQuestAchievementFunction('solarSystem'),
},
Onyx: {
questPotion: true,
canBuy: hasQuestAchievementFunction('onyx'),
},
Porcelain: {},
PinkMarble: {
questPotion: true,
canBuy: hasQuestAchievementFunction('pinkMarble'),
},
Koi: {},
};
const wacky = {
Veggie: {},
Dessert: {
questPotion: true,
canBuy: hasQuestAchievementFunction('waffle'),
},
VirtualPet: {
questPotion: true,
canBuy: hasQuestAchievementFunction('virtualpet'),
},
TeaShop: {},
Fungi: {
questPotion: true,
canBuy: hasQuestAchievementFunction('fungi'),
},
};
each(drops, (pot, key) => {
defaults(pot, {
key,
value: 2,
text: t(`hatchingPotion${key}`),
notes: t('hatchingPotionNotes', {
potText: t(`hatchingPotion${key}`),
}),
premium: false,
limited: false,
canBuy () {
return true;
},
});
});
each(premium, (pot, key) => {
defaults(pot, {
key,
value: 2,
text: t(`hatchingPotion${key}`),
notes: t('hatchingPotionNotes', {
potText: t(`hatchingPotion${key}`),
}),
_addlNotes: t('premiumPotionUnlimitedNotes'),
premium: true,
limited: true,
canBuy () {
return false;
},
});
});
each(wacky, (pot, key) => {
defaults(pot, {
key,
value: 2,
text: t(`hatchingPotion${key}`),
notes: t('hatchingPotionNotes', {
potText: t(`hatchingPotion${key}`),
}),
_addlNotes: t('premiumPotionUnlimitedNotes'),
premium: false,
limited: true,
wacky: true,
canBuy () {
return false;
},
});
});
const all = assign({}, drops, premium, wacky);
export {
drops, premium, wacky, all,
};