fix(modals): Show mount modal more often

Fixes #6288. Previously, we used a count of all properties within the user's items.pets.mounts to determine whether or not they'd gained a new mount. That would not work as expected if they had mounts with a null or false status, such as after using the Key to the Kennels. This commit also adds some tests to the inventory controller in Angular for pet raising.
This commit is contained in:
Sabe Jones
2015-11-24 16:54:59 -05:00
parent e04066e45f
commit 28205663e4
2 changed files with 78 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ habitrpg.controller("InventoryCtrl",
// Feeding Pet
if ($scope.selectedFood) {
var food = $scope.selectedFood;
var startingMounts = Stats.totalCount(user.items.mounts);
var startingMounts = $rootScope.countExists(user.items.mounts);
if (food.key === 'Saddle') {
if (!$window.confirm(window.env.t('useSaddle', {pet: petDisplayName}))) return;
} else if (!$window.confirm(window.env.t('feedPet', {name: petDisplayName, article: food.article, text: food.text()}))) {
@@ -169,7 +169,7 @@ habitrpg.controller("InventoryCtrl",
$scope.selectedFood = null;
_updateDropAnimalCount(user.items);
if (Stats.totalCount(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
if ($rootScope.countExists(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
$scope.raisedPet = {
displayName: petDisplayName,
spriteName: pet,