Merge pull request #190 from TheLastScrub:TheLastScrub/issue186

TheLastScrub/issue186
This commit is contained in:
TheLastScrub
2025-05-17 23:19:22 -07:00
committed by GitHub
19 changed files with 156 additions and 80 deletions
+39 -18
View File
@@ -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;
}
+3 -1
View File
@@ -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"
}
+17 -13
View File
@@ -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:
}
+4 -4
View File
@@ -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 */
+60 -15
View File
@@ -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 = $(
'<button><i class="fas fa-file-import"></i> Delta Green Stat Block Parser</button>',
);
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 {}
});
+12 -9
View File
@@ -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;
+1 -1
View File
@@ -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",
+3 -3
View File
@@ -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"],
+1 -1
View File
@@ -126,7 +126,7 @@
</div>
<div class="unnatural-notes-section">
<div class="editor-host">
{{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
+1 -1
View File
@@ -53,5 +53,5 @@
</div>
<div class="editor-host">
{{editor enrichedDescription target="system.physicalDescription" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.physicalDescription" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
+1 -1
View File
@@ -120,7 +120,7 @@
</div>
<div class="unnatural-notes-section">
<div class="editor-host">
{{editor enrichedDescription target="system.notes" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.notes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
+1 -1
View File
@@ -51,7 +51,7 @@
</div>
<div class="unnatural-notes-section">
<div class="editor-host">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
+1 -1
View File
@@ -42,7 +42,7 @@
{{!-- Description Tab --}}
<div class="tab top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</section>
</form>
+1 -1
View File
@@ -30,7 +30,7 @@
{{!-- Description Tab --}}
<div class="tab top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</section>
</form>
+1 -1
View File
@@ -39,7 +39,7 @@
{{!-- Description Tab --}}
<div class="tab top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</section>
+1 -1
View File
@@ -54,7 +54,7 @@
</div>
<div class="tab attributes top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</section>
+2 -2
View File
@@ -71,7 +71,7 @@
{{!-- Description Tab --}}
<div class="tab top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
{{!-- Handler Notes Tab --}}
@@ -101,7 +101,7 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Tome.HandlerNotes'}}:</span>
<div class="tab top-div-border">
{{editor enrichedHandlerNotes target="system.handlerNotes" button=true owner=owner editable=editable}}
{{editor enrichedHandlerNotes target="system.handlerNotes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
{{/if}}
+2 -2
View File
@@ -62,7 +62,7 @@
{{!-- Description Tab --}}
<div class="tab top-div-border" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
{{!-- Handler Notes Tab --}}
@@ -87,7 +87,7 @@
<span class="resource-label">{{localize 'DG.ItemWindow.Tome.HandlerNotes'}}:</span>
<div class="tab top-div-border">
{{editor enrichedHandlerNotes target="system.handlerNotes" button=true owner=owner editable=editable}}
{{editor enrichedHandlerNotes target="system.handlerNotes" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
{{/if}}
+5 -4
View File
@@ -111,16 +111,17 @@
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">{{localize 'DG.ItemWindow.Weapons.Description'}}</a>
<a class="item" data-tab="description">{{localize 'DG.ItemWindow.Weapons.Description'}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body" style="max-height: 25%;">
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
<div class="tab" data-group="primary" data-tab="description">
<div class="editor-host">
{{editor enrichedDescription target="system.description" engine="prosemirror" button=true owner=owner editable=editable}}
</div>
</div>
</section>
</form>