mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
refactor(modals): More readable invalid hatch check
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user