diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-05-10 13:15:41 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-12-13 16:59:18 +0100 |
| commit | 62abcb8f563edcd639b5dc36b6467debbfbd3215 (patch) | |
| tree | 2e652563c4fb9967e32475d1e9468e97a17bcad8 /src/maps | |
| parent | b71d8662a770c213458fe368b2434e4ce9cd522c (diff) | |
| download | brokentalents-62abcb8f563edcd639b5dc36b6467debbfbd3215.tar.gz brokentalents-62abcb8f563edcd639b5dc36b6467debbfbd3215.zip | |
fix 'NoTalen' strings
Diffstat (limited to 'src/maps')
| -rw-r--r-- | src/maps/maps.js | 13 |
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, }; |
