Les auberges sont des commerces #600
@ -185,7 +185,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onDropItem(event, dragData) {
|
async _onDropItem(event, dragData) {
|
||||||
const destItemId = this.html.find(event.target)?.closest('.item').attr('data-item-id')
|
const destItemId = this.html.find(event.target)?.closest('.item').attr('data-item-id')
|
||||||
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor, dragData, this.objetVersConteneur)
|
const dropParams = await RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor, dragData, this.objetVersConteneur)
|
||||||
if (dropParams) {
|
if (dropParams) {
|
||||||
const callSuper = await this.actor.processDropItem(dropParams)
|
const callSuper = await this.actor.processDropItem(dropParams)
|
||||||
if (callSuper) {
|
if (callSuper) {
|
||||||
|
@ -51,7 +51,7 @@ export class RdDConteneurItemSheet extends RdDItemSheet {
|
|||||||
|
|
||||||
async _onDropItem(event, dragData) {
|
async _onDropItem(event, dragData) {
|
||||||
if (this.actor) {
|
if (this.actor) {
|
||||||
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor, dragData, this.objetVersConteneur);
|
const dropParams = await RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor, dragData, this.objetVersConteneur);
|
||||||
await this.actor.processDropItem(dropParams);
|
await this.actor.processDropItem(dropParams);
|
||||||
await this.render(true);
|
await this.render(true);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { DialogSplitItem } from "./dialog-split-item.js";
|
import { DialogSplitItem } from "./dialog-split-item.js";
|
||||||
|
import { RdDItem } from "./item.js";
|
||||||
|
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||||
|
|
||||||
export class RdDSheetUtility {
|
export class RdDSheetUtility {
|
||||||
|
|
||||||
@ -19,8 +21,11 @@ export class RdDSheetUtility {
|
|||||||
return $(event.currentTarget)?.parents(".item");
|
return $(event.currentTarget)?.parents(".item");
|
||||||
}
|
}
|
||||||
|
|
||||||
static prepareItemDropParameters(destItemId, actor, dragData, objetVersConteneur) {
|
static async prepareItemDropParameters(destItemId, actor, dragData, objetVersConteneur) {
|
||||||
const item = fromUuidSync(dragData.uuid)
|
let item = fromUuidSync(dragData.uuid);
|
||||||
|
if (item.pack && !item.system){
|
||||||
|
item = await RdDItem.getCorrespondingItem(item);
|
||||||
|
}
|
||||||
if (actor.canReceive(item)) {
|
if (actor.canReceive(item)) {
|
||||||
return {
|
return {
|
||||||
destId: destItemId,
|
destId: destItemId,
|
||||||
|
Loading…
Reference in New Issue
Block a user