Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Sep 2, 2024
1 parent 5d23214 commit db7ec3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Version 3.1.3

- Updated Polish localization (thank you Lioheart on weblate!)
- Fixed some issues with Custom System Builder and item pile item quantities
- Fixed issues with merchants and custom prices utilizing secondary currencies
- Fixed adding container and non-stackable items into item piles from the same source would throw Foundry database errors
- Fixed merchant populate items tab not loading if a table had been added to the merchant and subsequently deleted
Expand Down
22 changes: 12 additions & 10 deletions src/helpers/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,20 @@ export function getDocumentTemplates(templateType) {
* @returns {Set<string>} The items type that can be stacked on this system
*/
export function getItemTypesThatCanStack() {
if (!itemTypesWithQuantities) {

itemTypesWithQuantities = new Set();
itemTypesWithQuantities ??= new Set();

if (game.system.id === "custom-system-builder") {
const quantityAttribute = game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE.split(".").pop();
const itemTemplates = game.items
.filter(_i => _i?.templateSystem?.isTemplate && _i?.templateSystem?.getKeys)
.filter(_i => _i.templateSystem.getKeys().has(quantityAttribute));
for (const item of itemTemplates) {
itemTypesWithQuantities.add(item.name);
}
if (game.system.id === "custom-system-builder") {
const quantityAttribute = game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE.split(".").pop();
const itemTemplates = game.items
.filter(_i => _i?.templateSystem?.isTemplate && _i?.templateSystem?.getKeys)
.filter(_i => _i.templateSystem.getKeys().has(quantityAttribute));
for (const item of itemTemplates) {
itemTypesWithQuantities.add(item.name);
}
}

if (!itemTypesWithQuantities) {

const unstackableItemTypes = Helpers.getSetting(SETTINGS.UNSTACKABLE_ITEM_TYPES);
const templates = getDocumentTemplates("Item");
Expand All @@ -180,6 +181,7 @@ export function getItemTypesThatCanStack() {
return hasItemQuantity(itemTemplate);
})].filter(type => !unstackableItemTypes.includes(type)));
}

return itemTypesWithQuantities;
}

Expand Down

0 comments on commit db7ec3c

Please sign in to comment.