Skip to content

Commit

Permalink
More fixes to previewing items
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Aug 16, 2024
1 parent c498f14 commit a88b45b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/applications/trading-app/TradeEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import * as Helpers from "../../helpers/helpers.js";
import SETTINGS from "../../constants/settings.js";
import { SYSTEMS } from "../../systems.js";
export let store;
export let data;
Expand All @@ -13,11 +14,19 @@
if (!canPreview || !data.id) return;
const item = store.leftTraderActor.items.get(data.id) ?? store.rightTraderActor.items.get(data.id);
if (!item) return;
if (game.user.isGM || item.ownership[game.user.id] === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) {
if (SYSTEMS.DATA?.PREVIEW_ITEM_TRANSFORMER) {
if (!SYSTEMS.DATA?.PREVIEW_ITEM_TRANSFORMER(item)) {
return;
}
}
if (game.user.isGM || item.ownership[game.user.id] === 3) {
return item.sheet.render(true);
}
const cls = item._getSheetClass()
const sheet = new cls(item, { editable: false })
const itemData = item.toObject();
itemData.ownership[game.user.id] = 1;
const newItem = new Item.implementation(itemData);
const cls = newItem._getSheetClass();
const sheet = new cls(newItem, { editable: false });
return sheet._render(true);
}
Expand Down

0 comments on commit a88b45b

Please sign in to comment.