feat(achievements): new pet-related cheevos

This commit is contained in:
Sabe Jones
2019-06-04 10:31:25 -05:00
parent 74c93955f8
commit 7094e75dd8
16 changed files with 197 additions and 37 deletions

View File

@@ -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),