Skip to content

Commit

Permalink
Fixes and such
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Apr 10, 2023
1 parent e386c15 commit 43ddafd
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 259 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Item Piles Changelog

## Version 2.6.1

- Tweaked the way default item pile data is applied, in the case of merchant columns
- Fixed `game.itempiles.API.createItemPile` not respecting an overriding `texture.src`, `texture.scaleX`, and `texture.scaleY` property on the token data
- Fixed populate items not having scroll bars when enough items was added to the merchant

## Version 2.6.0

- Added system specific columns to merchants, such as rarity in D&D 5e and bulk in Pathfinder 2e
Expand Down
26 changes: 20 additions & 6 deletions src/API/private-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,6 @@ export default class PrivateAPI {
if (createActor) {

let pileDataDefaults = foundry.utils.deepClone(CONSTANTS.PILE_DEFAULTS);
pileDataDefaults = foundry.utils.mergeObject(pileDataDefaults, foundry.utils.deepClone(SYSTEMS.DATA?.PILE_DEFAULTS ?? {}));

pileDataDefaults.enabled = true;
if (foundry.utils.isEmpty(itemPileFlags)) {
Expand Down Expand Up @@ -1063,7 +1062,6 @@ export default class PrivateAPI {
pileDataDefaults.singleItemScale = 0.75;
}

pileDataDefaults = foundry.utils.mergeObject(pileDataDefaults, foundry.utils.deepClone(SYSTEMS.DATA?.PILE_DEFAULTS ?? {}));
pileDataDefaults = foundry.utils.mergeObject(pileDataDefaults, itemPileFlags);

const actorData = {
Expand Down Expand Up @@ -1140,9 +1138,17 @@ export default class PrivateAPI {

const data = { data: pileData, items: items };

const overrideImage = getProperty(overrideData, "texture.src") ?? getProperty(overrideData, "img");
const overrideScale = getProperty(overrideData, "texture.scaleX")
?? getProperty(overrideData, "texture.scaleY")
?? getProperty(overrideData, "img");

const scale = PileUtilities.getItemPileTokenScale(pileActor, data, overrideScale);

overrideData = foundry.utils.mergeObject(overrideData, {
"img": PileUtilities.getItemPileTokenImage(pileActor, data, overrideData?.img),
"scale": PileUtilities.getItemPileTokenScale(pileActor, data, overrideData?.scale),
"texture.src": PileUtilities.getItemPileTokenImage(pileActor, data, overrideImage),
"texture.scaleX": scale,
"texture.scaleY": scale,
"name": PileUtilities.getItemPileName(pileActor, data, overrideData?.name),
});

Expand Down Expand Up @@ -1215,9 +1221,17 @@ export default class PrivateAPI {
? await tokenSettings(target)
: foundry.utils.deepClone(tokenSettings);

const overrideImage = getProperty(specificTokenSettings, "texture.src") ?? getProperty(specificTokenSettings, "img");
const overrideScale = getProperty(specificTokenSettings, "texture.scaleX")
?? getProperty(specificTokenSettings, "texture.scaleY")
?? getProperty(specificTokenSettings, "img");

const scale = PileUtilities.getItemPileTokenScale(target, data, overrideScale);

specificTokenSettings = foundry.utils.mergeObject(specificTokenSettings, {
"img": PileUtilities.getItemPileTokenImage(target, data, specificTokenSettings?.img),
"scale": PileUtilities.getItemPileTokenScale(target, data, specificTokenSettings?.scale),
"texture.src": PileUtilities.getItemPileTokenImage(target, data, overrideImage),
"texture.scaleX": scale,
"texture.scaleY": scale,
"name": PileUtilities.getItemPileName(target, data, specificTokenSettings?.name)
});

Expand Down
7 changes: 4 additions & 3 deletions src/applications/merchant-app/CategoryHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
<div style="flex: 0 1 auto">
{#if $priceModifiersPerType[type]}
<i class="fas fa-times item-piles-clickable-red"
on:click={() => { store.removeOverrideTypePrice(type, category.type === "custom") }}></i>
on:click={() => { store.removeOverrideTypePrice(type) }}></i>
{:else}
<i class="fas fa-plus item-piles-clickable-green"
on:click={() => { store.addOverrideTypePrice(type, category.type === "custom") }}></i>
on:click={() => { store.addOverrideTypePrice(type) }}></i>
{/if}
</div>
{/if}
Expand All @@ -56,10 +56,11 @@
h3 {
margin: 0;
flex: 1 0 auto;
}
.price-header {
flex: 0 1 250px;
flex: 0 1 calc(50% - 10px);
padding-right: 10px;
justify-content: center;
display: flex;
Expand Down
Loading

0 comments on commit 43ddafd

Please sign in to comment.