Add Enemy sheet

This commit is contained in:
2025-05-25 17:41:32 +02:00
parent ff180ddd2e
commit 973daae15a
46 changed files with 1014 additions and 1828 deletions

View File

@@ -34,6 +34,7 @@ export default class HellbornActorSheet extends HandlebarsApplicationMixin(found
edit: HellbornActorSheet.#onItemEdit,
delete: HellbornActorSheet.#onItemDelete,
updateCheckboxArray: HellbornActorSheet.#onUpdateCheckboxArray,
toChat: HellbornActorSheet.#toChat,
},
}
@@ -138,7 +139,7 @@ export default class HellbornActorSheet extends HandlebarsApplicationMixin(found
* @param {DragEvent} event The originating DragEvent
* @protected
*/
_onDragOver(event) {}
_onDragOver(event) { }
async _onDropItem(item) {
console.log("Dropped item", item)
@@ -193,9 +194,31 @@ export default class HellbornActorSheet extends HandlebarsApplicationMixin(found
let dataPath = `system.mortality.${arrayName}`
let tab = foundry.utils.duplicate(this.document.system.mortality[arrayName])
tab[arrayIdx] = target.checked
this.actor.update( { [dataPath]: tab } )
// Dump
console.log("Array name", arrayName, arrayIdx, target.checked, dataPath)
this.actor.update({ [dataPath]: tab })
}
static async #toChat(event, target) {
const itemUuid = target.getAttribute("data-item-uuid")
const item = fromUuidSync(itemUuid)
if (!item) return
let content = ""
if (item.type === "perk") {
content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-hellborn/templates/chat-perk.hbs", item.toObject())
}
if (item.type === "malefica") {
content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-hellborn/templates/chat-malefica.hbs", item.toObject())
}
if (item.type === "ritual") {
content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-hellborn/templates/chat-ritual.hbs", item.toObject())
}
const chatData = {
user: game.user.id,
speaker: ChatMessage.getSpeaker({ actor: this.actor }),
content: content,
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
}
ChatMessage.create(chatData, { renderSheet: false })
}
/**