fix(modals): SM modal fixes

Fixes #6253, allows quest pets to appear in hatching and raising modals, and makes code for deciding whether or not to show a generic levelup modal a bit more readable per comments on #6042.
This commit is contained in:
Sabe Jones
2015-11-17 16:56:11 -05:00
parent 8b7f50bfcf
commit f5f33bd1b9
3 changed files with 12 additions and 7 deletions

View File

@@ -116,7 +116,7 @@ habitrpg.controller("InventoryCtrl",
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});
if (!user.preferences.suppressModals.hatchPet) {
$rootScope.hatchedPet = {egg: eggName, potion: potName, eggKey: egg.key, pet: 'Pet-' + egg.key + '-' + potion.key};
$rootScope.hatchedPet = {egg: eggName, potion: potName, potionKey:potion.key, eggKey: egg.key, pet: 'Pet-' + egg.key + '-' + potion.key};
$rootScope.openModal('hatchPet', {controller: 'InventoryCtrl', size: 'sm'});
}
$scope.selectedEgg = null;
@@ -150,7 +150,7 @@ habitrpg.controller("InventoryCtrl",
// Feeding Pet
if ($scope.selectedFood) {
var food = $scope.selectedFood;
var startingMounts = $scope.mountCount;
var startingMounts = Stats.totalCount(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()}))) {
@@ -160,7 +160,7 @@ habitrpg.controller("InventoryCtrl",
$scope.selectedFood = null;
_updateDropAnimalCount(user.items);
if ($scope.mountCount > startingMounts && !user.preferences.suppressModals.raisePet) {
if (Stats.totalCount(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
$rootScope.raisedPet = {displayName: petDisplayName, spriteName: pet, egg: egg, potion: potion}
$rootScope.openModal('raisePet', {controller:'InventoryCtrl',size:'sm'});
}