Only unequip Gen 1 pets/mounts when releasing pets/mounts, fixes #5366 (#8119)

* 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:
Alyssa Batula
2016-10-20 23:00:15 -04:00
committed by Blade Barringer
parent 2e2dc179c4
commit d2756278c3
6 changed files with 81 additions and 11 deletions

View File

@@ -10,7 +10,12 @@ module.exports = function releasePets (user, req = {}, analytics) {
}
user.balance -= 1;
user.items.currentPet = '';
let petInfo = content.petInfo[user.items.currentPet];
if (petInfo && petInfo.type === 'drop') {
user.items.currentPet = '';
}
for (let pet in content.pets) {
user.items.pets[pet] = 0;