Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Mar 25, 2023
1 parent d96b907 commit cb8673b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Item Piles Changelog

## Version 2.5.7

- Fixed double-clicking on linked tokens' actor sheets would not open the ephemeral actor sheet that has [Token] instead of [Prototype Token] in the header
- Fixed `removeExistingActorItems` causing the item pile UI to fail to display any new items

## Version 2.5.6

- Fixed clicking on item pile actors in the sidebar would not open the item pile UI, but the actor sheet
Expand Down
2 changes: 1 addition & 1 deletion src/API/private-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,9 @@ export default class PrivateAPI {
if (!foundry.utils.isEmpty(actorUpdates)) {
await actor.update(actorUpdates);
}
const createdItems = itemsToCreate.length ? await actor.createEmbeddedDocuments("Item", itemsToCreate) : [];
if (itemsToUpdate.length) await actor.updateEmbeddedDocuments("Item", itemsToUpdate);
if (itemsToDelete.length) await actor.deleteEmbeddedDocuments("Item", itemsToDelete);
const createdItems = itemsToCreate.length ? await actor.createEmbeddedDocuments("Item", itemsToCreate) : [];
return createdItems.map(item => item.toObject());
}

Expand Down
9 changes: 4 additions & 5 deletions src/libwrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ export default function registerLibwrappers() {
return wrapped(event);
}, "MIXED");

libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options) {
libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options, ...args) {
if (this && this._state > Application.RENDER_STATES.NONE) {
wrapped(forced, options);
}
if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory && !options?.bypassItemPiles) {
wrapped(forced, options, ...args);
} else if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory && !options?.bypassItemPiles) {
game.itempiles.API.renderItemPileInterface(this.document, { useDefaultCharacter: true });
return this;
}
return wrapped(forced);
return wrapped(forced, options, ...args);
}, "MIXED");

}

0 comments on commit cb8673b

Please sign in to comment.