From 5e25b42e2a59b02f371c53d5d7e20e5b5b11c284 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 8 Sep 2021 13:03:49 -0400 Subject: [PATCH] Correctly handle cards that do not have a `slot` --- strange_eons_to_arkhamdb.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/strange_eons_to_arkhamdb.js b/strange_eons_to_arkhamdb.js index 35a4198..350fea2 100644 --- a/strange_eons_to_arkhamdb.js +++ b/strange_eons_to_arkhamdb.js @@ -26,11 +26,6 @@ function renameSlot(slot) { } } -var slot = renameSlot(Component.settings.get('Slot')); -if (Component.settings.get('Slot2') != 'None') { - slot += '. ' + renameSlot(Component.settings.get('Slot2')); -} - const tag_replacements = { "": String(Component.getName()), "": "[guardian]", @@ -111,7 +106,6 @@ var card_data = { skill_intellect: skills["Intellect"], skill_wild: skills["Wild"], skill_willpower: skills["Willpower"], - slot: String(slot), // TODO: should also handle "Victory" field text: substitute_tags(String( Component.settings.get('Keywords') + '\n' + Component.settings.get('Rules'))), @@ -120,6 +114,15 @@ var card_data = { xp: parseInt(Component.settings.get('Level')) || null, }; +var raw_slot = Component.settings.get('Slot'); +if (raw_slot) { + card_data.slot = renameSlot(String(raw_slot)); + var raw_slot2 = Component.settings.get('Slot2'); + if (raw_slot2 && raw_slot2 != 'None') { + card_data.slot += '. ' + renameSlot(raw_slot2); + } +} + var subtitle = Component.settings.get('Subtitle'); if (subtitle && subtitle != '') { card_data.subname = subtitle;