summaryrefslogtreecommitdiff
path: root/src/maps/maps.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-09 09:26:04 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 16:59:18 +0100
commit3aa97bef107d2db76251787ed44d0b9f49e325bf (patch)
treef8a38c971e9416e47b11e6279e53a5489d6cc112 /src/maps/maps.js
parenta58587d9ad93adc194ed9d890a83c21501c91587 (diff)
downloadbrokentalents-3aa97bef107d2db76251787ed44d0b9f49e325bf.tar.gz
brokentalents-3aa97bef107d2db76251787ed44d0b9f49e325bf.zip
correctly translate talents to rarity
Diffstat (limited to 'src/maps/maps.js')
-rw-r--r--src/maps/maps.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/maps/maps.js b/src/maps/maps.js
new file mode 100644
index 0000000..1571806
--- /dev/null
+++ b/src/maps/maps.js
@@ -0,0 +1,24 @@
+const rarities = require('./rarities.json');
+
+function getTalentRarity(talent) {
+ switch (talent.slice(talent.length - 7 - 1, talent.length - 1)) {
+ case 'TalentA': return 'Rare';
+ case 'TalentB': return 'Epic';
+ case 'TalentC': return 'Legendary';
+ default:
+ if (Object.keys(rarities).includes(talent)) {
+ return rarities[talent];
+ } else {
+ return 'unknown';
+ }
+ }
+}
+
+function getHero(actor) {
+ return actor.substring(1, actor.length - 1);
+}
+
+module.exports = {
+ getTalentRarity,
+ getHero,
+};