Substitute out strange eons tags for arkhamdb equivalents

This commit is contained in:
Adam Goldsmith 2021-09-07 23:23:28 -04:00
parent 1d21b1e10c
commit 37ebabcf42

View File

@ -36,6 +36,55 @@ if (Component.settings.get('Subtitle') != '') {
card_name += ': ' + Component.settings.get('Subtitle');
}
const tag_replacements = {
"<fullname>": String(Component.getName()),
"<gua>": "[guardian]",
"<see>": "[seeker]",
"<rog>": "[rogue]",
"<mys>": "[mystic]",
"<sur>": "[survivor]",
"<wil>": "[will]",
"<int>": "[lore]",
"<com>": "[strength]",
"<agi>": "[agility]",
"<wild>": "[wild]",
"<sku>": "[skull]",
"<cul>": "[cultist]",
"<tab>": "[tablet]",
"<mon>": "[elder_thing]",
"<ble>": "[bless]",
"<cur>": "[curse]",
"<eld>": "[eldersign]",
"<ten>": "[auto_fail]",
"<act>": "[action]",
"<fre>": "[free]",
"<rea>": "[reaction]",
"<for>": "<b>forced</b>",
"<hau>": "<b>Haunted</b>",
"<obj>": "<b>Objective</b>",
"<pat>": "Patrol",
"<rev>": "<b>Revelation</b>",
"<uni>": "{Unique}", // TODO
"<per>": "[per_investigator]",
"<bul>": "- ",
"<squ>": "{Square}", // TODO
// TODO
"<bultab>": "", // Tab spacing for bullet sections
"<t>": "<b><i>", // Trait
"</t>": "</i></b>",
"<hs>": "", // Horizontal spacer
"<lvs>": "", // Large vertical spacer
"<vs>": "", // Vertical spacer
"<svs>": "", // 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"],