mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
This reverts commit 485584c144.
# Conflicts:
# website/common/script/content/hatching-potions.js
27 lines
947 B
JavaScript
27 lines
947 B
JavaScript
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(eggs);
|
|
const potionDrop = randomVal(hatchingPotions);
|
|
|
|
user.items.eggs = {
|
|
...user.items.eggs,
|
|
[eggDrop.key]: user.items.eggs[eggDrop.key] || 0,
|
|
};
|
|
user.items.eggs[eggDrop.key] += 1;
|
|
if (user.markModified) user.markModified('items.eggs');
|
|
|
|
user.items.hatchingPotions = {
|
|
...user.items.hatchingPotions,
|
|
[potionDrop.key]: user.items.hatchingPotions[potionDrop.key] || 0,
|
|
};
|
|
user.items.hatchingPotions[potionDrop.key] += 1;
|
|
if (user.markModified) user.markModified('items.hatchingPotions');
|
|
|
|
if (user.addNotification) user.addNotification('FIRST_DROPS', { egg: eggDrop.key, hatchingPotion: potionDrop.key });
|
|
|
|
return ({ egg: eggDrop.key, hatchingPotion: potionDrop.key });
|
|
}
|