mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57: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,
|
||||
@@ -89,6 +90,15 @@ module.exports = function feed (user, req = {}) {
|
||||
user.items.food[food.key]--;
|
||||
if (user.markModified) user.markModified('items.food');
|
||||
|
||||
if (!user.achievements.allYourBase) {
|
||||
const mountIndex = findIndex(content.basePetsMounts, (animal) => {
|
||||
return !user.items.mounts[animal];
|
||||
});
|
||||
if (mountIndex === -1) {
|
||||
user.achievements.allYourBase = true;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
userPets[pet.key],
|
||||
message,
|
||||
|
||||
@@ -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