Now includes the refactoring into different files.

Currently there a multiple ways to create the string being shown.
This will be changed upon the decision of which is prefered.
I personally prefer the first method, which uses a function inside the
object being created in content.coffee
This commit is contained in:
sablecliff
2015-06-26 19:33:39 +10:00
parent 459d5bfee3
commit 96a3653620
2 changed files with 29 additions and 16 deletions

View File

@@ -215,22 +215,17 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
var gems = User.user.balance * 4;
var equipmentList = {
'weapon': window.env.t('weapon'),
'armor' : window.env.t('armor'),
'head' : window.env.t('headgear'),
'shield' : window.env.t('offhand'),
'back' : window.env.t('back'),
'body' : window.env.t('body'),
'headAccessory' : window.env.t('headAccessory'),
'eyewear' : window.env.t('eyewear'),
'hatchingPotions' : window.env.t('hatchingPotion'),
'eggs' : window.env.t('eggSingular'),
'quests' : window.env.t('quest'),
'Saddle' : window.env.t('foodSaddleText').toLowerCase()
};
var string = (type in equipmentList) ? equipmentList.type : type;
var string = (type in equipmentList) ? equipmentList.get(type, window) : type;
// or
var string = (type in equipmentList) ? (equipmentList.type.needsLowerCase) ? equipmentList.get(type, window).toLowerCase() : equipmentList.get(type, window) : type;
// or
var string;
if (type in equipmentList) {
string = window.env.t(equipmentList.type.localeKey)
if (equipmentList.type.needsLowerCase) string = string.toLowerCase();
} else {
string = type;
}
// var string = (type == 'weapon') ? window.env.t('weapon') : (type == 'armor') ? window.env.t('armor') : (type == 'head') ? window.env.t('headgear') : (type == 'shield') ? window.env.t('offhand') : (type == 'back') ? window.env.t('back') : (type == 'body') ? window.env.t('body') : (type == 'headAccessory') ? window.env.t('headAccessory') : (type == 'eyewear') ? window.env.t('eyewear') : (type == 'hatchingPotions') ? window.env.t('hatchingPotion') : (type == 'eggs') ? window.env.t('eggSingular') : (type == 'quests') ? window.env.t('quest') : (item.key == 'Saddle') ? window.env.t('foodSaddleText').toLowerCase() : type; // FIXME this is ugly but temporary, once the purchase modal is done this will be removed
var price = ((((item.specialClass == "wizard") && (item.type == "weapon")) || item.gearSet == "animal") + 1);