mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
classes armory: separate gear listings by class type, show selected gear
This commit is contained in:
@@ -2,6 +2,7 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
function($rootScope, $scope, User, API_URL, $http, Notification) {
|
function($rootScope, $scope, User, API_URL, $http, Notification) {
|
||||||
|
|
||||||
var user = User.user;
|
var user = User.user;
|
||||||
|
var Items = window.habitrpgShared.items;
|
||||||
|
|
||||||
// convenience vars since these are accessed frequently
|
// convenience vars since these are accessed frequently
|
||||||
|
|
||||||
@@ -17,11 +18,28 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
$scope.$watch('user.items.hatchingPotions', function(pots){ $scope.potCount = countStacks(pots); }, true);
|
$scope.$watch('user.items.hatchingPotions', function(pots){ $scope.potCount = countStacks(pots); }, true);
|
||||||
$scope.$watch('user.items.food', function(food){ $scope.foodCount = countStacks(food); }, true);
|
$scope.$watch('user.items.food', function(food){ $scope.foodCount = countStacks(food); }, true);
|
||||||
|
|
||||||
|
$scope.$watch('user.items.gear', function(gear){
|
||||||
|
$scope.gear = {
|
||||||
|
base: [
|
||||||
|
Items.items.gear.flat['head_warrior_0'],
|
||||||
|
Items.items.gear.flat['armor_warrior_0'],
|
||||||
|
//Items.items.gear.flat['weapon_warrior_0'],
|
||||||
|
Items.items.gear.flat['shield_warrior_0']
|
||||||
|
]
|
||||||
|
};
|
||||||
|
_.each(gear.owned, function(bool,key){
|
||||||
|
var item = Items.items.gear.flat[key];
|
||||||
|
debugger;
|
||||||
|
if (!$scope.gear[item.klass]) $scope.gear[item.klass] = [];
|
||||||
|
$scope.gear[item.klass].push(item);
|
||||||
|
})
|
||||||
|
}, true)
|
||||||
|
|
||||||
$scope.chooseEgg = function(egg){
|
$scope.chooseEgg = function(egg){
|
||||||
if ($scope.selectedEgg && $scope.selectedEgg.name == egg) {
|
if ($scope.selectedEgg && $scope.selectedEgg.name == egg) {
|
||||||
return $scope.selectedEgg = null; // clicked same egg, unselect
|
return $scope.selectedEgg = null; // clicked same egg, unselect
|
||||||
}
|
}
|
||||||
var eggData = _.findWhere(window.habitrpgShared.items.items.eggs, {name:egg});
|
var eggData = _.findWhere(Items.items.eggs, {name:egg});
|
||||||
if (!$scope.selectedPotion) {
|
if (!$scope.selectedPotion) {
|
||||||
$scope.selectedEgg = eggData;
|
$scope.selectedEgg = eggData;
|
||||||
} else {
|
} else {
|
||||||
@@ -34,7 +52,7 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
return $scope.selectedPotion = null; // clicked same egg, unselect
|
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(Items.items.hatchingPotions, {name:potion});
|
||||||
if (!$scope.selectedEgg) {
|
if (!$scope.selectedEgg) {
|
||||||
$scope.selectedPotion = potionData;
|
$scope.selectedPotion = potionData;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,18 +5,19 @@ script(type='text/ng-template', id='partials/options.inventory.inventory.html')
|
|||||||
p.well Click an egg to see usable potions highlighted in green and then click one of the highlighted potions to hatch your pet. If no potions are highlighted, click that egg again to deselect it, and instead click a potion first to have the usable eggs highlighted. You can also sell unwanted drops to Alexander the Merchant.
|
p.well Click an egg to see usable potions highlighted in green and then click one of the highlighted potions to hatch your pet. If no potions are highlighted, click that egg again to deselect it, and instead click a potion first to have the usable eggs highlighted. You can also sell unwanted drops to Alexander the Merchant.
|
||||||
menu.inventory-list(type='list')
|
menu.inventory-list(type='list')
|
||||||
|
|
||||||
|
h4 Gear
|
||||||
li.customize-menu
|
li.customize-menu
|
||||||
menu.pets-menu(label='Gear')
|
menu.pets-menu(label='{{label}}', ng-repeat='(klass,label) in {base:"Base", warrior:"Warrior", wizard:"Wizard", rogue:"Rogue", special:"Special"}', ng-show='gear[klass]')
|
||||||
div(ng-repeat='(k,v) in user.items.gear.owned', ng-init='item = Items.gear.flat[k]')
|
div(ng-repeat='item in gear[klass]')
|
||||||
button.customize-option(popover='{{item.notes}}', popover-title='{{item.text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='equip(user,item)', class='shop_{{item.key}}')
|
button.customize-option(popover='{{item.notes}}', popover-title='{{item.text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='equip(user,item)', class='shop_{{item.key}}', ng-class='{selectableInventory: user.items.gear.equipped[item.type] == item.key}')
|
||||||
label.checkbox.inline
|
label.checkbox.inline
|
||||||
input(type="checkbox", ng-model="user.preferences.costume")
|
input(type="checkbox", ng-model="user.preferences.costume")
|
||||||
| Use Costume
|
| Use Costume
|
||||||
i.icon-question-sign(popover="Show something different on your avatar than the gear you have equipped for battle", popover-trigger='mouseenter', popover-placement='right')
|
i.icon-question-sign(popover="Show something different on your avatar than the gear you have equipped for battle", popover-trigger='mouseenter', popover-placement='right')
|
||||||
li.customize-menu(ng-if='user.preferences.costume')
|
li.customize-menu(ng-if='user.preferences.costume')
|
||||||
menu.pets-menu(label='Gear')
|
menu.pets-menu(label='{{label}}', ng-repeat='(klass,label) in {base:"Base", warrior:"Warrior", wizard:"Wizard", rogue:"Rogue", special:"Special"}', ng-show='gear[klass]')
|
||||||
div(ng-repeat='(k,v) in user.items.gear.owned', ng-init='item = Items.gear.flat[k]')
|
div(ng-repeat='item in gear[klass]')
|
||||||
button.customize-option(popover='{{item.notes}}', popover-title='{{item.text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='equip(user,item,true)', class='shop_{{item.key}}')
|
button.customize-option(popover='{{item.notes}}', popover-title='{{item.text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='equip(user,item, true)', class='shop_{{item.key}}', ng-class='{selectableInventory: user.items.gear.costume[item.type] == item.key}')
|
||||||
|
|
||||||
li.customize-menu
|
li.customize-menu
|
||||||
menu.pets-menu(label='Eggs ({{eggCount}})')
|
menu.pets-menu(label='Eggs ({{eggCount}})')
|
||||||
|
|||||||
Reference in New Issue
Block a user