classes: proper handling of items on class-switch, un-equipping items,

etc. Paves way for item-loss on death. See habitrpg-shared#acae9c3
This commit is contained in:
Tyler Renelle
2013-12-06 15:41:58 -07:00
parent b852d9a9f2
commit c51cdd0849
7 changed files with 44 additions and 34 deletions

View File

@@ -20,16 +20,10 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
$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']
]
base: _.where(Items.items.gear.flat, {klass: 'base'})
};
_.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);
})