Allow adding to GMNotes via comments field

This commit is contained in:
Adam Goldsmith 2024-09-22 13:21:16 -04:00
parent f55bed99a2
commit 633cd3b94e

View File

@ -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;