diff --git a/css/deltagreen.css b/css/deltagreen.css index c94f63c..d1831a4 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; } @@ -820,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 { @@ -852,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 */ @@ -1184,7 +1191,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 +1202,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 +1217,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 +1225,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/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..8f91de9 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(); + }); + } }); /** @@ -152,3 +182,18 @@ 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; + + 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 {} +}); diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js index 2d6776c..0d9df28 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, { @@ -40,16 +41,18 @@ export default class DeltaGreenItemSheet extends ItemSheet { async getData() { const data = super.getData(); - 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 } + ); if (data.item.type === "tome" || data.item.type === "ritual") { - data.enrichedHandlerNotes = await TextEditor.enrichHTML( - this.object.system.handlerNotes, - { async: true }, - ); + data.enrichedHandlerNotes = + await foundry.applications.ux.TextEditor.implementation.enrichHTML( + this.object.system.handlerNotes, + { async: true } + ); } return data; 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/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 @@