Skip to content

Commit

Permalink
1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Jan 23, 2022
1 parent 7173dbb commit cced512
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 18 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 1.2.8
- Added `Open Actor Sheet` and `Configure Pile` buttons to the Item Pile inventory UI (visible only to GMs)
- Fixed bug where Item Piles would ignore case-sensitive item filters and attribute paths
- Updated German localization

## Version 1.2.7
- Fixed newly created item piles would not update their image, scale, or name

Expand Down
26 changes: 13 additions & 13 deletions languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
},

"FilterEditor": {
"Title": "Item Filters Editor",
"Explanation": "Here you can define multiple types of filters that will exclude certain types of items. Based on the attribute path given, the item pile could find the \"type\" of an item and based on the filters, it hides those items in the item pile inventory UI.",
"Filters": "Filters",
"AddNew": "Add new filter",
"Submit": "Submit Filters"
"Title": "Gegenstandsfilter Editor",
"Explanation": "Hier kannst du mehrere Arten von Filtern definieren, die bestimmte Arten von Gegenständen ausschließen. Basierend auf dem angegebenen Attributpfad kann der Gegenstandsstapel den \"Typ\" eines Gegenstands finden, und basierend auf den Filtern werden diese Gegenstände in der Benutzeroberfläche des Gegenstandsstapels ausgeblendet.",
"Filters": "Filter",
"AddNew": "Neuer Filter zufügen",
"Submit": "Filter übertragen"
},

"AttributePath": "Attributspfad",
Expand Down Expand Up @@ -90,9 +90,9 @@
"OverrideAttributes": "Dynamische Attribute außer Kraft setzen",
"OverrideAttributesExplanation": "Legen Sie fest, ob dieser Stapel andere Attribute als die Standardattribute übertragen können soll.",
"ConfigureOverrideAttributes": "Konfiguriere: Dynamische Attribute außer Kraft setzen",
"OverrideItemFilters": "Override Item Filters",
"OverrideItemFiltersExplanation": "Configure if this pile should be able to transfer other types items than the default.",
"ConfigureOverrideItemFilters": "Configure Override Item Filters"
"OverrideItemFilters": "Übersteuere Gegenstandsfilter",
"OverrideItemFiltersExplanation": "Lege fest, ob dieser Stapel in der Lage sein soll, andere Arten von Gegenständen als die Standardtypen zu übertragen.",
"ConfigureOverrideItemFilters": "Konfiguriere den Gegenstandsfilter"
},

"SingleItem": {
Expand All @@ -102,8 +102,8 @@
"DisplayOneExplanation": "Besteht der Stapel aus einem einzigen Gegenstand, wird das Bild des Stapels auf das Bild des Gegenstandes gesetzt.",
"OverrideScale": "Einzelne Gegenstands-Token-Skalierung außer Kraft setzen",
"Scale": "Gegenstands-Token-Skalierung",
"ItemName": "Use Item Name",
"ItemNameExplanation": "Causes the item pile to be named after the single item it contains."
"ItemName": "Benutze Gegenstandsname",
"ItemNameExplanation": "Veranlasst, dass der Gegenstandsstapel nach dem einzelnen darin enthaltenen Gegenstand benannt wird."
},

"Container": {
Expand Down Expand Up @@ -163,9 +163,9 @@
"Hint": "Mit dieser Einstellung werden die Attribute festgelegt, die für die Abholung in Artikelpfaden in Frage kommen, z. B. Währungen oder Stärken, bei denen es sich nicht um tatsächliche Artikel handeln muss."
},
"ItemFilters": {
"Title": "Item filters",
"Label": "Configure Item Filters",
"Hint": "Here you can configure what items are ignored and not listed in the item pile dialogs."
"Title": "Gegenstandsfilter",
"Label": "Gegenstandsfilter einstellen",
"Hint": "Hier können Sie einstellen, welche Gegenstände ignoriert und nicht in den Gegenstandsstapeldialogen aufgeführt werden."
},
"OutputToChat": {
"Title": "Ausgabe im Chat",
Expand Down
3 changes: 2 additions & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"TakeAll": "Take All Items",
"Take": "Take",
"Close": "Close Lid",
"Leave": "Leave"
"Leave": "Leave",
"OpenSheet": "Open Actor Sheet"
},

"Errors": {
Expand Down
34 changes: 32 additions & 2 deletions scripts/formapplications/itemPileInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import API from "../api.js";
import * as lib from "../lib/lib.js";
import { isPileInventoryOpenForOthers } from "../socket.js";
import HOOKS from "../hooks.js";
import { ItemPileConfig } from "./itemPileConfig.js";

export class ItemPileInventory extends FormApplication {

Expand All @@ -23,7 +24,7 @@ export class ItemPileInventory extends FormApplication {
this.interactionId = randomID();
this.overrides = overrides;
this.pileData = lib.getItemPileData(this.pile);
Hooks.callAll(HOOKS.PILE.OPEN_INVENTORY, this, pile, recipient);
Hooks.callAll(HOOKS.PILE.OPEN_INVENTORY, this, pile, recipient, overrides);
}

/** @inheritdoc */
Expand All @@ -32,7 +33,7 @@ export class ItemPileInventory extends FormApplication {
title: game.i18n.localize("ITEM-PILES.Inspect.Title"),
classes: ["sheet", "item-pile-inventory-sheet"],
template: `${CONSTANTS.PATH}templates/item-pile-inventory.html`,
width: 450,
width: 500,
height: "auto",
dragDrop: [{ dragSelector: null, dropSelector: ".item-piles-item-drop-container" }],
});
Expand Down Expand Up @@ -78,6 +79,35 @@ export class ItemPileInventory extends FormApplication {

/* -------------------------------------------- */

/** @override */
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
const canConfigure = game.user.isGM;
if (canConfigure) {
buttons = [
{
label: "ITEM-PILES.Inspect.OpenSheet",
class: "item-piles-open-actor-sheet",
icon: "fas fa-user",
onclick: () => {
const actor = this.pile.actor ?? this.pile;
actor.sheet.render(true, { focus: true });
}
},
{
label: "ITEM-PILES.HUD.Configure",
class: "item-piles-configure-pile",
icon: "fas fa-box-open",
onclick: () => {
const actor = this.pile.actor ?? this.pile;
ItemPileConfig.show(actor);
}
},
].concat(buttons);
}
return buttons
}

saveItems() {
let self = this;
this.items = [];
Expand Down
4 changes: 2 additions & 2 deletions scripts/lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ export function getDocumentItemFilters(target){
*/
export function cleanItemFilters(itemFilters){
return itemFilters ? foundry.utils.duplicate(itemFilters).map(filter => {
filter.path = filter.path.trim().toLowerCase();
filter.filters = new Set(filter.filters.split(',').map(string => string.trim().toLowerCase()));
filter.path = filter.path.trim();
filter.filters = new Set(filter.filters.split(',').map(string => string.trim()));
return filter;
}) : [];
}
Expand Down

0 comments on commit cced512

Please sign in to comment.