Hackily add some metadata for Arkham Horror LCG SCED deckbuilder

This commit is contained in:
Adam Goldsmith 2022-06-05 22:34:31 -04:00
parent 7834b4572e
commit 908c6a8ba1
2 changed files with 23 additions and 3 deletions

View File

@ -1,7 +1,8 @@
useLibrary("project"); useLibrary("project");
function Card(member, copies_list) { function Card(member, arkhamdb_cycle_prefix, copies_list) {
this.member = member; this.member = member;
this.arkhamdb_cycle_prefix = arkhamdb_cycle_prefix;
this.copies_list = copies_list; this.copies_list = copies_list;
this.component = ResourceKit.getGameComponentFromFile(member.file); this.component = ResourceKit.getGameComponentFromFile(member.file);
@ -62,7 +63,7 @@ Card.prototype.copyCount = function copyCount() {
}; };
Card.prototype.makeJSON = function makeJSON(card_id, description) { Card.prototype.makeJSON = function makeJSON(card_id, description) {
return { let card = {
Name: "Card", Name: "Card",
Transform: { Transform: {
posX: 0, posX: 0,
@ -91,6 +92,20 @@ Card.prototype.makeJSON = function makeJSON(card_id, description) {
Tooltip: true, Tooltip: true,
SidewaysCard: false, SidewaysCard: false,
}; };
// TODO: could also do other fields, like "uses"
// Hack for AHLCG SCED deckbuilder
if (this.arkhamdb_cycle_prefix) {
let arkhamdb_id =
this.arkhamdb_cycle_prefix +
String(this.component.settings.get("CollectionNumber")).padStart(3, "0");
card.GMNotes = JSON.stringify({
id: arkhamdb_id,
});
}
return card;
}; };
module.exports = Card; module.exports = Card;

View File

@ -95,6 +95,9 @@ function run() {
task_settings.set("tts_image_resolution", image_resolution); task_settings.set("tts_image_resolution", image_resolution);
deck_task.writeTaskSettings(); deck_task.writeTaskSettings();
// If used with arkhamdb, get cycle prefix from settings
const arkhamdb_cycle_prefix = task_settings.get("arkhamdb_cycle_prefix");
Eons.setWaitCursor(true); Eons.setWaitCursor(true);
try { try {
Thread.busyWindow( Thread.busyWindow(
@ -103,6 +106,7 @@ function run() {
busy_props, busy_props,
image_format, image_format,
image_resolution, image_resolution,
arkhamdb_cycle_prefix,
deck_task deck_task
), ),
"Setting up...", "Setting up...",
@ -118,6 +122,7 @@ function run() {
busy_props, busy_props,
image_format, image_format,
image_resolution, image_resolution,
arkhamdb_cycle_prefix,
member member
) { ) {
let copies_list; let copies_list;
@ -135,7 +140,7 @@ function run() {
const cards = children const cards = children
.map((child) => { .map((child) => {
if (ProjectUtilities.matchExtension(child, "eon")) { if (ProjectUtilities.matchExtension(child, "eon")) {
let card = new Card(child, copies_list); let card = new Card(child, arkhamdb_cycle_prefix, copies_list);
if (card.component.isDeckLayoutSupported()) { if (card.component.isDeckLayoutSupported()) {
return card; return card;
} }