Revert "Revert "allow hatching potions to have a release date""

This reverts commit 485584c144.

# Conflicts:
#	website/common/script/content/hatching-potions.js
This commit is contained in:
Phillip Thelen
2024-06-11 18:54:39 +02:00
parent 6c5bff7843
commit a00f199d18
9 changed files with 101 additions and 109 deletions
@@ -1,15 +0,0 @@
export const ARMOIRE_RELEASE_DATES = {
somethingSpooky: { year: 2023, month: 10 },
cookingImplementsTwo: { year: 2023, month: 11 },
greenTrapper: { year: 2023, month: 12 },
schoolUniform: { year: 2024, month: 1 },
whiteLoungeWear: { year: 2024, month: 2 },
hatterSet: { year: 2024, month: 3 },
optimistSet: { year: 2024, month: 4 },
pottersSet: { year: 2024, month: 5 },
beachsideSet: { year: 2024, month: 6 },
};
export const EGGS_RELEASE_DATES = {
Giraffe: { year: 2024, month: 6, day: 1 },
};
+6 -15
View File
@@ -1,9 +1,7 @@
import assign from 'lodash/assign';
import defaults from 'lodash/defaults';
import each from 'lodash/each';
import t from './translation';
import { filterReleased } from './is_released';
import { EGGS_RELEASE_DATES } from './constants/release_dates';
import datedMemoize from '../fns/datedMemoize';
function applyEggDefaults (set, config) {
each(set, (egg, key) => {
@@ -412,17 +410,10 @@ applyEggDefaults(quests, {
},
});
function filterEggs (eggs) {
return filterReleased(eggs, 'key', EGGS_RELEASE_DATES);
}
const all = assign({}, drops, quests);
const memoizedFilter = datedMemoize(filterEggs);
export default {
get drops () {
return memoizedFilter({ memoizeConfig: true, identifier: 'drops' }, drops);
},
get quests () {
return memoizedFilter({ memoizeConfig: true, identifier: 'quests' }, quests);
},
export {
drops,
quests,
all,
};
@@ -2,9 +2,6 @@ import defaults from 'lodash/defaults';
import each from 'lodash/each';
import { assign } from 'lodash';
import t from './translation';
import datedMemoize from '../fns/datedMemoize';
import { filterReleased } from './is_released';
import { HATCHING_POTIONS_RELEASE_DATES } from './constants/release_dates';
function hasQuestAchievementFunction (key) {
return user => user.achievements.quests && user.achievements.quests[key] > 0;
@@ -196,23 +193,8 @@ each(wacky, (pot, key) => {
});
});
function filterEggs (eggs) {
return filterReleased(eggs, 'key', HATCHING_POTIONS_RELEASE_DATES);
}
const all = assign({}, drops, premium, wacky);
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);
},
export {
drops, premium, wacky, all,
};
+2 -3
View File
@@ -1,6 +1,5 @@
import defaults from 'lodash/defaults';
import each from 'lodash/each';
import assign from 'lodash/assign';
import moment from 'moment';
import t from './translation';
import { tasksByCategory } from './tasks';
@@ -19,7 +18,7 @@ import {
import achievements from './achievements';
import eggs from './eggs';
import * as eggs from './eggs';
import * as hatchingPotions from './hatching-potions';
import * as stable from './stable';
import gear from './gear';
@@ -168,7 +167,7 @@ api.special = api.spells.special;
api.dropEggs = eggs.drops;
api.questEggs = eggs.quests;
api.eggs = assign({}, eggs.drops, eggs.quests);
api.eggs = eggs.all;
api.timeTravelStable = {
pets: {
+44 -22
View File
@@ -1,7 +1,10 @@
import each from 'lodash/each';
import moment from 'moment';
import { EVENTS } from './constants/events';
import allEggs from './eggs';
import {
drops as dropEggs,
quests as questEggs,
} from './eggs';
import {
drops as dropPotions,
premium as premiumPotions,
@@ -9,14 +12,10 @@ import {
} from './hatching-potions';
import t from './translation';
const STABLE_RELEASE_DATES = {
};
const petInfo = {};
const mountInfo = {};
function constructSet (type, eggs, potions, hasMounts = true) {
function constructSet (type, eggs, potions) {
const pets = {};
const mounts = {};
@@ -38,24 +37,52 @@ function constructSet (type, eggs, potions, hasMounts = true) {
potion: potion.text,
egg: egg.text,
}));
pets[key] = true;
mountInfo[key] = getAnimalData(t('mountName', {
potion: potion.text,
mount: egg.mountText,
}));
if (hasMounts) {
mountInfo[key] = getAnimalData(t('mountName', {
potion: potion.text,
mount: egg.mountText,
}));
mounts[key] = true;
}
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,
};
}
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
@@ -131,11 +158,6 @@ const canFindSpecial = {
},
};
const [dropPets, dropMounts] = constructSet('drop', allEggs.drops, dropPotions);
const [premiumPets, premiumMounts] = constructSet('premium', allEggs.drops, premiumPotions);
const [questPets, questMounts] = constructSet('quest', allEggs.quests, dropPotions);
const wackyPets = constructSet('wacky', allEggs.drops, wackyPotions, false);
const specialPets = {
'Wolf-Veteran': 'veteranWolf',
'Wolf-Cerberus': 'cerberusPup',
+2 -2
View File
@@ -1,9 +1,9 @@
import allEggs from '../content/eggs';
import { drops as eggs } from '../content/eggs';
import { drops as hatchingPotions } from '../content/hatching-potions';
import randomVal from '../libs/randomVal';
export default function firstDrops (user) {
const eggDrop = randomVal(allEggs.drops);
const eggDrop = randomVal(eggs);
const potionDrop = randomVal(hatchingPotions);
user.items.eggs = {