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");
function Card(member, copies_list) {
function Card(member, arkhamdb_cycle_prefix, copies_list) {
this.member = member;
this.arkhamdb_cycle_prefix = arkhamdb_cycle_prefix;
this.copies_list = copies_list;
this.component = ResourceKit.getGameComponentFromFile(member.file);
@ -62,7 +63,7 @@ Card.prototype.copyCount = function copyCount() {
};
Card.prototype.makeJSON = function makeJSON(card_id, description) {
return {
let card = {
Name: "Card",
Transform: {
posX: 0,
@ -91,6 +92,20 @@ Card.prototype.makeJSON = function makeJSON(card_id, description) {
Tooltip: true,
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;

View File

@ -95,6 +95,9 @@ function run() {
task_settings.set("tts_image_resolution", image_resolution);
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);
try {
Thread.busyWindow(
@ -103,6 +106,7 @@ function run() {
busy_props,
image_format,
image_resolution,
arkhamdb_cycle_prefix,
deck_task
),
"Setting up...",
@ -118,6 +122,7 @@ function run() {
busy_props,
image_format,
image_resolution,
arkhamdb_cycle_prefix,
member
) {
let copies_list;
@ -135,7 +140,7 @@ function run() {
const cards = children
.map((child) => {
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()) {
return card;
}