summaryrefslogtreecommitdiff
path: root/src/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/maps')
-rw-r--r--src/maps/maps.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/maps/maps.js b/src/maps/maps.js
index 1571806..0b121cd 100644
--- a/src/maps/maps.js
+++ b/src/maps/maps.js
@@ -1,5 +1,17 @@
const rarities = require('./rarities.json');
+function getTalentName(talent) {
+ if (talent == 'NoTalent' || talent == '' || talent == undefined) {
+ return 'No Talent';
+ }
+
+ return talent.substring(talent.lastIndexOf('_') + 1, talent.length - 1) // snake case to words
+ .replace(/([A-Z])/g, (s) => ' ' + s.toLowerCase())
+ .split(' ') // capitalize first letter
+ .map((s) => s.charAt(0).toUpperCase() + s.slice(1))
+ .join(' ');
+}
+
function getTalentRarity(talent) {
switch (talent.slice(talent.length - 7 - 1, talent.length - 1)) {
case 'TalentA': return 'Rare';
@@ -19,6 +31,7 @@ function getHero(actor) {
}
module.exports = {
+ getTalentName,
getTalentRarity,
getHero,
};