refactor(modals): More readable invalid hatch check

This commit is contained in:
Sabe Jones
2015-12-07 16:00:52 -05:00
parent 0f578b79ff
commit dd4ca5c476

View File

@@ -115,12 +115,12 @@ habitrpg.controller("InventoryCtrl",
var potName = Content.hatchingPotions[potion.key].text();
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
var invalidPet = (user.items.pets[egg.key + '-' + potion.key] > 0) ||
(Content.hatchingPotions[potion.key].premium && !Content.dropEggs[egg.key])
var userHasPet = user.items.pets[egg.key + '-' + potion.key] > 0;
var isPremiumPet = Content.hatchingPotions[potion.key].premium && !Content.dropEggs[egg.key];
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});
if (!user.preferences.suppressModals.hatchPet && !invalidPet) {
if (!user.preferences.suppressModals.hatchPet && !userHasPet && !isPremiumPet) {
$scope.hatchedPet = {
egg: eggName,
potion: potName,