allow hatching potions to have a release date

This commit is contained in:
Phillip Thelen
2024-06-10 14:24:59 +02:00
parent 89a3ac3dde
commit 3333f8f0f5
7 changed files with 39 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ import t from '../../website/common/script/content/translation';
import * as stable from '../../website/common/script/content/stable';
import eggs from '../../website/common/script/content/eggs';
import * as potions from '../../website/common/script/content/hatching-potions';
import potions from '../../website/common/script/content/hatching-potions';
describe('stable', () => {
describe('dropPets', () => {

View File

@@ -13,3 +13,7 @@ export const ARMOIRE_RELEASE_DATES = {
export const EGGS_RELEASE_DATES = {
Giraffe: { year: 2024, month: 6, day: 1 },
};
export const HATCHING_POTIONS_RELEASE_DATES = {
Koi: { year: 2024, month: 6, day: 1 },
};

View File

@@ -1,5 +1,6 @@
import defaults from 'lodash/defaults';
import each from 'lodash/each';
import assign from 'lodash/assign';
import t from './translation';
import { filterReleased } from './is_released';
import { EGGS_RELEASE_DATES } from './constants/release_dates';
@@ -431,4 +432,7 @@ export default {
get quests () {
return memoizedFilter({ memoizeConfig: true, identifier: 'quests' }, quests);
},
get all () {
return assign({}, this.drops, this.quests);
},
};

View File

@@ -2,6 +2,9 @@ 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;
@@ -193,8 +196,23 @@ each(wacky, (pot, key) => {
});
});
const all = assign({}, drops, premium, wacky);
function filterEggs (eggs) {
return filterReleased(eggs, 'key', HATCHING_POTIONS_RELEASE_DATES);
}
export {
drops, premium, wacky, all,
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);
},
};

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';
@@ -20,7 +19,7 @@ import {
import achievements from './achievements';
import eggs from './eggs';
import * as hatchingPotions from './hatching-potions';
import hatchingPotions from './hatching-potions';
import * as stable from './stable';
import gear from './gear';
import { quests, questsByLevel, userCanOwnQuestCategories } from './quests';
@@ -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: {

View File

@@ -2,17 +2,9 @@ import each from 'lodash/each';
import moment from 'moment';
import { EVENTS } from './constants/events';
import allEggs from './eggs';
import {
drops as dropPotions,
premium as premiumPotions,
wacky as wackyPotions,
} from './hatching-potions';
import allPotions from './hatching-potions';
import t from './translation';
const STABLE_RELEASE_DATES = {
};
const petInfo = {};
const mountInfo = {};
@@ -131,10 +123,10 @@ 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 [dropPets, dropMounts] = constructSet('drop', allEggs.drops, allPotions.drops);
const [premiumPets, premiumMounts] = constructSet('premium', allEggs.drops, allPotions.premium);
const [questPets, questMounts] = constructSet('quest', allEggs.quests, allPotions.drops);
const wackyPets = constructSet('wacky', allEggs.drops, allPotions.wacky, false);
const specialPets = {
'Wolf-Veteran': 'veteranWolf',

View File

@@ -1,10 +1,10 @@
import allEggs from '../content/eggs';
import { drops as hatchingPotions } from '../content/hatching-potions';
import allPotions from '../content/hatching-potions';
import randomVal from '../libs/randomVal';
export default function firstDrops (user) {
const eggDrop = randomVal(allEggs.drops);
const potionDrop = randomVal(hatchingPotions);
const potionDrop = randomVal(allPotions.drops);
user.items.eggs = {
...user.items.eggs,