mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
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:
@@ -55,6 +55,24 @@ api.mystery =
|
|||||||
wondercon: {start:'2014-03-24',end:'2014-04-01'} # not really, but the mechanic works
|
wondercon: {start:'2014-03-24',end:'2014-04-01'} # not really, but the mechanic works
|
||||||
_.each api.mystery, (v,k)->v.key = k
|
_.each api.mystery, (v,k)->v.key = k
|
||||||
|
|
||||||
|
equipmentList =
|
||||||
|
'weapon': {localeKey: 'weapon', isEquipment: true, needsLowerCase: false}
|
||||||
|
'armor' : {localeKey: 'armor', isEquipment: true, needsLowerCase: false}
|
||||||
|
'head' : {localeKey: 'headgear', isEquipment: true, needsLowerCase: false}
|
||||||
|
'shield' : {localeKey: 'offhand', isEquipment: true, needsLowerCase: false}
|
||||||
|
'back' : {localeKey: 'back', isEquipment: true, needsLowerCase: false}
|
||||||
|
'body' : {localeKey: 'body', isEquipment: true, needsLowerCase: false}
|
||||||
|
'headAccessory' : {localeKey: 'headAccessory', isEquipment: true, needsLowerCase: false}
|
||||||
|
'eyewear' : {localeKey: 'eyewear', isEquipment: true, needsLowerCase: false}
|
||||||
|
'hatchingPotions' : {localeKey: 'hatchingPotion', isEquipment: false, needsLowerCase: false}
|
||||||
|
'eggs' : {localeKey: 'eggSingular', isEquipment: false, needsLowerCase: false}
|
||||||
|
'quests' : {localeKey: 'quest', isEquipment: false, needsLowerCase: false}
|
||||||
|
'Saddle' : {localeKey: 'foodSaddleText', isEquipment: false, needsLowerCase: true}
|
||||||
|
get : (key, w = window) ->
|
||||||
|
string = w.env.t(this.key.localeKey)
|
||||||
|
if (this.key.needsLowerCase) then string = string.toLowerCase()
|
||||||
|
string
|
||||||
|
|
||||||
gear =
|
gear =
|
||||||
weapon:
|
weapon:
|
||||||
base:
|
base:
|
||||||
|
|||||||
@@ -215,22 +215,17 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
|
|
||||||
var gems = User.user.balance * 4;
|
var gems = User.user.balance * 4;
|
||||||
|
|
||||||
var equipmentList = {
|
var string = (type in equipmentList) ? equipmentList.get(type, window) : type;
|
||||||
'weapon': window.env.t('weapon'),
|
// or
|
||||||
'armor' : window.env.t('armor'),
|
var string = (type in equipmentList) ? (equipmentList.type.needsLowerCase) ? equipmentList.get(type, window).toLowerCase() : equipmentList.get(type, window) : type;
|
||||||
'head' : window.env.t('headgear'),
|
// or
|
||||||
'shield' : window.env.t('offhand'),
|
var string;
|
||||||
'back' : window.env.t('back'),
|
if (type in equipmentList) {
|
||||||
'body' : window.env.t('body'),
|
string = window.env.t(equipmentList.type.localeKey)
|
||||||
'headAccessory' : window.env.t('headAccessory'),
|
if (equipmentList.type.needsLowerCase) string = string.toLowerCase();
|
||||||
'eyewear' : window.env.t('eyewear'),
|
} else {
|
||||||
'hatchingPotions' : window.env.t('hatchingPotion'),
|
string = type;
|
||||||
'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 == '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 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);
|
var price = ((((item.specialClass == "wizard") && (item.type == "weapon")) || item.gearSet == "animal") + 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user