2017-03-01 16:10:48 +00:00
|
|
|
import defaults from 'lodash/defaults';
|
|
|
|
|
import each from 'lodash/each';
|
2024-06-11 16:19:29 +00:00
|
|
|
import { assign } from 'lodash';
|
2016-09-10 18:37:10 +00:00
|
|
|
import t from './translation';
|
2024-06-28 14:49:08 +00:00
|
|
|
import datedMemoize from '../fns/datedMemoize';
|
|
|
|
|
import { filterReleased } from './is_released';
|
|
|
|
|
import { HATCHING_POTIONS_RELEASE_DATES } from './constants/releaseDates';
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2019-05-13 16:02:07 +00:00
|
|
|
function hasQuestAchievementFunction (key) {
|
2022-02-14 19:55:19 +00:00
|
|
|
return user => user.achievements.quests && user.achievements.quests[key] > 0;
|
2019-05-13 16:02:07 +00:00
|
|
|
}
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const drops = {
|
2016-09-10 18:37:10 +00:00
|
|
|
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,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const premium = {
|
2024-05-17 13:44:08 +00:00
|
|
|
RoyalPurple: {},
|
|
|
|
|
Cupid: {},
|
|
|
|
|
Shimmer: {},
|
|
|
|
|
Fairy: {},
|
|
|
|
|
Floral: {},
|
|
|
|
|
Aquatic: {},
|
|
|
|
|
Ember: {},
|
|
|
|
|
Thunderstorm: {},
|
|
|
|
|
Spooky: {},
|
|
|
|
|
Ghost: {},
|
|
|
|
|
Holly: {},
|
|
|
|
|
Peppermint: {},
|
|
|
|
|
StarryNight: {},
|
|
|
|
|
Rainbow: {},
|
|
|
|
|
Glass: {},
|
|
|
|
|
Glow: {},
|
|
|
|
|
Frost: {},
|
|
|
|
|
IcySnow: {},
|
|
|
|
|
RoseQuartz: {},
|
|
|
|
|
Celestial: {},
|
|
|
|
|
Sunshine: {},
|
2019-05-13 16:02:07 +00:00
|
|
|
Bronze: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2019-05-13 16:02:07 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('bronze'),
|
2019-06-20 20:13:19 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Watery: {},
|
2019-08-14 00:16:19 +00:00
|
|
|
Silver: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2019-08-14 00:16:19 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('silver'),
|
2019-09-26 19:47:26 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Shadow: {},
|
2019-11-26 21:58:18 +00:00
|
|
|
Amber: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2019-11-26 21:58:18 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('amber'),
|
2019-12-19 22:54:27 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Aurora: {},
|
2020-02-13 00:30:54 +00:00
|
|
|
Ruby: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-02-13 00:30:54 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('ruby'),
|
2020-03-17 20:35:38 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
BirchBark: {},
|
2020-06-11 21:38:05 +00:00
|
|
|
Fluorite: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-06-11 21:38:05 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('fluorite'),
|
2020-06-18 18:16:07 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
SandSculpture: {},
|
2020-08-25 21:04:28 +00:00
|
|
|
Windup: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-08-25 21:04:28 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('windup'),
|
|
|
|
|
},
|
2020-09-14 21:05:54 +00:00
|
|
|
Turquoise: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-09-14 21:05:54 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('turquoise'),
|
2020-11-09 21:06:56 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Vampire: {},
|
|
|
|
|
AutumnLeaf: {},
|
2020-11-16 21:52:06 +00:00
|
|
|
BlackPearl: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-11-16 21:52:06 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('blackPearl'),
|
2021-03-25 20:21:24 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
StainedGlass: {},
|
|
|
|
|
PolkaDot: {},
|
2021-05-18 20:20:23 +00:00
|
|
|
MossyStone: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2021-05-18 20:20:23 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('stone'),
|
2021-08-17 21:16:28 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Sunset: {},
|
|
|
|
|
Moonglow: {},
|
2021-08-24 20:42:40 +00:00
|
|
|
SolarSystem: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2021-08-24 20:42:40 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('solarSystem'),
|
|
|
|
|
},
|
2021-11-23 21:33:47 +00:00
|
|
|
Onyx: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2021-11-23 21:33:47 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('onyx'),
|
2022-08-15 20:14:23 +00:00
|
|
|
},
|
2024-04-05 03:42:28 +00:00
|
|
|
Porcelain: {},
|
2023-02-13 05:17:56 +00:00
|
|
|
PinkMarble: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2023-02-13 05:17:56 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('pinkMarble'),
|
2024-01-26 22:35:02 +00:00
|
|
|
},
|
2024-06-21 14:12:18 +00:00
|
|
|
RoseGold: {},
|
2024-05-13 12:49:39 +00:00
|
|
|
Koi: {},
|
2024-11-19 17:44:22 +00:00
|
|
|
Gingerbread: {},
|
2025-02-18 21:48:08 +00:00
|
|
|
Jade: {
|
|
|
|
|
questPotion: true,
|
|
|
|
|
canBuy: hasQuestAchievementFunction('jade'),
|
|
|
|
|
},
|
2020-12-22 15:14:00 +00:00
|
|
|
};
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2019-03-25 22:26:38 +00:00
|
|
|
const wacky = {
|
2024-05-17 13:44:08 +00:00
|
|
|
Veggie: {},
|
2020-04-04 00:25:43 +00:00
|
|
|
Dessert: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2020-04-04 00:25:43 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('waffle'),
|
|
|
|
|
},
|
2022-04-04 21:29:51 +00:00
|
|
|
VirtualPet: {
|
2024-05-17 13:44:08 +00:00
|
|
|
questPotion: true,
|
2022-04-06 18:36:43 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('virtualpet'),
|
2022-04-04 21:29:51 +00:00
|
|
|
},
|
2024-05-17 13:44:08 +00:00
|
|
|
TeaShop: {},
|
2024-04-08 20:48:32 +00:00
|
|
|
Fungi: {
|
2024-06-21 16:56:01 +00:00
|
|
|
questPotion: true,
|
2024-04-08 20:48:32 +00:00
|
|
|
canBuy: hasQuestAchievementFunction('fungi'),
|
|
|
|
|
},
|
2019-03-25 22:26:38 +00:00
|
|
|
};
|
|
|
|
|
|
2016-09-10 18:37:10 +00:00
|
|
|
each(drops, (pot, key) => {
|
|
|
|
|
defaults(pot, {
|
|
|
|
|
key,
|
|
|
|
|
value: 2,
|
2024-04-05 03:42:28 +00:00
|
|
|
text: t(`hatchingPotion${key}`),
|
2016-09-10 18:37:10 +00:00
|
|
|
notes: t('hatchingPotionNotes', {
|
2024-04-05 03:42:28 +00:00
|
|
|
potText: t(`hatchingPotion${key}`),
|
2016-09-10 18:37:10 +00:00
|
|
|
}),
|
|
|
|
|
premium: false,
|
|
|
|
|
limited: false,
|
|
|
|
|
canBuy () {
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
each(premium, (pot, key) => {
|
|
|
|
|
defaults(pot, {
|
|
|
|
|
key,
|
|
|
|
|
value: 2,
|
2024-04-05 03:42:28 +00:00
|
|
|
text: t(`hatchingPotion${key}`),
|
2016-09-10 18:37:10 +00:00
|
|
|
notes: t('hatchingPotionNotes', {
|
2024-04-05 03:42:28 +00:00
|
|
|
potText: t(`hatchingPotion${key}`),
|
2020-02-18 09:45:57 +00:00
|
|
|
}),
|
2024-04-05 03:42:28 +00:00
|
|
|
_addlNotes: t('premiumPotionUnlimitedNotes'),
|
2016-09-10 18:37:10 +00:00
|
|
|
premium: true,
|
2024-04-05 03:42:28 +00:00
|
|
|
limited: true,
|
2016-09-10 18:37:10 +00:00
|
|
|
canBuy () {
|
2019-12-19 22:54:27 +00:00
|
|
|
return false;
|
2016-09-10 18:37:10 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2019-03-25 22:26:38 +00:00
|
|
|
each(wacky, (pot, key) => {
|
|
|
|
|
defaults(pot, {
|
|
|
|
|
key,
|
|
|
|
|
value: 2,
|
2024-04-05 03:42:28 +00:00
|
|
|
text: t(`hatchingPotion${key}`),
|
2019-03-25 22:26:38 +00:00
|
|
|
notes: t('hatchingPotionNotes', {
|
2024-04-05 03:42:28 +00:00
|
|
|
potText: t(`hatchingPotion${key}`),
|
2019-03-25 22:26:38 +00:00
|
|
|
}),
|
2024-04-05 03:42:28 +00:00
|
|
|
_addlNotes: t('premiumPotionUnlimitedNotes'),
|
2019-03-25 22:26:38 +00:00
|
|
|
premium: false,
|
|
|
|
|
limited: true,
|
2019-04-04 15:35:22 +00:00
|
|
|
wacky: true,
|
2019-03-25 22:26:38 +00:00
|
|
|
canBuy () {
|
2019-12-19 22:54:27 +00:00
|
|
|
return false;
|
2019-03-25 22:26:38 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-28 14:49:08 +00:00
|
|
|
function filterEggs (eggs) {
|
|
|
|
|
return filterReleased(eggs, 'key', HATCHING_POTIONS_RELEASE_DATES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const memoizedFilter = datedMemoize(filterEggs);
|
2016-09-10 18:37:10 +00:00
|
|
|
|
2024-06-28 14:49:08 +00:00
|
|
|
export default {
|
|
|
|
|
get drops () {
|
|
|
|
|
return memoizedFilter({ memoizeConfig: true, identifier: 'drops' }, drops);
|
|
|
|
|
},
|
|
|
|
|
get premium () {
|
|
|
|
|
return memoizedFilter({ memoizeConfig: true, identifier: 'premium' }, premium);
|
|
|
|
|
},
|
|
|
|
|
get wacky () {
|
|
|
|
|
return memoizedFilter({ memoizeConfig: true, identifier: 'wacky' }, wacky);
|
|
|
|
|
},
|
|
|
|
|
get all () {
|
|
|
|
|
return assign({}, this.drops, this.premium, this.wacky);
|
|
|
|
|
},
|
2016-09-10 18:37:10 +00:00
|
|
|
};
|