From a84456fd60ffb18fc775fdea72220f83f22f0378 Mon Sep 17 00:00:00 2001
From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com>
Date: Sat, 17 May 2025 19:51:53 -0700
Subject: [PATCH 1/4] initial fixes for most warnings, fix missing stat parser
button
---
module/actor/actor-sheet.js | 30 +++++++-----
module/actor/actor.js | 8 ++--
module/deltagreen.js | 60 ++++++++++++++++++------
module/item/item-sheet.js | 7 +--
module/templates.js | 2 +-
system.json | 6 +--
templates/actor/partials/cv-partial.html | 2 +-
7 files changed, 75 insertions(+), 40 deletions(-)
diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js
index 880690e..899d25b 100644
--- a/module/actor/actor-sheet.js
+++ b/module/actor/actor-sheet.js
@@ -9,7 +9,8 @@ import {
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
-export default class DeltaGreenActorSheet extends ActorSheet {
+export default class DeltaGreenActorSheet extends foundry.appv1.sheets
+ .ActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
@@ -200,23 +201,26 @@ export default class DeltaGreenActorSheet extends ActorSheet {
switch (this.actor.type) {
case "agent":
- data.enrichedDescription = await TextEditor.enrichHTML(
- this.object.system.physicalDescription,
- { async: true }
- );
+ data.enrichedDescription =
+ await foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ this.object.system.physicalDescription,
+ { async: true }
+ );
break;
case "vehicle":
- data.enrichedDescription = await TextEditor.enrichHTML(
- this.object.system.description,
- { async: true }
- );
+ data.enrichedDescription =
+ await foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ this.object.system.description,
+ { async: true }
+ );
break;
case "npc":
case "unnatural":
- data.enrichedDescription = await TextEditor.enrichHTML(
- this.object.system.notes,
- { async: true }
- );
+ data.enrichedDescription =
+ await foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ this.object.system.notes,
+ { async: true }
+ );
break;
default:
}
diff --git a/module/actor/actor.js b/module/actor/actor.js
index 32e02b3..16b830f 100644
--- a/module/actor/actor.js
+++ b/module/actor/actor.js
@@ -49,7 +49,7 @@ export default class DeltaGreenActor extends Actor {
actorData.system.health.protection = protection;
- console.log(actor);
+ //console.log(actor);
}
_prepareNpcData(actor) {
@@ -120,7 +120,7 @@ export default class DeltaGreenActor extends Actor {
system.health.protection = protection;
- console.log(actor);
+ //console.log(actor);
}
/**
@@ -148,7 +148,7 @@ export default class DeltaGreenActor extends Actor {
system.health.protection = protection;
- console.log(actor);
+ //console.log(actor);
}
/**
@@ -300,7 +300,7 @@ export default class DeltaGreenActor extends Actor {
-1 * Math.abs(system.physical.exhaustedPenalty);
}
- console.log(agent);
+ //console.log(agent);
}
/** @override */
diff --git a/module/deltagreen.js b/module/deltagreen.js
index 88fa6a8..392072c 100644
--- a/module/deltagreen.js
+++ b/module/deltagreen.js
@@ -47,12 +47,26 @@ Hooks.once("init", async () => {
CONFIG.Item.documentClass = DeltaGreenItem;
// Register sheet application classes
- Actors.unregisterSheet("core", ActorSheet);
- Items.unregisterSheet("core", ItemSheet);
- Actors.registerSheet("deltagreen", DeltaGreenActorSheet, {
- makeDefault: true,
- });
- Items.registerSheet("deltagreen", DeltaGreenItemSheet, { makeDefault: true });
+ foundry.documents.collections.Actors.unregisterSheet(
+ "core",
+ foundry.appv1.sheets.ActorSheet
+ );
+ foundry.documents.collections.Items.unregisterSheet(
+ "core",
+ foundry.appv1.sheets.ItemSheet
+ );
+ foundry.documents.collections.Actors.registerSheet(
+ "deltagreen",
+ DeltaGreenActorSheet,
+ {
+ makeDefault: true,
+ }
+ );
+ foundry.documents.collections.Items.registerSheet(
+ "deltagreen",
+ DeltaGreenItemSheet,
+ { makeDefault: true }
+ );
// Preload Handlebars Templates
preloadHandlebarsTemplates();
@@ -98,16 +112,32 @@ Hooks.on("preCreateItem", (item) => {
});
// Hook into the render call for the Actors Directory to add an extra button
-Hooks.on("renderActorDirectory", (app, html) => {
- let importButton = $(
- '',
- );
- html.find(".directory-footer").append(importButton);
+Hooks.on("renderActorDirectory", (app, html, data) => {
+ if (!game.user.isGM) {
+ return;
+ }
- // Handle button clicks
- importButton.click((ev) => {
- ParseDeltaGreenStatBlock();
- });
+ if (html.querySelector("#statParserButton")) {
+ return;
+ }
+
+ const button = document.createElement("button");
+ button.id = "statParserButton";
+
+ const icon = document.createElement("i");
+
+ icon.classList.add("fas", "fa-file-import");
+
+ button.appendChild(icon);
+ button.append("Delta Green Stat Block Parser");
+
+ html.querySelector(".directory-footer").appendChild(button);
+
+ if (button) {
+ button.addEventListener("click", function (event) {
+ ParseDeltaGreenStatBlock();
+ });
+ }
});
/**
diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js
index 2d6776c..fcbf356 100644
--- a/module/item/item-sheet.js
+++ b/module/item/item-sheet.js
@@ -9,7 +9,8 @@ import {
* Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/
-export default class DeltaGreenItemSheet extends ItemSheet {
+export default class DeltaGreenItemSheet extends foundry.appv1.sheets
+ .ItemSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
@@ -42,13 +43,13 @@ export default class DeltaGreenItemSheet extends ItemSheet {
data.enrichedDescription = await TextEditor.enrichHTML(
this.object.system.description,
- { async: true },
+ { async: true }
);
if (data.item.type === "tome" || data.item.type === "ritual") {
data.enrichedHandlerNotes = await TextEditor.enrichHTML(
this.object.system.handlerNotes,
- { async: true },
+ { async: true }
);
}
diff --git a/module/templates.js b/module/templates.js
index 980e6ab..2e602fa 100644
--- a/module/templates.js
+++ b/module/templates.js
@@ -4,7 +4,7 @@
* @return {Promise}
*/
export default async function preloadHandlebarsTemplates() {
- return loadTemplates([
+ return foundry.applications.handlebars.loadTemplates([
"systems/deltagreen/templates/actor/actor-sheet.html",
"systems/deltagreen/templates/actor/limited-sheet.html",
"systems/deltagreen/templates/actor/unnatural-sheet.html",
diff --git a/system.json b/system.json
index cb5dcb8..e355aa3 100644
--- a/system.json
+++ b/system.json
@@ -17,9 +17,9 @@
],
"version": "1.3.5",
"compatibility": {
- "minimum": "12",
- "verified": "12",
- "maximum": "12"
+ "minimum": "13",
+ "verified": "13",
+ "maximum": "13"
},
"esmodules": ["module/deltagreen.js"],
"styles": ["css/deltagreen.css", "css/dialogue.css"],
diff --git a/templates/actor/partials/cv-partial.html b/templates/actor/partials/cv-partial.html
index 2d8dabc..f5fd9c0 100644
--- a/templates/actor/partials/cv-partial.html
+++ b/templates/actor/partials/cv-partial.html
@@ -53,5 +53,5 @@
- {{editor enrichedDescription target="system.physicalDescription" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.physicalDescription" engine="prosemirror" button=true owner=owner editable=editable}}
\ No newline at end of file
From 32af07ef43fdaa37bc443a2c2865b983c7276a61 Mon Sep 17 00:00:00 2001
From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com>
Date: Sat, 17 May 2025 21:30:57 -0700
Subject: [PATCH 2/4] Got most of the previous UI tweaks back in, if those UI
elements still exist
---
css/deltagreen.css | 24 +++++++++++++++++-------
lang/en.json | 4 +++-
module/deltagreen.js | 10 ++++++++++
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/css/deltagreen.css b/css/deltagreen.css
index c94f63c..383781b 100644
--- a/css/deltagreen.css
+++ b/css/deltagreen.css
@@ -84,10 +84,6 @@ form.program-style {
background: rgba(138, 136, 133, 0.3);
}
-#pause img {
- content: url(../assets/img/DG_Pause_Icon.webp);
-}
-
.old-paper-background {
background: url("../assets/img/StainedPlainPaper10.webp") !important;
}
@@ -1184,7 +1180,9 @@ input.item-sheet-short-input {
}
/*
-:root {
+ Custom UI Styling Elements
+*/
+:root :not(.no-theme) {
--color-shadow-primary: #374e13;
--color-shadow-highlight: #406539;
--color-border-highlight: #406539;
@@ -1193,9 +1191,12 @@ input.item-sheet-short-input {
--color-text-dark-header: #406539;
scrollbar-color: var(--color-text-dark-header) #111;
}
-*/
-#interface * {
+#pause img {
+ content: url(../assets/img/DG_Pause_Icon.webp);
+}
+
+#interface:not(.no-theme) * {
--color-shadow-primary: #215112 !important;
--color-shadow-highlight: #215112 !important;
--color-border-highlight: #215112 !important;
@@ -1205,6 +1206,7 @@ input.item-sheet-short-input {
scrollbar-color: var(--color-text-dark-header) #111 !important;
}
+/* The logo is defunct as of v13 */
#logo {
content: url("../assets/img/Delta_Green_Logo.webp");
width: 90px;
@@ -1212,3 +1214,11 @@ input.item-sheet-short-input {
padding-top: 10px;
padding-bottom: 10px;
}
+
+body:not(.no-theme) #interface:not(.theme-light) .ui-control {
+ border: 2px solid #215112;
+}
+
+body:not(.no-theme) #interface:not(.theme-light) #action-bar .slot.full:hover {
+ border: 2px solid #215112;
+}
diff --git a/lang/en.json b/lang/en.json
index ecf2e1a..9b32040 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -313,5 +313,7 @@
"DG.ItemWindow.Ritual.ActivationTime": "Activation Time",
"DG.ItemWindow.Ritual.ActivationCosts": "Activation Costs",
"DG.ItemWindow.Ritual.StudyTime": "Study Time",
- "DG.ItemWindow.Ritual.LearnedSanityDamage": "Learn SAN Damage"
+ "DG.ItemWindow.Ritual.LearnedSanityDamage": "Learn SAN Damage",
+
+ "DG.MissionPaused": "Mission Paused"
}
diff --git a/module/deltagreen.js b/module/deltagreen.js
index 392072c..2aaa35e 100644
--- a/module/deltagreen.js
+++ b/module/deltagreen.js
@@ -182,3 +182,13 @@ Hooks.on("createActor", async (actor, options, userId) => {
console.log(ex);
}
});
+
+Hooks.on("renderGamePause", function (_, html, options) {
+ if (options.cssClass !== "paused") return;
+
+ try {
+ let gamePausedOverrideText = game.i18n.translations.DG.MissionPaused;
+ html.querySelector("figcaption").textContent = gamePausedOverrideText;
+ html.querySelector("img").classList.remove("fa-spin"); // I don't like the logo spinning personally
+ } catch {}
+});
From fcc6d2288ac54c1b7ff65cd85f7c0c5f4b4bf51a Mon Sep 17 00:00:00 2001
From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com>
Date: Sat, 17 May 2025 21:39:30 -0700
Subject: [PATCH 3/4] fixed my tweak to the pause logo for non-translated
languages
---
module/deltagreen.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/module/deltagreen.js b/module/deltagreen.js
index 2aaa35e..8f91de9 100644
--- a/module/deltagreen.js
+++ b/module/deltagreen.js
@@ -188,6 +188,11 @@ Hooks.on("renderGamePause", function (_, html, options) {
try {
let gamePausedOverrideText = game.i18n.translations.DG.MissionPaused;
+
+ if (typeof gamePausedOverrideText == "undefined") {
+ return;
+ }
+
html.querySelector("figcaption").textContent = gamePausedOverrideText;
html.querySelector("img").classList.remove("fa-spin"); // I don't like the logo spinning personally
} catch {}
From 60e88d61aaafe73bdd4b8834caa9945d08737c00 Mon Sep 17 00:00:00 2001
From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com>
Date: Sat, 17 May 2025 23:14:10 -0700
Subject: [PATCH 4/4] Mostly have text editors working again
---
css/deltagreen.css | 33 +++++++++++++++--------
module/item/item-sheet.js | 18 +++++++------
templates/actor/npc-sheet.html | 2 +-
templates/actor/unnatural-sheet.html | 2 +-
templates/actor/vehicle-sheet.html | 2 +-
templates/item/item-armor-sheet.html | 2 +-
templates/item/item-bond-sheet.html | 2 +-
templates/item/item-gear-sheet.html | 2 +-
templates/item/item-motivation-sheet.html | 2 +-
templates/item/item-ritual-sheet.html | 4 +--
templates/item/item-tome-sheet.html | 4 +--
templates/item/item-weapon-sheet.html | 9 ++++---
12 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/css/deltagreen.css b/css/deltagreen.css
index 383781b..d1831a4 100644
--- a/css/deltagreen.css
+++ b/css/deltagreen.css
@@ -816,20 +816,22 @@ div.motivation-editor-container div.editor {
min-height: 100% !important;
}
-.editor-host .tox .tox-editor-container {
- background: none !important;
-}
-
-.deltagreen .tox-editor-header {
- background: none !important;
-}
-
-.deltagreen .tox .tox-edit-area {
- padding: 0 8px;
+.deltagreen .editor-host {
+ align-items: stretch;
}
.deltagreen .editor-host .editor {
- min-height: 50px;
+ min-height: 150px;
+ height: 100% !important;
+}
+
+.deltagreen .editor .editor-container {
+ height: 100% !important;
+}
+
+/* I think all the stuff below is now obsolete
+.editor-host .tox .tox-editor-container {
+ background: none !important;
}
.deltagreen .editor-host .tox {
@@ -848,6 +850,15 @@ div.motivation-editor-container div.editor {
height: 300px;
}
+.deltagreen .tox-editor-header {
+ background: none !important;
+}
+
+.deltagreen .tox .tox-edit-area {
+ padding: 0 8px;
+}
+*/
+
/*
Item Sheet Common CSS
*/
diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js
index fcbf356..0d9df28 100644
--- a/module/item/item-sheet.js
+++ b/module/item/item-sheet.js
@@ -41,16 +41,18 @@ export default class DeltaGreenItemSheet extends foundry.appv1.sheets
async getData() {
const data = super.getData();
- data.enrichedDescription = await TextEditor.enrichHTML(
- this.object.system.description,
- { async: true }
- );
-
- if (data.item.type === "tome" || data.item.type === "ritual") {
- data.enrichedHandlerNotes = await TextEditor.enrichHTML(
- this.object.system.handlerNotes,
+ data.enrichedDescription =
+ await foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ this.object.system.description,
{ async: true }
);
+
+ if (data.item.type === "tome" || data.item.type === "ritual") {
+ data.enrichedHandlerNotes =
+ await foundry.applications.ux.TextEditor.implementation.enrichHTML(
+ this.object.system.handlerNotes,
+ { async: true }
+ );
}
return data;
diff --git a/templates/actor/npc-sheet.html b/templates/actor/npc-sheet.html
index 0f18924..129b6c3 100644
--- a/templates/actor/npc-sheet.html
+++ b/templates/actor/npc-sheet.html
@@ -126,7 +126,7 @@
- {{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/actor/unnatural-sheet.html b/templates/actor/unnatural-sheet.html
index 8a8d298..3d941e7 100644
--- a/templates/actor/unnatural-sheet.html
+++ b/templates/actor/unnatural-sheet.html
@@ -120,7 +120,7 @@
- {{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/actor/vehicle-sheet.html b/templates/actor/vehicle-sheet.html
index 8728340..9d8393b 100644
--- a/templates/actor/vehicle-sheet.html
+++ b/templates/actor/vehicle-sheet.html
@@ -51,7 +51,7 @@
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-armor-sheet.html b/templates/item/item-armor-sheet.html
index 3b292b5..1b38c2f 100644
--- a/templates/item/item-armor-sheet.html
+++ b/templates/item/item-armor-sheet.html
@@ -42,7 +42,7 @@
{{!-- Description Tab --}}
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-bond-sheet.html b/templates/item/item-bond-sheet.html
index f9f6ce3..3798876 100644
--- a/templates/item/item-bond-sheet.html
+++ b/templates/item/item-bond-sheet.html
@@ -30,7 +30,7 @@
{{!-- Description Tab --}}
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-gear-sheet.html b/templates/item/item-gear-sheet.html
index e7253ab..85bd83d 100644
--- a/templates/item/item-gear-sheet.html
+++ b/templates/item/item-gear-sheet.html
@@ -39,7 +39,7 @@
{{!-- Description Tab --}}
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-motivation-sheet.html b/templates/item/item-motivation-sheet.html
index abd9a67..5ebc25a 100644
--- a/templates/item/item-motivation-sheet.html
+++ b/templates/item/item-motivation-sheet.html
@@ -54,7 +54,7 @@
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
diff --git a/templates/item/item-ritual-sheet.html b/templates/item/item-ritual-sheet.html
index 0110c69..d048644 100644
--- a/templates/item/item-ritual-sheet.html
+++ b/templates/item/item-ritual-sheet.html
@@ -71,7 +71,7 @@
{{!-- Description Tab --}}
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
{{!-- Handler Notes Tab --}}
@@ -101,7 +101,7 @@
{{localize 'DG.ItemWindow.Tome.HandlerNotes'}}:
- {{editor enrichedHandlerNotes target="system.handlerNotes" button=true owner=owner editable=editable}}
+ {{editor enrichedHandlerNotes target="system.handlerNotes" engine="prosemirror" button=true owner=owner editable=editable}}
{{/if}}
diff --git a/templates/item/item-tome-sheet.html b/templates/item/item-tome-sheet.html
index ca84371..2806709 100644
--- a/templates/item/item-tome-sheet.html
+++ b/templates/item/item-tome-sheet.html
@@ -62,7 +62,7 @@
{{!-- Description Tab --}}
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
{{!-- Handler Notes Tab --}}
@@ -87,7 +87,7 @@
{{localize 'DG.ItemWindow.Tome.HandlerNotes'}}:
- {{editor enrichedHandlerNotes target="system.handlerNotes" button=true owner=owner editable=editable}}
+ {{editor enrichedHandlerNotes target="system.handlerNotes" engine="prosemirror" button=true owner=owner editable=editable}}
{{/if}}
diff --git a/templates/item/item-weapon-sheet.html b/templates/item/item-weapon-sheet.html
index 127b939..cc03669 100644
--- a/templates/item/item-weapon-sheet.html
+++ b/templates/item/item-weapon-sheet.html
@@ -111,16 +111,17 @@
{{!-- Sheet Tab Navigation --}}
{{!-- Sheet Body --}}
{{!-- Description Tab --}}
-
- {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
+
+
+ {{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
+