Add Costume Info to member modal (#7768)

* Add localization strings

* Change name of Equipment section

* Add costume section to member modal

* Add costume section to member modal

* Add current pet and current mount info

* Reorder Sections and Separate Active Mounts/Pets

* switch ng-show with ng-if

* Add `noActiveMount` to pets.json

* Breaking Stuff

* Add petservices.js to the manifest

* Remove Extra Parenthesis

* Progress towards backgrounds

* Add semicolons

* Add background information

* Add all methods in petServices to userCtrl and memberModalCtrl

* Add avatar settings

* Add semicolons

* Revert "Add avatar settings"

This reverts commit 6e8cca9736.

* Remove active-pet-and-mount

* Remove Content from memberModalCtrl

* Update costumeServices.js

* Make costumeservices.js more readable

* Update costumeServices.js

* Update costumeService logic

* Remove unused strings

* Fix include statements

* move service

* Update pet/mount logic

* fixes

* Fix background logic
This commit is contained in:
MathWhiz
2016-11-21 05:19:13 -06:00
committed by Alys
parent 7d76622410
commit e8b7660376
13 changed files with 90 additions and 20 deletions

View File

@@ -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,12 +20,15 @@ habitrpg
}
});
$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;

View File

@@ -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;
@@ -16,6 +16,8 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
if(value === true) $scope.editingProfile = angular.copy(User.user.profile);
});
$scope.costume = Costume;
$scope.allocate = function(stat){
User.allocate({query:{stat:stat}});
}

View File

@@ -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
};
}
}());

View File

@@ -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",

View File

@@ -1,5 +1,7 @@
{
"backgrounds": "Backgrounds",
"background": "Background",
"noBackground": "No Background Selected",
"backgrounds062014": "SET 1: Released June 2014",
"backgroundBeachText":"Beach",

View File

@@ -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",

View File

@@ -0,0 +1,4 @@
div
h4=env.t('background')
table.table.table-striped
+basicRow('background', '{{costume.formatBackground(profile.preferences.background)}}')

View File

@@ -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()}}

View File

@@ -1,7 +1,5 @@
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')
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

View File

@@ -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)}}')

View File

@@ -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

View File

@@ -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