mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
chore(content): add Bone to Pick achievement (#14318)
* chore(content): add Bone to Pick achievement * chore(content): update spritesmith-main.css * chore(content): add more bone picking * chore(content): more bone picking * chore(content): bone picking * chore(content): i gotta bone to pick here * chore(content): final bone picking * chore: add migration script * chore: update habitica-images Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -113,6 +113,34 @@ export default function hatch (user, req = {}, analytics) {
|
||||
});
|
||||
}
|
||||
|
||||
if (content.dropEggs[egg] || content.questEggs[egg]) {
|
||||
forEach(content.petSetCompleteAchievs, achievement => {
|
||||
if (hatchingPotion !== achievement.color) return;
|
||||
if (!user.achievements[achievement.petAchievement]) {
|
||||
const dropPetIndex = findIndex(
|
||||
keys(content.dropEggs),
|
||||
animal => !user.items.pets[`${animal}-${achievement.color}`] || user.items.pets[`${animal}-${achievement.color}`] <= 0,
|
||||
);
|
||||
const questPetIndex = findIndex(
|
||||
keys(content.questEggs),
|
||||
animal => !user.items.pets[`${animal}-${achievement.color}`] || user.items.pets[`${animal}-${achievement.color}`] <= 0,
|
||||
);
|
||||
if (dropPetIndex === -1 && questPetIndex === -1) {
|
||||
user.achievements[achievement.petAchievement] = true;
|
||||
if (user.addNotification) {
|
||||
const achievementString = `achievement${upperFirst(achievement.petAchievement)}`;
|
||||
user.addNotification(achievement.petNotificationType, {
|
||||
label: `${'achievement'}: ${achievementString}`,
|
||||
achievement: achievement.petAchievement,
|
||||
message: `${i18n.t('modalAchievement')} ${i18n.t(achievementString)}`,
|
||||
modalText: i18n.t(`${achievementString}ModalText`),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (analytics && moment().diff(user.auth.timestamps.created, 'days') < 7) {
|
||||
analytics.track('pet hatch', {
|
||||
uuid: user._id,
|
||||
|
||||
Reference in New Issue
Block a user