2023-01-18 01:37:22 +01:00
|
|
|
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
|
|
|
|
|
|
|
export class RdDFauneItemSheet extends RdDItemInventaireSheet {
|
|
|
|
|
|
|
|
static get ITEM_TYPE() { return "faune" };
|
|
|
|
|
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
|
|
|
|
if (!this.options.editable) return;
|
|
|
|
|
2025-01-24 20:12:34 +01:00
|
|
|
html.find("a.linked-actor-delete").click(async event => await this.onDeleteLinkedActor());
|
2023-01-18 01:37:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async _onDropActor(event, dragData) {
|
|
|
|
console.log('faune:dropActor', event, dragData)
|
|
|
|
const linkedActor = fromUuidSync(dragData.uuid);
|
|
|
|
if (linkedActor?.pack) {
|
|
|
|
this.item.update({
|
|
|
|
'system.actor.pack': linkedActor.pack,
|
|
|
|
'system.actor.id': linkedActor._id,
|
|
|
|
'system.actor.name': linkedActor.name
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.notifications.warn(`${linkedActor.name} ne provient pas d'un compendium.
|
|
|
|
<br>Choisissez une créature du compendium pour représenter un élément de faune générique`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async onDeleteLinkedActor() {
|
|
|
|
this.item.update({
|
|
|
|
'system.actor.pack': '',
|
|
|
|
'system.actor.id': '',
|
|
|
|
'system.actor.name': ''
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|