From 633cd3b94e9e4b27ca3c1830dc43244f5653b879 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 22 Sep 2024 13:21:16 -0400 Subject: [PATCH] Allow adding to GMNotes via comments field --- resources/ttsdeck/Card.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/ttsdeck/Card.js b/resources/ttsdeck/Card.js index 7449ac4..8a943a6 100644 --- a/resources/ttsdeck/Card.js +++ b/resources/ttsdeck/Card.js @@ -100,9 +100,16 @@ Card.prototype.makeJSON = function makeJSON(card_id, description) { this.arkhamdb_cycle_prefix + String(this.component.settings.get("CollectionNumber")).padStart(3, "0"); - card.GMNotes = JSON.stringify({ - id: arkhamdb_id, - }); + let overrides = {}; + try { + const comments_json = JSON.parse(this.component.comment); + if ("tts_gmnotes_override" in comments_json) { + overrides = comments_json["tts_gmnotes_override"]; + } + } catch (e) {} + + let gmnotes = Object.assign({ id: arkhamdb_id }, overrides); + card.GMNotes = JSON.stringify(gmnotes); } return card;