Fix for babele and props
This commit is contained in:
@@ -38,7 +38,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
/**
|
/**
|
||||||
* Handle dropped data on the Actor sheet
|
* Handle dropped data on the Actor sheet
|
||||||
*/
|
*/
|
||||||
_onDrop(event) {
|
async _onDrop(event) {
|
||||||
// Check item type and subtype
|
// Check item type and subtype
|
||||||
const item = game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
|
const item = game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
|
||||||
if (
|
if (
|
||||||
@@ -70,8 +70,30 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
|
|
||||||
// TODO dropped a item with same id as one owned, add qte instead
|
// TODO dropped a item with same id as one owned, add qte instead
|
||||||
|
|
||||||
// Ok add item
|
// Babele and properties specific
|
||||||
return super._onDrop(event);
|
if (item.data.data.properties && typeof Babele !== "undefined") {
|
||||||
|
item.data.data.properties = await Promise.all(
|
||||||
|
item.data.data.properties.map(async (prop) => {
|
||||||
|
let gameProp = game.items.get(prop.id);
|
||||||
|
if (gameProp) {
|
||||||
|
// Live item
|
||||||
|
return { id: gameProp.id, name: gameProp.name };
|
||||||
|
} else {
|
||||||
|
// Pack item
|
||||||
|
gameProp = await game.packs.get(CONFIG.l5r5e.packsIds.properties.core).getEntry(prop.id);
|
||||||
|
if (gameProp) {
|
||||||
|
return { id: gameProp._id, name: gameProp.name };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prop;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ok add item - Foundry override cause props
|
||||||
|
const allowed = Hooks.call("dropActorSheetData", this.actor, this, item);
|
||||||
|
if (allowed === false) return;
|
||||||
|
return this._onDropItem(event, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user