drops: description on combining eggs/potions, selling to

alex. de-selectable drops. sell in a button of alex's dialog
This commit is contained in:
Tyler Renelle
2013-10-19 23:44:03 -07:00
parent e4f2a4386d
commit 2cf814acd6
2 changed files with 22 additions and 10 deletions

View File

@@ -9,6 +9,9 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User',
$scope.selectedPotion = null; // {index: 5, name: "Red", value: 3} $scope.selectedPotion = null; // {index: 5, name: "Red", value: 3}
$scope.chooseEgg = function(egg, $index){ $scope.chooseEgg = function(egg, $index){
if ($scope.selectedEgg && $scope.selectedEgg.index == $index) {
return $scope.selectedEgg = null; // clicked same egg, unselect
}
var eggData = _.defaults({index:$index}, egg); var eggData = _.defaults({index:$index}, egg);
if (!$scope.selectedPotion) { if (!$scope.selectedPotion) {
$scope.selectedEgg = eggData; $scope.selectedEgg = eggData;
@@ -18,6 +21,9 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User',
} }
$scope.choosePotion = function(potion, $index){ $scope.choosePotion = function(potion, $index){
if ($scope.selectedPotion && $scope.selectedPotion.index == $index) {
return $scope.selectedPotion = null; // clicked same egg, unselect
}
// we really didn't think through the way these things are stored and getting passed around... // we really didn't think through the way these things are stored and getting passed around...
var potionData = _.findWhere(window.habitrpgShared.items.items.hatchingPotions, {name:potion}); var potionData = _.findWhere(window.habitrpgShared.items.items.hatchingPotions, {name:potion});
potionData = _.defaults({index:$index}, potionData); potionData = _.defaults({index:$index}, potionData);
@@ -52,8 +58,11 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User',
return User.user.items.pets && ~User.user.items.pets.indexOf(pet) return User.user.items.pets && ~User.user.items.pets.indexOf(pet)
} }
$scope.selectableInventory = function(egg, potion) { $scope.selectableInventory = function(egg, potion, $index) {
if (!egg || !potion) return; if (!egg || !potion) return;
// FIXME this isn't updating the view for some reason
//if ($scope.selectedEgg && $scope.selectedEgg.index == $index) return 'selectableInventory';
//if ($scope.selectedPotion && $scope.selectedPotion.index == $index) return 'selectableInventory';
if (!$scope.ownsPet(egg, potion)) return 'selectableInventory'; if (!$scope.ownsPet(egg, potion)) return 'selectableInventory';
} }

View File

@@ -1,18 +1,19 @@
.row-fluid(ng-controller='InventoryCtrl') .row-fluid(ng-controller='InventoryCtrl')
.span6.border-right .span6.border-right
h2 Inventory h2 Inventory
p.well Combine eggs with hatching potions to make pets by clicking an egg and then a potion. Sell unwanted drops to Alexander the Merchant.
menu.inventory-list(type='list') menu.inventory-list(type='list')
li.customize-menu li.customize-menu
menu.pets-menu(label='Eggs ({{userEggs.length}})') menu.pets-menu(label='Eggs ({{userEggs.length}})')
p(ng-show='userEggs.length < 1') You don't have any eggs yet. p(ng-show='userEggs.length < 1') You don't have any eggs yet.
div(ng-repeat='egg in userEggs track by $index') div(ng-repeat='egg in userEggs track by $index')
button.customize-option(tooltip='{{egg.text}}', ng-click='chooseEgg(egg, $index)', class='Pet_Egg_{{egg.name}}', ng-class='selectableInventory(egg, selectedPotion.name)') button.customize-option(tooltip='{{egg.text}}', ng-click='chooseEgg(egg, $index)', class='Pet_Egg_{{egg.name}}', ng-class='selectableInventory(egg, selectedPotion.name, $index)')
p {{egg.text}} p {{egg.text}}
li.customize-menu li.customize-menu
menu.hatchingPotion-menu(label='Hatching Potions ({{userHatchingPotions.length}})') menu.hatchingPotion-menu(label='Hatching Potions ({{userHatchingPotions.length}})')
p(ng-show='userHatchingPotions.length < 1') You don't have any hatching potions yet. p(ng-show='userHatchingPotions.length < 1') You don't have any hatching potions yet.
div(ng-repeat='hatchingPotion in userHatchingPotions track by $index') div(ng-repeat='hatchingPotion in userHatchingPotions track by $index')
button.customize-option(tooltip='{{hatchingPotion}}', ng-click='choosePotion(hatchingPotion, $index)', class='Pet_HatchingPotion_{{hatchingPotion}}', ng-class='selectableInventory(selectedEgg, hatchingPotion)') button.customize-option(tooltip='{{hatchingPotion}}', ng-click='choosePotion(hatchingPotion, $index)', class='Pet_HatchingPotion_{{hatchingPotion}}', ng-class='selectableInventory(selectedEgg, hatchingPotion, $index)')
p {{hatchingPotion}} p {{hatchingPotion}}
.span6 .span6
@@ -21,18 +22,20 @@
table.NPC-Alex-container table.NPC-Alex-container
tr tr
td td
button.customize-option.sell-inventory(ng-show='selectedEgg', ng-click='sellInventory()') .NPC-Alex.pull-left
| Sell {{selectedEgg.name}} for {{selectedEgg.value}} GP
button.customize-option.sell-inventory(ng-show='selectedPotion', ng-click='sellInventory()')
| Sell {{selectedPotion.name}} for {{selectedPotion.value}} GP
.NPC-Alex.pull-left(ng-show='!selectedEgg && !selectedPotion')
td td
.popover.static-popover.fade.right.in .popover.static-popover.fade.right.in
.arrow .arrow
h3.popover-title h3.popover-title
a(target='_blank', href='http://www.kickstarter.com/profile/523661924') Alexander Augustin a(target='_blank', href='http://www.kickstarter.com/profile/523661924') Alexander the Merchant
.popover-content .popover-content
| Welcome to the Market! I'm the merchant, Alexander. Dying to get that particular pet you're after, but don't want to wait for it to drop? Buy it here! p
| Welcome to the Market. Dying to get that particular pet you're after, but don't want to wait for it to drop? Buy it here! If you have unwanted drops, sell them to me.
p
button.btn.btn-primary(ng-show='selectedEgg', ng-click='sellInventory()')
| Sell {{selectedEgg.name}} for {{selectedEgg.value}} GP
button.btn.btn-primary(ng-show='selectedPotion', ng-click='sellInventory()')
| Sell {{selectedPotion.name}} for {{selectedPotion.value}} GP
menu.inventory-list(type='list') menu.inventory-list(type='list')
li.customize-menu li.customize-menu