diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index 28deb61463..99fc90164a 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -162,5 +162,10 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL', User.set('items.currentMount', (user.items.currentMount == mount) ? '' : mount); } + $scope.equip = function(user, item, costume) { + var equipTo = costume ? 'costume' : 'equipped'; + User.set('items.gear.' + equipTo + '.' + item.type, item.key); + } + } ]); \ No newline at end of file diff --git a/src/models/user.js b/src/models/user.js index d46db203b0..5da8e612d9 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -114,12 +114,18 @@ var UserSchema = new Schema({ m[v.key]['default'] = true; }), - current: { + equipped: { weapon: {type: String, 'default': 'weapon_warrior_0'}, armor: {type: String, 'default': 'armor_warrior_0'}, head: {type: String, 'default': 'head_warrior_0'}, shield: {type: String, 'default': 'shield_warrior_0'} - } + }, + costume: { + weapon: {type: String, 'default': 'weapon_warrior_0'}, + armor: {type: String, 'default': 'armor_warrior_0'}, + head: {type: String, 'default': 'head_warrior_0'}, + shield: {type: String, 'default': 'shield_warrior_0'} + }, }, // -------------- Animals ------------------- @@ -209,7 +215,8 @@ var UserSchema = new Schema({ skin: {type:String, 'default':'white'}, timezoneOffset: Number, language: String, - automaticAllocation: Boolean + automaticAllocation: Boolean, + useCostume: Boolean }, profile: { blurb: String, diff --git a/views/options/inventory/inventory.jade b/views/options/inventory/inventory.jade index 8547ddfdef..52989257fb 100644 --- a/views/options/inventory/inventory.jade +++ b/views/options/inventory/inventory.jade @@ -7,8 +7,16 @@ script(type='text/ng-template', id='partials/options.inventory.inventory.html') li.customize-menu menu.pets-menu(label='Gear') - div(ng-repeat='(k,v) in user.items.gear.owned') - button.customize-option(popover='{{Items.gear.flat[k].notes}}', popover-title='{{Items.gear.flat[k].text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='equip(v)', class='shop_{{v.key}}') + div(ng-repeat='(k,v) in user.items.gear.owned', ng-init='item = Items.gear.flat[k]') + 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}}') + label.checkbox.inline + input(type="checkbox", ng-model="user.preferences.costume") + | Use Custume  + 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') + menu.pets-menu(label='Gear') + div(ng-repeat='(k,v) in user.items.gear.owned', ng-init='item = Items.gear.flat[k]') + 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}}') li.customize-menu menu.pets-menu(label='Eggs ({{eggCount}})') diff --git a/views/shared/header/avatar.jade b/views/shared/header/avatar.jade index e7cc90271b..204dd82ed1 100644 --- a/views/shared/header/avatar.jade +++ b/views/shared/header/avatar.jade @@ -8,14 +8,25 @@ figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember( // Mount Body span(ng-if='profile.items.currentMount', class='Mount_Body_{{profile.items.currentMount}}') + // Avatar span(class='skin_{{profile.preferences.skin}}') - span(class='{{profile.preferences.size}}_{{profile.items.gear.current.armor}}', ng-show='profile.preferences.showArmor') + + span(class='{{profile.preferences.size}}_{{profile.items.gear.equipped.armor}}', ng-if='!profile.preferences.costume') + span(class='{{profile.preferences.size}}_{{profile.items.gear.costume.armor}}', ng-if='profile.preferences.costume') + span(class='head_warrior_0') span(class='hair_base_{{profile.preferences.hair.base}}_{{profile.preferences.hair.color}}') span(class='hair_bangs_{{profile.preferences.hair.bangs}}_{{profile.preferences.hair.color}}') - span(class='{{profile.items.gear.current.head}}', ng-show='profile.preferences.showHelm') - span(class='{{profile.items.gear.current.shield}}', ng-show='profile.preferences.showShield') - span(class='{{profile.items.gear.current.weapon}}', ng-show='profile.preferences.showWeapon') + + span(class='{{profile.items.gear.equipped.head}}', ng-if='!profile.preferences.costume') + span(class='{{profile.items.gear.costume.head}}', ng-if='profile.preferences.costume') + + span(class='{{profile.items.gear.equipped.shield}}', ng-if='!profile.preferences.costume') + span(class='{{profile.items.gear.costume.shield}}', ng-if='profile.preferences.costume') + + span(class='{{profile.items.gear.equipped.weapon}}', ng-if='!profile.preferences.costume') + span(class='{{profile.items.gear.costume.weapon}}', ng-if='profile.preferences.costume') + // Mount Head span(ng-if='profile.items.currentMount', class='Mount_Head_{{profile.items.currentMount}}')