forked from public/foundryvtt-reve-de-dragon
Gestion des actions sur les items
- dans la liste d'équipement, liste d'actions fournie par code - support d'actions multiples - listener générique Utilisation du mécanisme pour tous les items, standardisation de l'apparence des boutons d'items
This commit is contained in:
@ -14,6 +14,7 @@ import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
@ -199,13 +200,14 @@ export class RdDItemSheet extends ItemSheet {
|
||||
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
|
||||
if (this.actor) {
|
||||
this.html.find('.consommer-potion').click(event => this.itemActionConsommer(event))
|
||||
this.html.find('.item-action').click(event => this.itemAction(event))
|
||||
// TODO
|
||||
this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options))
|
||||
|
||||
this.html.find('.item-potion-consommer').click(event => this.itemActionConsommer(event))
|
||||
|
||||
this.html.find('.item-split').click( event => this.itemActionSplit(event))
|
||||
this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true));
|
||||
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor)));
|
||||
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
|
||||
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
|
||||
this.html.find('.item-delete').click(async event => this.itemActionDelete(event));
|
||||
|
||||
this.html.find('.item-quantite-plus').click(async event => {
|
||||
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
|
||||
@ -223,6 +225,11 @@ export class RdDItemSheet extends ItemSheet {
|
||||
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp);
|
||||
}
|
||||
|
||||
itemActionDelete(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
return RdDUtility.confirmActorItemDelete(item, this.actor)
|
||||
}
|
||||
|
||||
async itemActionConsommer(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
if (item) {
|
||||
@ -239,14 +246,6 @@ export class RdDItemSheet extends ItemSheet {
|
||||
}
|
||||
}
|
||||
|
||||
async itemAction(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
if (item) {
|
||||
await item.actionPrincipale(this.actor)
|
||||
await RdDSheetUtility.renderItemBranch(this.actor, item)
|
||||
}
|
||||
}
|
||||
|
||||
_getEventActor(event) {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get(actorId);
|
||||
|
Reference in New Issue
Block a user