Update sheets and fix basic bugs

This commit is contained in:
2024-12-04 15:16:33 +01:00
parent 1cc3a0bc21
commit eaba806fec
33 changed files with 453 additions and 696 deletions

View File

@ -32,8 +32,7 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
editImage: CthulhuEternalActorSheet.#onEditImage,
toggleSheet: CthulhuEternalActorSheet.#onToggleSheet,
edit: CthulhuEternalActorSheet.#onItemEdit,
delete: CthulhuEternalActorSheet.#onItemDelete,
createSpell: CthulhuEternalActorSheet.#onCreateSpell,
delete: CthulhuEternalActorSheet.#onItemDelete
},
}
@ -109,7 +108,9 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
* @param {DragEvent} event The originating DragEvent
* @protected
*/
async _onDrop(event) {}
async _onDrop(event) {
}
/**
* Define whether a user is able to begin a dragstart workflow for a given drag selector
@ -128,7 +129,7 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
* @protected
*/
_canDragDrop(selector) {
return this.isEditable && this.document.isOwner
return true //this.isEditable && this.document.isOwner
}
/**
@ -203,6 +204,7 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
_onDragOver(event) {}
async _onDropItem(item) {
console.log("Dropped item", item)
let itemData = item.toObject()
await this.document.createEmbeddedDocuments("Item", [itemData], { renderSheet: false })
}
@ -272,20 +274,8 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
*/
static async #onItemDelete(event, target) {
const itemUuid = target.getAttribute("data-item-uuid")
const talent = await fromUuid(itemUuid)
await talent.deleteDialog()
}
/**
* Handles the creation of a new attack item.
*
* @param {Event} event The event that triggered the creation of the attack.
* @param {Object} target The target object where the attack will be created.
* @private
* @static
*/
static #onCreateSpell(event, target) {
const item = this.document.createEmbeddedDocuments("Item", [{ name: "Nouveau sortilège", type: "spell" }])
const item = await fromUuid(itemUuid)
await item.deleteDialog()
}
// #endregion