diff --git a/website/client-old/js/controllers/memberModalCtrl.js b/website/client-old/js/controllers/memberModalCtrl.js index 33ac854ba1..f1d20b1041 100644 --- a/website/client-old/js/controllers/memberModalCtrl.js +++ b/website/client-old/js/controllers/memberModalCtrl.js @@ -1,8 +1,8 @@ "use strict"; habitrpg - .controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', 'Chat', '$controller', 'Stats', - function($scope, $rootScope, Members, Shared, $http, Notification, Groups, Chat, $controller, Stats) { + .controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', 'Chat', '$controller', 'Stats', 'Costume', + function($scope, $rootScope, Members, Shared, $http, Notification, Groups, Chat, $controller, Stats, Costume) { $controller('RootCtrl', {$scope: $scope}); $rootScope.appLoaded = true; @@ -20,11 +20,14 @@ habitrpg } }); - $scope.keyDownListener = function (e) { - if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { - $scope.sendPrivateMessage($scope.profile._id, $scope._message); - } - }; + $scope.costume = Costume; + + $scope.keyDownListener = function (e) { + if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { + $scope.sendPrivateMessage($scope.profile._id, $scope._message); + } + }; + $scope.sendPrivateMessage = function(uuid, message){ if (!message) return; diff --git a/website/client-old/js/controllers/userCtrl.js b/website/client-old/js/controllers/userCtrl.js index b2bb641c15..a7faafd241 100644 --- a/website/client-old/js/controllers/userCtrl.js +++ b/website/client-old/js/controllers/userCtrl.js @@ -1,7 +1,7 @@ "use strict"; -habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$http', '$state', 'Guide', 'Shared', 'Content', 'Stats', 'Social', - function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats, Social) { +habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$http', '$state', 'Guide', 'Shared', 'Content', 'Stats', 'Social', 'Costume', + function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats, Social, Costume) { $scope.profile = User.user; $scope.statCalc = Stats; @@ -15,6 +15,8 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$ $scope.$watch('_editing.profile', function(value){ if(value === true) $scope.editingProfile = angular.copy(User.user.profile); }); + + $scope.costume = Costume; $scope.allocate = function(stat){ User.allocate({query:{stat:stat}}); diff --git a/website/client-old/js/services/costumeServices.js b/website/client-old/js/services/costumeServices.js new file mode 100644 index 0000000000..5fcd37b50c --- /dev/null +++ b/website/client-old/js/services/costumeServices.js @@ -0,0 +1,44 @@ +'use strict'; + +(function(){ + angular + .module('habitrpg') + .factory('Costume', costumeFactory); + + costumeFactory.$inject = [ + 'Content' + ]; + + function costumeFactory(Content) { + + function formatAnimal(name, type) { + if(type === 'pet') { + if(Content.petInfo.hasOwnProperty(name)) { + return Content.petInfo[name].text(); + } else { + return window.env.t('noActivePet'); + } + } else if(type === 'mount') { + if(Content.mountInfo.hasOwnProperty(name)) { + return Content.mountInfo[name].text(); + } else { + return window.env.t('noActiveMount'); + } + } + } + + function formatBackground(background) { + var bg = Content.appearances.background; + + if(bg.hasOwnProperty(background)) { + return bg[background].text() + ' (' + window.env.t(bg[background].set.text) + ')'; + } + return window.env.t('noBackground'); + } + + return { + formatAnimal: formatAnimal, + formatBackground: formatBackground + }; + } +}()); diff --git a/website/client-old/manifest.json b/website/client-old/manifest.json index d0725ede30..d2ce5704cb 100644 --- a/website/client-old/manifest.json +++ b/website/client-old/manifest.json @@ -65,6 +65,7 @@ "js/services/userServices.js", "js/services/hallServices.js", "js/services/pusherService.js", + "js/services/costumeServices.js", "js/services/achievementServices.js", "js/filters/money.js", diff --git a/website/common/locales/en/backgrounds.json b/website/common/locales/en/backgrounds.json index 9c1e2ab894..4d720a82fe 100644 --- a/website/common/locales/en/backgrounds.json +++ b/website/common/locales/en/backgrounds.json @@ -1,5 +1,7 @@ { "backgrounds": "Backgrounds", + "background": "Background", + "noBackground": "No Background Selected", "backgrounds062014": "SET 1: Released June 2014", "backgroundBeachText":"Beach", diff --git a/website/common/locales/en/pets.json b/website/common/locales/en/pets.json index 9fc704385a..8bf737a90b 100644 --- a/website/common/locales/en/pets.json +++ b/website/common/locales/en/pets.json @@ -1,10 +1,14 @@ { "pets": "Pets", + "activePet": "Active Pet", + "noActivePet": "No Active Pet", "petsFound": "Pets Found", "magicPets": "Magic Potion Pets", "rarePets": "Rare Pets", "questPets": "Quest Pets", "mounts": "Mounts", + "activeMount": "Active Mount", + "noActiveMount": "No Active Mount", "mountsTamed": "Mounts Tamed", "questMounts": "Quest Mounts", "magicMounts": "Magic Potion Mounts", diff --git a/website/views/shared/profiles/stats/background.jade b/website/views/shared/profiles/stats/background.jade new file mode 100644 index 0000000000..ce0b350b03 --- /dev/null +++ b/website/views/shared/profiles/stats/background.jade @@ -0,0 +1,4 @@ +div + h4=env.t('background') + table.table.table-striped + +basicRow('background', '{{costume.formatBackground(profile.preferences.background)}}') \ No newline at end of file diff --git a/website/views/shared/profiles/stats/costume.jade b/website/views/shared/profiles/stats/costume.jade new file mode 100644 index 0000000000..3350320bab --- /dev/null +++ b/website/views/shared/profiles/stats/costume.jade @@ -0,0 +1,6 @@ +div(ng-if='profile.preferences.costume') + h4=env.t('costume') + table.table.table-striped + tr(ng-repeat='(itemType,costume) in profile.items.gear.costume', ng-init='piece=Content.gear.flat[costume]', ng-show='piece') + td + strong {{piece.text()}} \ No newline at end of file diff --git a/website/views/shared/profiles/stats/equipment.jade b/website/views/shared/profiles/stats/equipment.jade index 08486dec27..d5fddfa4b8 100644 --- a/website/views/shared/profiles/stats/equipment.jade +++ b/website/views/shared/profiles/stats/equipment.jade @@ -1,10 +1,8 @@ -unless mobile - h4.stats-equipment(class=mobile?'item item-divider':'', - ng-show='user.flags.itemsEnabled')=env.t('equipment') - table.table.table-striped(ng-show='user.flags.itemsEnabled') - tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped', - ng-init='piece=Content.gear.flat[gear]', ng-show='piece') - td - strong {{piece.text()}} - strong(ng-show='piece.str || piece.con || piece.per || piece.int') :  - span(ng-repeat='stat in ["str","con","per","int"]', ng-show='piece[stat]') {{piece[stat]}} {{env.t(stat)}}  +h4.stats-equipment(ng-show='user.flags.itemsEnabled')=env.t('battleGear') +table.table.table-striped(ng-show='user.flags.itemsEnabled') + tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped', + ng-init='piece=Content.gear.flat[gear]', ng-show='piece') + td + strong {{piece.text()}} + strong(ng-show='piece.str || piece.con || piece.per || piece.int') :  + span(ng-repeat='stat in ["str","con","per","int"]', ng-show='piece[stat]') {{piece[stat]}} {{env.t(stat)}}  diff --git a/website/views/shared/profiles/stats/mixins.jade b/website/views/shared/profiles/stats/mixins.jade index 73f2ea0e4b..e44999c80d 100644 --- a/website/views/shared/profiles/stats/mixins.jade +++ b/website/views/shared/profiles/stats/mixins.jade @@ -10,4 +10,4 @@ mixin statList(calculatedStat, popover, text, useOneTimeBinding) span.hint(popover-title=env.t('#{popover}'), popover-trigger='mouseenter', popover-placement='top', popover=env.t('#{popover}Text')) =env.t(text) - =': {{' + binding + calculatedStat + '}}' + =': {{' + binding + calculatedStat + '}}' \ No newline at end of file diff --git a/website/views/shared/profiles/stats/pets-and-mounts.jade b/website/views/shared/profiles/stats/pets-and-mounts.jade index 3d4817d338..47575dcd2e 100644 --- a/website/views/shared/profiles/stats/pets-and-mounts.jade +++ b/website/views/shared/profiles/stats/pets-and-mounts.jade @@ -2,11 +2,13 @@ div(ng-if='user.flags.dropsEnabled') h4(class=mobile?'item item-divider':'')=env.t('pets') table.table.table-striped + +basicRow('activePet', '{{::costume.formatAnimal(profile.items.currentPet, \'pet\')}}')(ng-if='profile.items.currentPet') +basicRow('petsFound','{{::statCalc.totalCount(profile.items.pets)}}') +basicRow('beastMasterProgress','{{::statCalc.beastMasterProgress(profile.items.pets)}}') h4(class=mobile?'item item-divider':'')=env.t('mounts') table.table.table-striped + +basicRow('activeMount', '{{::costume.formatAnimal(profile.items.currentMount, \'mount\')}}')(ng-if='profile.items.currentMount') +basicRow('mountsTamed','{{::statCalc.totalCount(profile.items.mounts)}}') +basicRow('mountMasterProgress','{{::statCalc.mountMasterProgress(profile.items.mounts)}}') diff --git a/website/views/shared/profiles/stats_all.jade b/website/views/shared/profiles/stats_all.jade index 90fb2a1179..243643a244 100644 --- a/website/views/shared/profiles/stats_all.jade +++ b/website/views/shared/profiles/stats_all.jade @@ -3,4 +3,6 @@ include ./stats/mixins include ./stats/basic-stats include ./stats/equipment include ./stats/attributes +include ./stats/costume +include ./stats/background include ./stats/pets-and-mounts diff --git a/website/views/shared/profiles/stats_col1.jade b/website/views/shared/profiles/stats_col1.jade index c4b05c9194..f5ee3990e4 100644 --- a/website/views/shared/profiles/stats_col1.jade +++ b/website/views/shared/profiles/stats_col1.jade @@ -2,4 +2,6 @@ include ./stats/mixins include ./stats/basic-stats include ./stats/equipment +include ./stats/costume +include ./stats/background include ./stats/pets-and-mounts