diff --git a/strange_eons_to_arkhamdb.js b/strange_eons_to_arkhamdb.js index 6727b95..2f1f64f 100644 --- a/strange_eons_to_arkhamdb.js +++ b/strange_eons_to_arkhamdb.js @@ -1,5 +1,5 @@ // TODO: should be defined in strange eons somewhere -const pack_code = "420"; +const pack_code = "42"; function renameSlot(slot) { if (slot.startsWith('1 ')) { @@ -76,6 +76,10 @@ function int_or_null(inp) { } } +function leftPad(str, len, fill) { + return fill.repeat(Math.max(len - str.length, 0)) + str; +} + function build_card(component) { function substitute_tags(str) { str = str.replace("", String(component.getName())); @@ -86,7 +90,7 @@ function build_card(component) { return str; } - var code = pack_code + component.settings.get('CollectionNumber'); + var code = pack_code + leftPad(String(component.settings.get('CollectionNumber')), 3, '0'); var card_data = { code: String(code),