Foundry v13 migration

This commit is contained in:
2025-05-01 08:48:02 +02:00
parent 342f9c2342
commit d647fcc35e
40 changed files with 249 additions and 212 deletions

View File

@@ -6,7 +6,7 @@
import { MaleficesUtility } from "./malefices-utility.js";
/* -------------------------------------------- */
export class MaleficesNPCSheet extends ActorSheet {
export class MaleficesNPCSheet extends foundry.appv1.sheets.ActorSheet {
/** @override */
static get defaultOptions() {
@@ -71,10 +71,10 @@ export class MaleficesNPCSheet extends ActorSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
html.bind("keydown", function(e) { // Ignore Enter in actores sheet
if (e.keyCode === 13) return false;
});
});
// Update Inventory Item
html.find('.item-edit').click(ev => {
@@ -92,17 +92,17 @@ export class MaleficesNPCSheet extends ActorSheet {
let dataType = $(ev.currentTarget).data("type")
this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true })
})
html.find('.equip-activate').click(ev => {
const li = $(ev.currentTarget).parents(".item")
let itemId = li.data("item-id")
this.actor.equipActivate( itemId)
});
});
html.find('.equip-deactivate').click(ev => {
const li = $(ev.currentTarget).parents(".item")
let itemId = li.data("item-id")
this.actor.equipDeactivate( itemId)
});
});
html.find('.subactor-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item");
@@ -110,7 +110,7 @@ export class MaleficesNPCSheet extends ActorSheet {
let actor = game.actors.get( actorId );
actor.sheet.render(true);
});
html.find('.subactor-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
let actorId = li.data("actor-id");
@@ -133,7 +133,7 @@ export class MaleficesNPCSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item")
this.actor.incDecAmmo( li.data("item-id"), +1 )
} );
html.find('.roll-ability').click((event) => {
const abilityKey = $(event.currentTarget).data("ability-key");
this.actor.rollAbility(abilityKey);
@@ -142,7 +142,7 @@ export class MaleficesNPCSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item")
const skillId = li.data("item-id")
this.actor.rollSkill(skillId)
});
});
html.find('.roll-weapon').click((event) => {
const li = $(event.currentTarget).parents(".item");
@@ -163,28 +163,28 @@ export class MaleficesNPCSheet extends ActorSheet {
const saveKey = $(event.currentTarget).data("save-key")
this.actor.rollSave(saveKey)
});
html.find('.lock-unlock-sheet').click((event) => {
this.options.editScore = !this.options.editScore;
this.render(true);
});
});
html.find('.item-link a').click((event) => {
const itemId = $(event.currentTarget).data("item-id");
const item = this.actor.getOwnedItem(itemId);
item.sheet.render(true);
});
});
html.find('.item-equip').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.equipItem( li.data("item-id") );
this.render(true);
this.render(true);
});
html.find('.update-field').change(ev => {
const fieldName = $(ev.currentTarget).data("field-name");
let value = Number(ev.currentTarget.value);
this.actor.update( { [`${fieldName}`]: value } );
});
});
}