initial fixes for most warnings, fix missing stat parser button
This commit is contained in:
+17
-13
@@ -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:
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+45
-15
@@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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
@@ -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"],
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user