habitica/website/common/script/content/gear/weapon.js

71 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

import t from '../translation';
2019-10-08 14:57:10 +00:00
import { weapon as baseWeapon } from './sets/base';
2015-09-27 14:59:29 +00:00
2019-10-08 14:57:10 +00:00
import { weapon as healerWeapon } from './sets/healer';
import { weapon as rogueWeapon } from './sets/rogue';
import { weapon as warriorWeapon } from './sets/warrior';
import { weapon as wizardWeapon } from './sets/wizard';
2015-09-23 00:58:18 +00:00
import armoire from './sets/armoire';
2019-10-08 14:57:10 +00:00
import { weapon as mysteryWeapon } from './sets/mystery';
import { weapon as specialWeapon } from './sets/special';
2015-09-29 22:53:32 +00:00
2019-10-08 14:57:10 +00:00
const weapon = {
2015-09-27 14:59:29 +00:00
base: baseWeapon,
2015-09-23 00:58:18 +00:00
warrior: warriorWeapon,
2015-09-27 14:53:43 +00:00
rogue: rogueWeapon,
2015-09-27 14:38:02 +00:00
wizard: wizardWeapon,
2015-09-27 14:47:59 +00:00
healer: healerWeapon,
2015-09-27 14:59:29 +00:00
special: specialWeapon,
2015-09-29 22:53:32 +00:00
mystery: mysteryWeapon,
get armoire () {
return armoire.weapon;
},
2015-09-21 17:52:15 +00:00
};
// Add Two Handed message to all weapons
const rtlLanguages = [
2019-10-09 14:51:17 +00:00
'ae', /* Avestan */
2019-10-08 14:57:10 +00:00
'ar', /* 'العربية', Arabic */
'arc', /* Aramaic */
'bcc', /* 'بلوچی مکرانی', Southern Balochi */
'bqi', /* 'بختياري', Bakthiari */
'ckb', /* 'Soranî / کوردی', Sorani */
'dv', /* Dhivehi */
'fa', /* 'فارسی', Persian */
'glk', /* 'گیلکی', Gilaki */
'he', /* 'עברית', Hebrew */
'ku', /* 'Kurdî / كوردی', Kurdish */
'mzn', /* 'مازِرونی', Mazanderani */
'nqo', /* N'Ko */
'pnb', /* 'پنجابی', Western Punjabi */
'ps', /* 'پښتو', Pashto, */
'sd', /* 'سنڌي', Sindhi */
'ug', /* 'Uyghurche / ئۇيغۇرچە', Uyghur */
'ur', /* 'اردو', Urdu */
'yi', /* 'ייִדיש', Yiddish */
];
2019-10-09 18:08:36 +00:00
for (const key of Object.keys(weapon)) {
const set = weapon[key];
2019-10-09 18:08:36 +00:00
for (const weaponKey of Object.keys(set)) {
const item = set[weaponKey];
const oldnotes = item.notes;
2019-10-08 14:57:10 +00:00
item.notes = lang => {
const twoHandedText = item.twoHanded ? t('twoHandedItem')(lang) : '';
if (rtlLanguages.indexOf(lang) !== -1) {
return `${twoHandedText} ${oldnotes(lang)}`;
}
return `${oldnotes(lang)} ${twoHandedText}`;
};
item.notes.i18nLangFunc = true; // See https://github.com/HabitRPG/habitica/blob/develop/website/common/script/content/translation.js#L8
}
}
2019-10-01 15:53:48 +00:00
export default weapon;