Add functionality to dequip all Battle Gear or Cosutme.

This commit is contained in:
kholliday
2015-03-05 09:40:37 -06:00
parent f28bc31a2c
commit 11f61c2732
2 changed files with 18 additions and 7 deletions

View File

@@ -234,16 +234,25 @@ habitrpg.controller("InventoryCtrl",
return filteredArray;
};
$scope.dequip = function(){
$scope.dequip = function(gearSet){
if ( gearSet == "battleGear" ) {
for ( item in user.items.gear.equipped ){
var itemKey = user.items.gear.equipped[item];
if ( user.items.gear.owned[itemKey] ) {
user.ops.equip({params: {key: itemKey}});
}
}
}
user.preferences.background = "";
if ( gearSet == "costume" ) {
for ( item in user.items.gear.costume ){
var itemKey = user.items.gear.costume[item];
if ( user.items.gear.owned[itemKey] ) {
user.ops.equip({params: {type:"costume", key: itemKey}});
}
}
}
}
}

View File

@@ -3,7 +3,7 @@ script(type='text/ng-template', id='partials/options.inventory.equipment.html')
.row
.col-md-6.border-right
h3.equipment-title.hint(popover-trigger='mouseenter', popover-placement='top', popover-append-to-body='true', popover=env.t('battleGearText'))=env.t('battleGear')
div(ng-click='dequip();')
div(ng-click='dequip("battleGear");')
button {{env.t("dequipAll")}}
li.customize-menu.inventory-gear
menu.pets-menu(label='{{::label}}', ng-repeat='(klass,label) in {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer"), special:env.t("special"), mystery:env.t("mystery")}', ng-show='gear[klass]')
@@ -16,6 +16,8 @@ script(type='text/ng-template', id='partials/options.inventory.equipment.html')
input(type="checkbox", ng-model="user.preferences.costume", ng-change='set({"preferences.costume":user.preferences.costume ? true : false})')
| 
=env.t('useCostume')
div(ng-click='dequip("costume");')
button {{env.t("dequipAll")}}
li.customize-menu(ng-if='user.preferences.costume')
menu.pets-menu(label='{{::label}}', ng-repeat='(klass,label) in {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer"), special:env.t("special"), mystery:env.t("mystery")}', ng-show='gear[klass]')
div(ng-repeat='item in gear[klass]')