Files
habitica/website/client-old/js/services/costumeServices.js
MathWhiz e8b7660376 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
2016-11-21 21:19:13 +10:00

45 lines
1.0 KiB
JavaScript

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