mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Squashed commit of the following:
commit28193f86fbAuthor: Phillip Thelen <phillip@habitica.com> Date: Fri Jun 21 11:12:18 2024 +0200 Fix serving memoized content commit877fe48225Author: Phillip Thelen <phillip@habitica.com> Date: Thu Jun 20 12:23:24 2024 +0200 correctly memoize conent api commite0f6f79c5bAuthor: Phillip Thelen <phillip@habitica.com> Date: Thu Jun 20 10:11:27 2024 +0200 don’t build multiple times on heroku commitf62254d68eAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 19:40:20 2024 +0200 fix client command commitd054e6fc16Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 19:36:57 2024 +0200 correct build call commit7231f699c1Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 19:32:32 2024 +0200 try setting up with heroku buildpack commit1dae0793fdAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:50:32 2024 +0200 call gulp build:prod commitf18fbe86b6Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:40:53 2024 +0200 build client commit61a61724caAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:33:18 2024 +0200 testing commit93cf30eb18Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:20:25 2024 +0200 integration fix commitcff08adcd0Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:13:20 2024 +0200 specify dev docker file commit4da2ed4a1fAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:10:07 2024 +0200 initialize stub commit11c5b26c59Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:08:45 2024 +0200 test heroku file commitac85bb2e2dAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:03:15 2024 +0200 fix stub reference commit74dfb2710fAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 18:01:27 2024 +0200 test fixes commit8dbd3c3db1Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 17:37:04 2024 +0200 fix canOwn test commit74b3b348ffAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 17:32:31 2024 +0200 fix buy test commit3386d61fdeAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 17:30:37 2024 +0200 fix debug tests commit19da14531cAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 17:05:25 2024 +0200 add chameleon to featured quests commit254dd80f24Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 17:05:14 2024 +0200 fix import commit0bc3f16b4bAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 16:33:22 2024 +0200 add new content to new release file commit5184973bd5Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 16:33:11 2024 +0200 fix release date tests commitb6accca5caAuthor: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 16:33:06 2024 +0200 fix armoire tests commitfec68e6211Author: Phillip Thelen <phillip@habitica.com> Date: Wed Jun 19 16:02:03 2024 +0200 fix tests commitfc63c906ddAuthor: Phillip Thelen <phillip@habitica.com> Date: Mon Jun 10 14:44:21 2024 +0200 Improve test coverage commit3333f8f0f5Author: Phillip Thelen <phillip@habitica.com> Date: Mon Jun 10 14:24:59 2024 +0200 allow hatching potions to have a release date commit89a3ac3ddeAuthor: Phillip Thelen <phillip@habitica.com> Date: Mon Jun 10 14:11:38 2024 +0200 allow eggs to have a release date # Conflicts: # test/content/armoire.test.js commit16551ec83fMerge:f5f4974a732645bf6023Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 15:03:12 2024 -0400 Merge branch '2024-07-content-prebuild' into subs-private commit2645bf6023Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 15:02:47 2024 -0400 update habitica images commitf5f4974a73Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 14:58:13 2024 -0400 update habitica-images commit162e337d14Merge:f2506c323121a7d36b7bAuthor: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 13:46:03 2024 -0400 Merge branch '2024-07-content-prebuild' into subs-private commit21a7d36b7bAuthor: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 13:45:09 2024 -0400 update sprites commitf2506c3231Author: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 13:24:21 2024 -0400 updated sprites css commitd47641e25aAuthor: CuriousMagpie <eilatan@gmail.com> Date: Tue Jun 18 12:46:59 2024 -0400 typo fix commitfb8479ad1eAuthor: CuriousMagpie <eilatan@gmail.com> Date: Mon Jun 17 13:44:36 2024 -0400 finish July prebuild commit3810cf3ef3Author: CuriousMagpie <eilatan@gmail.com> Date: Fri Jun 14 10:42:47 2024 -0400 add chameleon quest commitd05da3722cAuthor: CuriousMagpie <eilatan@gmail.com> Date: Thu Jun 13 17:12:43 2024 -0400 add June background notes commitb8a3440ef2Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Jun 13 16:40:04 2024 -0400 fix mystery item and background description commit44d63032d8Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Jun 13 15:38:23 2024 -0400 add subscriber gear, enchanted armoire, and background commit9d7da91ec6Author: CuriousMagpie <eilatan@gmail.com> Date: Thu Jun 13 14:44:59 2024 -0400 add sprites
This commit is contained in:
@@ -1,21 +1,12 @@
|
||||
import each from 'lodash/each';
|
||||
import moment from 'moment';
|
||||
import { EVENTS } from './constants/events';
|
||||
import {
|
||||
drops as dropEggs,
|
||||
quests as questEggs,
|
||||
} from './eggs';
|
||||
import {
|
||||
drops as dropPotions,
|
||||
premium as premiumPotions,
|
||||
wacky as wackyPotions,
|
||||
} from './hatching-potions';
|
||||
import allEggs from './eggs';
|
||||
import allPotions from './hatching-potions';
|
||||
import t from './translation';
|
||||
import memoize from '../fns/datedMemoize';
|
||||
|
||||
const petInfo = {};
|
||||
const mountInfo = {};
|
||||
|
||||
function constructSet (type, eggs, potions) {
|
||||
function constructSet (type, eggs, potions, petInfo, mountInfo, hasMounts = true) {
|
||||
const pets = {};
|
||||
const mounts = {};
|
||||
|
||||
@@ -37,52 +28,24 @@ function constructSet (type, eggs, potions) {
|
||||
potion: potion.text,
|
||||
egg: egg.text,
|
||||
}));
|
||||
mountInfo[key] = getAnimalData(t('mountName', {
|
||||
potion: potion.text,
|
||||
mount: egg.mountText,
|
||||
}));
|
||||
|
||||
pets[key] = true;
|
||||
mounts[key] = true;
|
||||
});
|
||||
});
|
||||
|
||||
return [pets, mounts];
|
||||
}
|
||||
|
||||
function constructPetOnlySet (type, eggs, potions) {
|
||||
const pets = {};
|
||||
|
||||
each(eggs, egg => {
|
||||
each(potions, potion => {
|
||||
const key = `${egg.key}-${potion.key}`;
|
||||
|
||||
function getAnimalData (text) {
|
||||
return {
|
||||
key,
|
||||
type,
|
||||
potion: potion.key,
|
||||
egg: egg.key,
|
||||
text,
|
||||
};
|
||||
if (hasMounts) {
|
||||
mountInfo[key] = getAnimalData(t('mountName', {
|
||||
potion: potion.text,
|
||||
mount: egg.mountText,
|
||||
}));
|
||||
mounts[key] = true;
|
||||
}
|
||||
|
||||
petInfo[key] = getAnimalData(t('petName', {
|
||||
potion: potion.text,
|
||||
egg: egg.text,
|
||||
}));
|
||||
pets[key] = true;
|
||||
});
|
||||
});
|
||||
|
||||
if (hasMounts) {
|
||||
return [pets, mounts];
|
||||
}
|
||||
return pets;
|
||||
}
|
||||
|
||||
const [dropPets, dropMounts] = constructSet('drop', dropEggs, dropPotions);
|
||||
const [premiumPets, premiumMounts] = constructSet('premium', dropEggs, premiumPotions);
|
||||
const [questPets, questMounts] = constructSet('quest', questEggs, dropPotions);
|
||||
const wackyPets = constructPetOnlySet('wacky', dropEggs, wackyPotions);
|
||||
|
||||
const canFindSpecial = {
|
||||
pets: {
|
||||
// Veteran Pet Ladder - awarded on major updates
|
||||
@@ -208,44 +171,88 @@ const specialMounts = {
|
||||
'JackOLantern-RoyalPurple': 'royalPurpleJackolantern',
|
||||
};
|
||||
|
||||
each(specialPets, (translationString, key) => {
|
||||
petInfo[key] = {
|
||||
key,
|
||||
type: 'special',
|
||||
text: t(translationString),
|
||||
canFind: canFindSpecial.pets[key],
|
||||
};
|
||||
});
|
||||
function buildInfo () {
|
||||
const petInfo = {};
|
||||
const mountInfo = {};
|
||||
|
||||
Object.assign(petInfo['Gryphatrice-Jubilant'], {
|
||||
canBuy () {
|
||||
return moment().isBetween(EVENTS.birthday10.start, EVENTS.birthday10.end);
|
||||
const [dropPets, dropMounts] = constructSet('drop', allEggs.drops, allPotions.drops, petInfo, mountInfo);
|
||||
const [premiumPets, premiumMounts] = constructSet('premium', allEggs.drops, allPotions.premium, petInfo, mountInfo);
|
||||
const [questPets, questMounts] = constructSet('quest', allEggs.quests, allPotions.drops, petInfo, mountInfo);
|
||||
const wackyPets = constructSet('wacky', allEggs.drops, allPotions.wacky, petInfo, mountInfo, false);
|
||||
|
||||
each(specialPets, (translationString, key) => {
|
||||
petInfo[key] = {
|
||||
key,
|
||||
type: 'special',
|
||||
text: t(translationString),
|
||||
canFind: canFindSpecial.pets[key],
|
||||
};
|
||||
});
|
||||
|
||||
Object.assign(petInfo['Gryphatrice-Jubilant'], {
|
||||
canBuy () {
|
||||
return moment().isBetween(EVENTS.birthday10.start, EVENTS.birthday10.end);
|
||||
},
|
||||
currency: 'gems',
|
||||
event: 'birthday10',
|
||||
value: 60,
|
||||
purchaseType: 'pets',
|
||||
});
|
||||
|
||||
each(specialMounts, (translationString, key) => {
|
||||
mountInfo[key] = {
|
||||
key,
|
||||
type: 'special',
|
||||
text: t(translationString),
|
||||
canFind: canFindSpecial.mounts[key],
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
dropPets,
|
||||
premiumPets,
|
||||
questPets,
|
||||
wackyPets,
|
||||
dropMounts,
|
||||
questMounts,
|
||||
premiumMounts,
|
||||
specialPets,
|
||||
specialMounts,
|
||||
petInfo,
|
||||
mountInfo,
|
||||
};
|
||||
}
|
||||
|
||||
const memoizedBuildInfo = memoize(buildInfo);
|
||||
|
||||
export default {
|
||||
get dropPets () {
|
||||
return memoizedBuildInfo().dropPets;
|
||||
},
|
||||
get premiumPets () {
|
||||
return memoizedBuildInfo().premiumPets;
|
||||
},
|
||||
get questPets () {
|
||||
return memoizedBuildInfo().questPets;
|
||||
},
|
||||
get wackyPets () {
|
||||
return memoizedBuildInfo().wackyPets;
|
||||
},
|
||||
get dropMounts () {
|
||||
return memoizedBuildInfo().dropMounts;
|
||||
},
|
||||
get questMounts () {
|
||||
return memoizedBuildInfo().questMounts;
|
||||
},
|
||||
get premiumMounts () {
|
||||
return memoizedBuildInfo().premiumMounts;
|
||||
},
|
||||
get petInfo () {
|
||||
return memoizedBuildInfo().petInfo;
|
||||
},
|
||||
get mountInfo () {
|
||||
return memoizedBuildInfo().mountInfo;
|
||||
},
|
||||
currency: 'gems',
|
||||
event: 'birthday10',
|
||||
value: 60,
|
||||
purchaseType: 'pets',
|
||||
});
|
||||
|
||||
each(specialMounts, (translationString, key) => {
|
||||
mountInfo[key] = {
|
||||
key,
|
||||
type: 'special',
|
||||
text: t(translationString),
|
||||
canFind: canFindSpecial.mounts[key],
|
||||
};
|
||||
});
|
||||
|
||||
export {
|
||||
dropPets,
|
||||
premiumPets,
|
||||
questPets,
|
||||
wackyPets,
|
||||
dropMounts,
|
||||
questMounts,
|
||||
premiumMounts,
|
||||
specialPets,
|
||||
specialMounts,
|
||||
petInfo,
|
||||
mountInfo,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user