mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
[#1476] re-order "you already have this combo" message to bail early
This commit is contained in:
parent
a461bda7b8
commit
55dffcc317
2 changed files with 10 additions and 13 deletions
|
|
@ -16,18 +16,18 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User',
|
|||
}
|
||||
|
||||
$scope.pour = function(){
|
||||
var pet = $scope.selectedEgg.name + '-' + $scope.selectedPotion;
|
||||
|
||||
if(User.user.items.pets && ~User.user.items.pets.indexOf(pet)) {
|
||||
return alert("You already have that pet, hatch a different combo.")
|
||||
}
|
||||
|
||||
var i = _.indexOf($scope.userEggs, $scope.selectedEgg);
|
||||
$scope.userEggs.splice(i, 1);
|
||||
|
||||
i = _.indexOf($scope.userHatchingPotions, $scope.selectedPotion);
|
||||
$scope.userHatchingPotions.splice(i, 1);
|
||||
|
||||
var pet = $scope.selectedEgg.name + '-' + $scope.selectedPotion;
|
||||
|
||||
if(User.user.items.pets && User.user.items.pets.indexOf(pet) != -1) {
|
||||
return alert("You already have that pet, hatch a different combo.")
|
||||
}
|
||||
|
||||
if(!User.user.items.pets) User.user.items.pets = [];
|
||||
User.user.items.pets.push(pet);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@
|
|||
h3 Hatch Your Egg
|
||||
p(ng-show='userHatchingPotions.length < 1') You don't have any hatching potions yet.
|
||||
div(ng-show='userHatchingPotions')
|
||||
p
|
||||
| Which hatching potion will you pour on your
|
||||
| <b> {{selectedEgg.text}} </b>
|
||||
| egg?
|
||||
form
|
||||
select(ng-options='hatchingPotion for hatchingPotion in userHatchingPotions', ng-model="selectedPotion")
|
||||
button(ng-click="pour()") Pour
|
||||
p.
|
||||
Which hatching potion will you pour on your <b>{{selectedEgg.text}}</b> egg?
|
||||
select(ng-options='hatchingPotion for hatchingPotion in userHatchingPotions', ng-model="selectedPotion")
|
||||
button(ng-click="pour()") Pour
|
||||
|
|
|
|||
Loading…
Reference in a new issue