mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
feat(achievements): new pet-related cheevos
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import content from '../content/index';
|
||||
import i18n from '../i18n';
|
||||
import findIndex from 'lodash/findIndex';
|
||||
import get from 'lodash/get';
|
||||
import {
|
||||
BadRequest,
|
||||
@@ -39,6 +40,15 @@ module.exports = function hatch (user, req = {}) {
|
||||
user.markModified('items.hatchingPotions');
|
||||
}
|
||||
|
||||
if (!user.achievements.backToBasics) {
|
||||
const petIndex = findIndex(content.basePetsMounts, (animal) => {
|
||||
return isNaN(user.items.pets[animal]) || user.items.pets[animal] <= 0;
|
||||
});
|
||||
if (petIndex === -1) {
|
||||
user.achievements.backToBasics = true;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
user.items,
|
||||
i18n.t('messageHatched', req.language),
|
||||
|
||||
Reference in New Issue
Block a user