mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
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:
@@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
habitrpg
|
habitrpg
|
||||||
.controller("MemberModalCtrl", ['$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) {
|
function($scope, $rootScope, Members, Shared, $http, Notification, Groups, Chat, $controller, Stats, Costume) {
|
||||||
|
|
||||||
$controller('RootCtrl', {$scope: $scope});
|
$controller('RootCtrl', {$scope: $scope});
|
||||||
$rootScope.appLoaded = true;
|
$rootScope.appLoaded = true;
|
||||||
@@ -20,11 +20,14 @@ habitrpg
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.keyDownListener = function (e) {
|
$scope.costume = Costume;
|
||||||
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
||||||
$scope.sendPrivateMessage($scope.profile._id, $scope._message);
|
$scope.keyDownListener = function (e) {
|
||||||
}
|
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
||||||
};
|
$scope.sendPrivateMessage($scope.profile._id, $scope._message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.sendPrivateMessage = function(uuid, message){
|
$scope.sendPrivateMessage = function(uuid, message){
|
||||||
if (!message) return;
|
if (!message) return;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
habitrpg.controller("UserCtrl", ['$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) {
|
function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats, Social, Costume) {
|
||||||
$scope.profile = User.user;
|
$scope.profile = User.user;
|
||||||
|
|
||||||
$scope.statCalc = Stats;
|
$scope.statCalc = Stats;
|
||||||
@@ -15,6 +15,8 @@ habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$
|
|||||||
$scope.$watch('_editing.profile', function(value){
|
$scope.$watch('_editing.profile', function(value){
|
||||||
if(value === true) $scope.editingProfile = angular.copy(User.user.profile);
|
if(value === true) $scope.editingProfile = angular.copy(User.user.profile);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.costume = Costume;
|
||||||
|
|
||||||
$scope.allocate = function(stat){
|
$scope.allocate = function(stat){
|
||||||
User.allocate({query:{stat:stat}});
|
User.allocate({query:{stat:stat}});
|
||||||
|
|||||||
44
website/client-old/js/services/costumeServices.js
Normal file
44
website/client-old/js/services/costumeServices.js
Normal 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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}());
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
"js/services/userServices.js",
|
"js/services/userServices.js",
|
||||||
"js/services/hallServices.js",
|
"js/services/hallServices.js",
|
||||||
"js/services/pusherService.js",
|
"js/services/pusherService.js",
|
||||||
|
"js/services/costumeServices.js",
|
||||||
"js/services/achievementServices.js",
|
"js/services/achievementServices.js",
|
||||||
|
|
||||||
"js/filters/money.js",
|
"js/filters/money.js",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"backgrounds": "Backgrounds",
|
"backgrounds": "Backgrounds",
|
||||||
|
"background": "Background",
|
||||||
|
"noBackground": "No Background Selected",
|
||||||
|
|
||||||
"backgrounds062014": "SET 1: Released June 2014",
|
"backgrounds062014": "SET 1: Released June 2014",
|
||||||
"backgroundBeachText":"Beach",
|
"backgroundBeachText":"Beach",
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
{
|
{
|
||||||
"pets": "Pets",
|
"pets": "Pets",
|
||||||
|
"activePet": "Active Pet",
|
||||||
|
"noActivePet": "No Active Pet",
|
||||||
"petsFound": "Pets Found",
|
"petsFound": "Pets Found",
|
||||||
"magicPets": "Magic Potion Pets",
|
"magicPets": "Magic Potion Pets",
|
||||||
"rarePets": "Rare Pets",
|
"rarePets": "Rare Pets",
|
||||||
"questPets": "Quest Pets",
|
"questPets": "Quest Pets",
|
||||||
"mounts": "Mounts",
|
"mounts": "Mounts",
|
||||||
|
"activeMount": "Active Mount",
|
||||||
|
"noActiveMount": "No Active Mount",
|
||||||
"mountsTamed": "Mounts Tamed",
|
"mountsTamed": "Mounts Tamed",
|
||||||
"questMounts": "Quest Mounts",
|
"questMounts": "Quest Mounts",
|
||||||
"magicMounts": "Magic Potion Mounts",
|
"magicMounts": "Magic Potion Mounts",
|
||||||
|
|||||||
4
website/views/shared/profiles/stats/background.jade
Normal file
4
website/views/shared/profiles/stats/background.jade
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
div
|
||||||
|
h4=env.t('background')
|
||||||
|
table.table.table-striped
|
||||||
|
+basicRow('background', '{{costume.formatBackground(profile.preferences.background)}}')
|
||||||
6
website/views/shared/profiles/stats/costume.jade
Normal file
6
website/views/shared/profiles/stats/costume.jade
Normal 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()}}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
unless mobile
|
h4.stats-equipment(ng-show='user.flags.itemsEnabled')=env.t('battleGear')
|
||||||
h4.stats-equipment(class=mobile?'item item-divider':'',
|
table.table.table-striped(ng-show='user.flags.itemsEnabled')
|
||||||
ng-show='user.flags.itemsEnabled')=env.t('equipment')
|
tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped',
|
||||||
table.table.table-striped(ng-show='user.flags.itemsEnabled')
|
ng-init='piece=Content.gear.flat[gear]', ng-show='piece')
|
||||||
tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped',
|
td
|
||||||
ng-init='piece=Content.gear.flat[gear]', ng-show='piece')
|
strong {{piece.text()}}
|
||||||
td
|
strong(ng-show='piece.str || piece.con || piece.per || piece.int') :
|
||||||
strong {{piece.text()}}
|
span(ng-repeat='stat in ["str","con","per","int"]', ng-show='piece[stat]') {{piece[stat]}} {{env.t(stat)}}
|
||||||
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)}}
|
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ mixin statList(calculatedStat, popover, text, useOneTimeBinding)
|
|||||||
span.hint(popover-title=env.t('#{popover}'), popover-trigger='mouseenter',
|
span.hint(popover-title=env.t('#{popover}'), popover-trigger='mouseenter',
|
||||||
popover-placement='top', popover=env.t('#{popover}Text'))
|
popover-placement='top', popover=env.t('#{popover}Text'))
|
||||||
=env.t(text)
|
=env.t(text)
|
||||||
=': {{' + binding + calculatedStat + '}}'
|
=': {{' + binding + calculatedStat + '}}'
|
||||||
@@ -2,11 +2,13 @@ div(ng-if='user.flags.dropsEnabled')
|
|||||||
h4(class=mobile?'item item-divider':'')=env.t('pets')
|
h4(class=mobile?'item item-divider':'')=env.t('pets')
|
||||||
|
|
||||||
table.table.table-striped
|
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('petsFound','{{::statCalc.totalCount(profile.items.pets)}}')
|
||||||
+basicRow('beastMasterProgress','{{::statCalc.beastMasterProgress(profile.items.pets)}}')
|
+basicRow('beastMasterProgress','{{::statCalc.beastMasterProgress(profile.items.pets)}}')
|
||||||
|
|
||||||
h4(class=mobile?'item item-divider':'')=env.t('mounts')
|
h4(class=mobile?'item item-divider':'')=env.t('mounts')
|
||||||
|
|
||||||
table.table.table-striped
|
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('mountsTamed','{{::statCalc.totalCount(profile.items.mounts)}}')
|
||||||
+basicRow('mountMasterProgress','{{::statCalc.mountMasterProgress(profile.items.mounts)}}')
|
+basicRow('mountMasterProgress','{{::statCalc.mountMasterProgress(profile.items.mounts)}}')
|
||||||
|
|||||||
@@ -3,4 +3,6 @@ include ./stats/mixins
|
|||||||
include ./stats/basic-stats
|
include ./stats/basic-stats
|
||||||
include ./stats/equipment
|
include ./stats/equipment
|
||||||
include ./stats/attributes
|
include ./stats/attributes
|
||||||
|
include ./stats/costume
|
||||||
|
include ./stats/background
|
||||||
include ./stats/pets-and-mounts
|
include ./stats/pets-and-mounts
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ include ./stats/mixins
|
|||||||
|
|
||||||
include ./stats/basic-stats
|
include ./stats/basic-stats
|
||||||
include ./stats/equipment
|
include ./stats/equipment
|
||||||
|
include ./stats/costume
|
||||||
|
include ./stats/background
|
||||||
include ./stats/pets-and-mounts
|
include ./stats/pets-and-mounts
|
||||||
|
|||||||
Reference in New Issue
Block a user