Files
habitica/website/common/script/content/hatching-potions.js
T
Kalista Payne 31b2781333 Squashed commit of the following:
commit 866f074a15512e2f897d007ad1a5379ffee456d7
Author: Kalista Payne <kalista@habitica.com>
Date:   Wed Mar 18 15:51:18 2026 -0500

    fix(quests): remove backticks from text

commit d06fc2825e8638d5c127277f92ef94f26f3daba0
Author: Kalista Payne <kalista@habitica.com>
Date:   Wed Mar 18 13:16:32 2026 -0500

    fix(background): add missing data

commit 55156c5f808e3ad9bf16d6465b5b7596fce12631
Author: Kalista Payne <kalista@habitica.com>
Date:   Wed Mar 18 13:00:43 2026 -0500

    fix(lint): max-len

commit db88092acfceac7c465c1e01638ae18bd1572ee3
Author: Kalista Payne <kalista@habitica.com>
Date:   Wed Mar 18 12:56:30 2026 -0500

    fix(customization): show event backgrounds for AF

commit d6fd1ce7fa1b15771786518656a6663e46ba42bc
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Mar 17 15:55:53 2026 +0100

    set release date

commit b876d8c78928283a81fadfeb1116e09c73f3e25f
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Mar 17 11:40:17 2026 +0100

    Improve swap handling

commit f75a4d01473b492ef28b2324f2defe46cb3845f8
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Mar 17 11:22:42 2026 +0100

    use correct name for bear sprites

commit 195db1b1328a73043e1a1c9014e9ce22a3df72f3
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Mar 16 23:01:35 2026 +0100

    more fix

commit a42d3f08d749abf2a072805e4c54f67564c1e320
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Mar 16 18:43:21 2026 +0100

    fix test

commit 9c06299c343fd29c5dcddfe62e83d410f6c93115
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Mar 16 09:13:13 2026 +0100

    AF tweaks

commit 5465e23e679cad1d81404a0911204aaf18c231b7
Author: Kalista Payne <kalista@habitica.com>
Date:   Wed Mar 11 19:43:01 2026 -0500

    fix(sprites): add missing gif redirects

commit 5721ecc6f2b21fd6049a028fddc79fb6dea0434e
Author: Kalista Payne <kalista@habitica.com>
Date:   Tue Mar 10 16:34:26 2026 -0500

    chore(css): run sprites

commit 2184ff2e6937459c404f3067c9d0662c9d908074
Author: Kalista Payne <kalista@habitica.com>
Date:   Tue Mar 10 10:38:34 2026 -0500

    fix(test): date

commit d684a7297c2f86f417677a1f0fa7ae47c8d4d1d6
Author: Kalista Payne <kalista@habitica.com>
Date:   Tue Mar 10 10:32:04 2026 -0500

    fix(test): update for 2026, also more lint

commit 82e7947fd7bc99d1dd33ff08490f2bda0ff74d2b
Author: Kalista Payne <kalista@habitica.com>
Date:   Tue Mar 10 10:22:05 2026 -0500

    fix(event): lint and missing pieces

commit 96818b2d778848fdbff99afdf50b9f305c25b1a9
Author: Kalista Payne <kalista@habitica.com>
Date:   Mon Mar 9 20:11:22 2026 -0500

    feat(event): finished Alien build

commit 4c9763b676f5873d83c4c9c249e7e0ffb5905a2e
Author: Kalista Payne <kalista@habitica.com>
Date:   Fri Mar 6 16:30:36 2026 -0600

    wip(event): April Fools 2026 build

commit 2f16a016e63f523c81a9425d5d7c49e9138c46a5
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Feb 4 14:16:50 2026 +0100

    add april fools tests

commit cd1d926c9898f5faf4fe82e4ecccc4d801248f06
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Feb 4 14:09:16 2026 +0100

    make april fools cycle through

commit d8a4216c412437448ea15f8fd456765ebd5f53f9
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Feb 2 14:41:26 2026 +0100

    fix lint

commit 8265a15923f34ad1afdaab05992c3def5cb4d202
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Feb 2 12:34:46 2026 +0100

    name key more generic

commit 9c7bde8ad563bd346b548fdf59fb0454910ae256
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Feb 2 12:26:43 2026 +0100

    right date for april fools

commit c2b92c6311d60a609e8b8743fc0efe3cbac853b6
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Feb 2 12:26:19 2026 +0100

    rework how april fools works
2026-03-19 15:09:32 -05:00

235 lines
4.5 KiB
JavaScript

import defaults from 'lodash/defaults';
import each from 'lodash/each';
import assign from 'lodash/assign';
import t from './translation';
import datedMemoize from '../fns/datedMemoize';
import { filterReleased } from './is_released';
import { HATCHING_POTIONS_RELEASE_DATES } from './constants/releaseDates';
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'),
},
RoseGold: {},
Koi: {},
Gingerbread: {},
Jade: {
questPotion: true,
canBuy: hasQuestAchievementFunction('jade'),
},
Balloon: {},
Opal: {
questPotion: true,
canBuy: hasQuestAchievementFunction('opal'),
},
};
const wacky = {
Veggie: {},
Dessert: {
questPotion: true,
canBuy: hasQuestAchievementFunction('waffle'),
},
VirtualPet: {
questPotion: true,
canBuy: hasQuestAchievementFunction('virtualpet'),
},
TeaShop: {},
Fungi: {
questPotion: true,
canBuy: hasQuestAchievementFunction('fungi'),
},
Cryptid: {},
Alien: {
questPotion: true,
canBuy: hasQuestAchievementFunction('alien'),
},
};
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('wackyPotionNotes', {
potText: t(`hatchingPotion${key}`),
}),
_addlNotes: t('wackyPotionAddlNotes'),
premium: false,
limited: true,
wacky: true,
canBuy () {
return false;
},
});
});
function filterEggs (eggs) {
return filterReleased(eggs, 'key', HATCHING_POTIONS_RELEASE_DATES);
}
const memoizedFilter = datedMemoize(filterEggs);
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);
},
};