From b852d9a9f2cf34624e426988072db6a8b0a9d418 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Fri, 6 Dec 2013 11:46:07 -0700 Subject: [PATCH] classes #943 more general solution to two-handed weapons habitrpg-shared#41da82f --- public/js/controllers/inventoryCtrl.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index ac9171e100..84e0ebff56 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -182,11 +182,13 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL', $scope.equip = function(user, item, costume) { var equipTo = costume ? 'costume' : 'equipped'; - if (~user.items.gear[equipTo].weapon.indexOf('wizard') && item.type == 'shield') - return Notification.text('Staves are two-handed'); + if (item.type == 'shield') { + var weapon = Items.items.gear.flat[user.items.gear[equipTo].weapon]; + if (weapon && weapon.twoHanded) return Notification.text(weapon.text + ' is two-handed'); + } var setVars = {}; setVars['items.gear.' + equipTo + '.' + item.type] = item.key; - if (item.klass == 'wizard') + if (item.twoHanded) setVars['items.gear.' + equipTo + '.shield'] = 'warrior_shield_0'; User.setMultiple(setVars); }