Les auberges sont des commerces #600

Merged
uberwald merged 18 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-01-03 10:43:26 +01:00
3 changed files with 9 additions and 4 deletions
Showing only changes of commit 2ca601b5f8 - Show all commits

View File

@ -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) {

View File

@ -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);
} }

View File

@ -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,