From 7d6314051de2b2b9f0b39d72c3124921ae367ebb Mon Sep 17 00:00:00 2001 From: Ozzy Date: Tue, 25 Mar 2025 17:04:02 +0200 Subject: [PATCH 01/12] fix(jumpgate load): allows jumpgate to load the main parts of the script --- js/5etools-main.js | 10 ++++--- js/5etools-template.js | 40 ++++++++++++++------------ js/base-chat.js | 5 ++-- js/base-engine.js | 65 +++++++++++++++++++++++------------------- js/base-menu.js | 26 +++++++++-------- js/base-weather.js | 4 +-- 6 files changed, 81 insertions(+), 69 deletions(-) diff --git a/js/5etools-main.js b/js/5etools-main.js index 28cb9f0f..86a88d92 100644 --- a/js/5etools-main.js +++ b/js/5etools-main.js @@ -313,7 +313,7 @@ const betteR205etoolsMain = function () { {name: "bestiary index", url: `${MONSTER_DATA_DIR}index.json`}, {name: "bestiary fluff index", url: `${MONSTER_DATA_DIR}fluff-index.json`}, {name: "bestiary metadata", url: `${MONSTER_DATA_DIR}legendarygroups.json`}, - {name: "adventures index", url: `${DATA_URL}adventures.json`}, + // {name: "adventures index", url: `${DATA_URL}adventures.json`}, // error retrieving from 5e.tools {name: "base items", url: `${DATA_URL}items-base.json`}, {name: "item modifiers", url: `${DATA_URL}roll20-items.json`}, ]; @@ -906,7 +906,8 @@ const betteR205etoolsMain = function () { d20plus.setSheet = function () { d20plus.ut.log("Switched Character Sheet Template"); d20plus.sheet = "ogl"; - if (window.is_gm && (!d20.journal.customSheets || !d20.journal.customSheets)) { + const sheets = d20.journal.characterSheetsManager.getAllSheets(); + if (window.is_gm && (!sheets.length > 0)) { const $body = $(`body`); $body.addClass("ve-nosheet__body"); const $btnClose = $(``) @@ -929,8 +930,9 @@ const betteR205etoolsMain = function () { })); throw new Error("No character sheet selected!"); } - if (d20.journal.customSheets.layouthtml.indexOf("shaped_d20") > 0) d20plus.sheet = "shaped"; - if (d20.journal.customSheets.layouthtml.indexOf("DnD5e_Character_Sheet") > 0) d20plus.sheet = "community"; + const firstSheet = sheets.first(); + if (firstSheet.layouthtml.indexOf("shaped_d20") > 0) d20plus.sheet = "shaped"; + if (firstSheet.layouthtml.indexOf("DnD5e_Character_Sheet") > 0) d20plus.sheet = "community"; d20plus.ut.log(`Switched Character Sheet Template to ${d20plus.sheet}`); }; diff --git a/js/5etools-template.js b/js/5etools-template.js index f24146dd..e07a3903 100644 --- a/js/5etools-template.js +++ b/js/5etools-template.js @@ -93,27 +93,29 @@ const d20plusTemplate = function () { } d20plus.template5e._populateAdventuresDropdown = function () { - const defaultAdvUrl = d20plus.formSrcUrl(ADVENTURE_DATA_DIR, "adventure-lmop.json"); - const $iptUrl = $("#import-adventures-url"); - $iptUrl.val(defaultAdvUrl); - $iptUrl.data("id", "lmop"); - const $sel = $("#button-adventures-select"); - adventureMetadata.adventure.forEach(a => { + if (adventureMetadata.adventure){ + const defaultAdvUrl = d20plus.formSrcUrl(ADVENTURE_DATA_DIR, "adventure-lmop.json"); + const $iptUrl = $("#import-adventures-url"); + $iptUrl.val(defaultAdvUrl); + $iptUrl.data("id", "lmop"); + const $sel = $("#button-adventures-select"); + adventureMetadata.adventure.forEach(a => { + $sel.append($("