mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
* Only unequip Gen 1 pets/mounts when releasing pets/mounts * Changed mount declaration to match releasePets * Check if a pet/mount is a drop type instead of checking for its name in the list of pets * Changed references to pet and mount to petInfo and mountInfo for consistency with releasePets and releaseMounts * Test that releasePets, releaseMounts, and releaseBoth do not unequip quest pets * Fixed test names, and tests verify that a pet/mount is/is not a drop pet/mount on release * Removed unneeded comments
This commit is contained in:
committed by
Blade Barringer
parent
2e2dc179c4
commit
d2756278c3
@@ -5,16 +5,19 @@ import {
|
||||
} from '../libs/errors';
|
||||
|
||||
module.exports = function releaseMounts (user, req = {}, analytics) {
|
||||
let mount;
|
||||
|
||||
if (user.balance < 1) {
|
||||
throw new NotAuthorized(i18n.t('notEnoughGems', req.language));
|
||||
}
|
||||
|
||||
user.balance -= 1;
|
||||
user.items.currentMount = '';
|
||||
|
||||
for (mount in content.pets) {
|
||||
let mountInfo = content.mountInfo[user.items.currentMount];
|
||||
|
||||
if (mountInfo && mountInfo.type === 'drop') {
|
||||
user.items.currentMount = '';
|
||||
}
|
||||
|
||||
for (let mount in content.pets) {
|
||||
user.items.mounts[mount] = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user