Implemented changes as suggested by @crookedneighbour

Should be passing all tests now.
This commit is contained in:
sablecliff
2015-06-29 18:11:12 +10:00
parent 96a3653620
commit c8dd666939
2 changed files with 18 additions and 29 deletions

View File

@@ -55,24 +55,20 @@ api.mystery =
wondercon: {start:'2014-03-24',end:'2014-04-01'} # not really, but the mechanic works
_.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
api.itemList =
'weapon': {localeKey: 'weapon', isEquipment: true}
'armor' : {localeKey: 'armor', isEquipment: true}
'head' : {localeKey: 'headgear', isEquipment: true}
'shield' : {localeKey: 'offhand', isEquipment: true}
'back' : {localeKey: 'back', isEquipment: true}
'body' : {localeKey: 'body', isEquipment: true}
'headAccessory' : {localeKey: 'headAccessory', isEquipment: true}
'eyewear' : {localeKey: 'eyewear', isEquipment: true}
'hatchingPotions' : {localeKey: 'hatchingPotion', isEquipment: false}
'eggs' : {localeKey: 'eggSingular', isEquipment: false}
'quests' : {localeKey: 'quest', isEquipment: false}
'Saddle' : {localeKey: 'foodSaddleText', isEquipment: false}
gear =
weapon:
base:

View File

@@ -215,18 +215,11 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
var gems = User.user.balance * 4;
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 itemTypes = Content.itemList;
var string = type;
if (itemTypes[type]) {
string = window.env.t(itemTypes[type].localeKey)
}
// 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);
if (type == 'weapon' || type == 'armor' || type == 'head' || type == 'shield' || type == 'headAccessory' || type == 'body' || type == 'back' || type == 'eyewear' ) {