From 37ebabcf42aab8d59030acc879574d4949ff1219 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 7 Sep 2021 23:23:28 -0400 Subject: [PATCH] Substitute out strange eons tags for arkhamdb equivalents --- strange_eons_to_arkhamdb.js | 57 ++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/strange_eons_to_arkhamdb.js b/strange_eons_to_arkhamdb.js index 11f2448..a146851 100644 --- a/strange_eons_to_arkhamdb.js +++ b/strange_eons_to_arkhamdb.js @@ -36,6 +36,55 @@ if (Component.settings.get('Subtitle') != '') { card_name += ': ' + Component.settings.get('Subtitle'); } +const tag_replacements = { + "": String(Component.getName()), + "": "[guardian]", + "": "[seeker]", + "": "[rogue]", + "": "[mystic]", + "": "[survivor]", + "": "[will]", + "": "[lore]", + "": "[strength]", + "": "[agility]", + "": "[wild]", + "": "[skull]", + "": "[cultist]", + "": "[tablet]", + "": "[elder_thing]", + "": "[bless]", + "": "[curse]", + "": "[eldersign]", + "": "[auto_fail]", + "": "[action]", + "": "[free]", + "": "[reaction]", + "": "forced", + "": "Haunted", + "": "Objective", + "": "Patrol", + "": "Revelation", + "": "{Unique}", // TODO + "": "[per_investigator]", + "": "- ", + "": "{Square}", // TODO + // TODO + "": "", // Tab spacing for bullet sections + "": "", // Trait + "": "", + "": "", // Horizontal spacer + "": "", // Large vertical spacer + "": "", // Vertical spacer + "": "", // Small vertical spacer +}; + +function substitute_tags(str) { + for (tag in tag_replacements) { + str = str.replace(tag, tag_replacements[tag]); + } + return str; +} + // TODO: handle investigator cards const card_types = { "AHLCG-Event-Default": "event", @@ -54,12 +103,12 @@ var card_data = { // TODO: could be derived? deck_limit: 2, faction_code: String(Component.settings.get('CardClass')).toLowerCase(), - flavor: String(Component.settings.get('Flavor')), + flavor: substitute_tags(String(Component.settings.get('Flavor'))), health: parseInt(Component.settings.get('Stamina')) || null, illustrator: String(Component.settings.get('Artist')), is_unique: Component.settings.getBoolean('Unique'), lore: skills["Intellect"], - name: String(card_name), + name: substitute_tags(String(card_name)), pack_code: pack_code, position: parseInt(Component.settings.get('CollectionNumber')) || null, // TODO @@ -69,8 +118,8 @@ var card_data = { sanity: parseInt(Component.settings.get('Sanity')) || null, slot: String(slot), strength: skills["Combat"], - text: String(Component.settings.get('Rules')), - traits: String(Component.settings.get('Traits')), + text: substitute_tags(String(Component.settings.get('Rules'))), + traits: substitute_tags(String(Component.settings.get('Traits'))), type_code: card_types[Component.getFrontTemplateKey()], wild: skills["Wild"], will: skills["Willpower"],