39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
|
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;
|
||
|
|
||
|
html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
|
||
|
}
|
||
|
|
||
|
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': ''
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|