diff --git a/strange_eons_to_arkhamdb.js b/strange_eons_to_arkhamdb.js index 69d6600..cbffe38 100644 --- a/strange_eons_to_arkhamdb.js +++ b/strange_eons_to_arkhamdb.js @@ -90,15 +90,15 @@ function build_card(component) { str = str.trim(); str = replaceAll(str, "", String(component.getName())); - for (var tag in tag_replacements) { + for (let tag in tag_replacements) { str = replaceAll(str, tag, tag_replacements[tag]); } return str; } - var code = cycle_prefix + leftPad(String(component.settings.get('CollectionNumber')), 3, '0'); + const code = cycle_prefix + leftPad(String(component.settings.get('CollectionNumber')), 3, '0'); - var card_data = { + const card_data = { code: String(code), deck_limit: 2, // TODO: could be derived? flavor: substitute_tags(String(component.settings.get('Flavor'))), @@ -117,54 +117,54 @@ function build_card(component) { xp: int_or_null(component.settings.get('Level')), }; - var raw_health = component.settings.get('Stamina'); + const raw_health = component.settings.get('Stamina'); if (raw_health && raw_health != 'None' && raw_health != '-') { card_data.health = int_or_null(raw_health); } - var raw_sanity = component.settings.get('Sanity'); + const raw_sanity = component.settings.get('Sanity'); if (raw_sanity && raw_sanity != 'None' && raw_sanity != '-') { card_data.sanity = int_or_null(raw_sanity); } - var skills = { + const skills = { Agility: 0, Intellect: 0, Combat: 0, Willpower: 0, Wild: 0, }; - for (var i = 1; i<=6; i++) { - var skill_icon = component.settings.get('Skill' + i); + for (let i = 1; i<=6; i++) { + const skill_icon = component.settings.get('Skill' + i); if (skill_icon in skills) { skills[skill_icon] += 1; } } - for (var skill in skills) { + for (let skill in skills) { if (skills[skill] > 0) { card_data["skill_" + skill.toLowerCase()] = skills[skill]; } } - var raw_cost = component.settings.get('ResourceCost'); + const raw_cost = component.settings.get('ResourceCost'); if (raw_cost) { card_data.cost = int_or_null(raw_cost); } - var raw_slot = component.settings.get('Slot'); + const raw_slot = component.settings.get('Slot'); if (raw_slot && raw_slot != 'None') { card_data.slot = renameSlot(String(raw_slot)); - var raw_slot2 = component.settings.get('Slot2'); + const raw_slot2 = component.settings.get('Slot2'); if (raw_slot2 && raw_slot2 != 'None') { card_data.slot += '. ' + renameSlot(String(raw_slot2)); } } - var subtitle = component.settings.get('Subtitle'); + const subtitle = component.settings.get('Subtitle'); if (subtitle && subtitle != '') { card_data.subname = String(subtitle); } - var faction = component.settings.get('CardClass'); + const faction = component.settings.get('CardClass'); if (faction) { if (faction == 'Weakness') { card_data.subtype_code = "weakness"; @@ -174,7 +174,7 @@ function build_card(component) { } else { card_data.faction_code = String(faction).toLowerCase(); - var faction2 = component.settings.get('CardClass2'); + const faction2 = component.settings.get('CardClass2'); if (faction2 && faction2 != 'None') { card_data.faction2_code = String(faction2).toLowerCase(); } @@ -200,13 +200,13 @@ function build_card(component) { return ordered_card_data; } -var cards = []; -var member_iter = Eons.getOpenProject().iterator(); +const cards = []; +const member_iter = Eons.getOpenProject().iterator(); while (member_iter.hasNext()) { - var member = member_iter.next(); + const member = member_iter.next(); printf("Generating JSON for '%s'...\n", member); - var component = ResourceKit.getGameComponentFromFile(member.getFile()); - var card_data = build_card(component); + const component = ResourceKit.getGameComponentFromFile(member.getFile()); + const card_data = build_card(component); cards.push(card_data); }