Skip to content

Commit

Permalink
Fixes galore
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Mar 28, 2023
1 parent 3807189 commit 1746de4
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 60 deletions.
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Item Piles Changelog

## Version 2.5.8

- Added support for the D&D 4e system (thank you EndlesNights on github!)
- Added support for the Naheulbeuk system
- Removed internal support for the Cepheus & Traveller system, as it is officially supported by the system! Thanks
- Updates to French and Portuguese (Brazil) localization (thank you rectulo and eunaumtenhoid on Weblate!)
- Tweaked the way item piles injects itself into the `ActorSheet#render` methods to be more robust
- Tweaked the "Show To Users" UI to include users who own characters but have chosen to not tie them to their user account
- Tweaked how some item pile data is stored on tokens and actors to improve long-term module health
- Fixed deprecation warning (thank you marvin9257 on github!)

## 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
Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Item Piles is designed to work in all systems, but may require some setup for it
- [Index Card RPG](https://foundryvtt.com/packages/icrpg)
- [Forbidden Lands](https://foundryvtt.com/packages/forbidden-lands)
- [Fallout 2d20](https://foundryvtt.com/packages/fallout)
- [Cepheus & Traveller](https://foundryvtt.com/packages/twodsix)
- [Cyberpunk RED](https://foundryvtt.com/packages/cyberpunk-red-core)
- [Coriolis](https://foundryvtt.com/packages/yzecoriolis)
- [KNAVE](https://foundryvtt.com/packages/knave)
Expand All @@ -99,12 +98,14 @@ Item Piles is designed to work in all systems, but may require some setup for it
- [Dungeon Crawl Classics](https://foundryvtt.com/packages/dcc/)
- [Level Up: Advanced 5th Edition](https://foundryvtt.com/packages/a5e)
- [Dark Heresy 2nd Edition](https://foundryvtt.com/packages/dark-heresy)
- [Naheulbeuk](https://foundryvtt.com/packages/naheulbeuk)

## Externally support systems

These systems have integrated their own support of Item Piles, rather than Item Piles managing the system's settings. If you have any bugs relating to these systems specifically, please contact their creators.

- [Old-School Essentials](https://foundryvtt.com/packages/ose)
- [Cepheus & Traveller](https://foundryvtt.com/packages/twodsix)

## Semi-supported systems

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
import { ApplicationShell } from "@typhonjs-fvtt/runtime/svelte/component/core";
import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';
import { getContext } from "svelte";
import { getUserCharacter, getOwnedCharacters } from "../../../helpers/utilities.js";
const { application } = getContext('#external');
export let elementRoot;
let form;
getUserCharacter()
const users = game.users
.filter(u => u.active && (u.character || u.isGM) && !(application.options.excludeSelf && u === game.user))
.filter(u => u.active && (getUserCharacter(u) || u.isGM) && !(application.options.excludeSelf && u === game.user))
.map(u => ({
id: u.id,
name: u.name,
Expand Down
9 changes: 5 additions & 4 deletions src/helpers/pile-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ export function getActorCurrencies(target, { forActor = false, currencyList = fa
const actorItems = actor ? Array.from(actor.items) : [];
currencyList = currencyList || getCurrencyList(forActor || actor);
let currencies = currencyList.map((currency, index) => {
if (currency.type === "attribute") {
if (currency.type === "attribute" || !currency.type) {
const path = currency?.data?.path ?? currency?.path;
return {
...currency,
quantity: getProperty(actor, currency.data.path) ?? 0,
path: currency.data.path,
id: currency.data.path,
quantity: getProperty(actor, path) ?? 0,
path: path,
id: path,
index
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/libwrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ export default function registerLibwrappers() {
}, "MIXED");

libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options, ...args) {
if (this && this._state > Application.RENDER_STATES.NONE) {
wrapped(forced, options, ...args);
} else if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory && !options?.bypassItemPiles) {
const renderItemPileInterface = forced && !options?.bypassItemPiles && PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory;
if (this._state > Application.RENDER_STATES.NONE) {
if (renderItemPileInterface) {
wrapped(forced, options, ...args)
} else {
return wrapped(forced, options, ...args)
}
}
if (renderItemPileInterface) {
game.itempiles.API.renderItemPileInterface(this.document, { useDefaultCharacter: true });
return this;
return;
}
return wrapped(forced, options, ...args);
}, "MIXED");
Expand Down
4 changes: 2 additions & 2 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export async function checkSystem() {

}

await Helpers.setSetting(SETTINGS.SYSTEM_FOUND, true);

if (Helpers.getSetting(SETTINGS.SYSTEM_FOUND) || SYSTEMS.DATA.INTEGRATION) {
const currentVersion = Helpers.getSetting(SETTINGS.SYSTEM_VERSION);
const newVersion = SYSTEMS.DATA.VERSION;
Expand All @@ -96,6 +94,8 @@ export async function checkSystem() {
}
return;
}

await Helpers.setSetting(SETTINGS.SYSTEM_FOUND, true);

if (Helpers.getSetting(SETTINGS.SYSTEM_NOT_FOUND_WARNING_SHOWN)) {
Helpers.custom_notify(game.i18n.localize("ITEM-PILES.Notifications.SystemSupportFound"));
Expand Down
8 changes: 4 additions & 4 deletions src/systems.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import swade from "./systems/swade.js";
import tormenta20 from "./systems/tormenta20.js";
import wfrp4e from "./systems/wfrp4e.js";
import splittermond from "./systems/splittermond.js";
import twodsix from "./systems/twodsix.js";
import forbiddenLands from "./systems/forbidden-lands.js";
import icrpg from "./systems/icrpg.js";
import swse from "./systems/swse.js";
Expand All @@ -29,6 +28,7 @@ import ptu from "./systems/ptu.js";
import dcc from "./systems/dcc.js";
import a5e from "./systems/a5e.js";
import darkHeresy2e from "./systems/dark-heresy.js";
import naheulbeuk from "./systems/naheulbeuk.js";
// ↑ IMPORT SYSTEMS HERE ↑

/**
Expand Down Expand Up @@ -73,9 +73,6 @@ export const SYSTEMS = {
"splittermond": {
"latest": splittermond
},
"twodsix": {
"latest": twodsix
},
"forbidden-lands": {
"latest": forbiddenLands
},
Expand Down Expand Up @@ -126,6 +123,9 @@ export const SYSTEMS = {
},
"dark-heresy": {
"latest": darkHeresy2e
},
"naheulbeuk": {
"latest": naheulbeuk
}
// ↑ ADD SYSTEMS HERE ↑
},
Expand Down
84 changes: 84 additions & 0 deletions src/systems/naheulbeuk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
export default {

"VERSION": "1.0.0",

// The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.
"ACTOR_CLASS_TYPE": "character",

// The item quantity attribute is the path to the attribute on items that denote how many of that item that exists
"ITEM_QUANTITY_ATTRIBUTE": "system.quantity",

// The item price attribute is the path to the attribute on each item that determine how much it costs
"ITEM_PRICE_ATTRIBUTE": "system.prix",

// Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes
"ITEM_FILTERS": [
{
"path": "type",
"filters": "ape,attaque,competence,coup,etat,metier,origine,region,sort,trait"
}
],

// This function is an optional system handler that specifically transforms an item when it is added to actors
"ITEM_TRANSFORMER": async (itemData) => {
["equipe"].forEach(key => {
if (itemData?.system?.[key] !== undefined) {
delete itemData.system[key];
}
});
return itemData;
},

// Item similarities determines how item piles detect similarities and differences in the system
"ITEM_SIMILARITIES": ["name", "type"],

// Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)
// In the case of attributes, the path is relative to the "actor.system"
// In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data
"CURRENCIES": [
{
type: "item",
name: "Pièce d'argent",
img: "systems/naheulbeuk/assets/from-rexard-icons/Tresors/tresor%20(101).webp",
abbreviation: "{#}PA",
data: {
uuid: "Compendium.naheulbeuk.trucs.BTUFKc6sEbJLmlas"
},
primary: false,
exchangeRate: 10
},
{
type: "item",
name: "Pièce d'or",
img: "systems/naheulbeuk/assets/from-rexard-icons/Tresors/tresor%20(52).webp",
abbreviation: "{#}PO",
data: {
uuid: "Compendium.naheulbeuk.trucs.AKuErwzQ6wDxtzyp"
},
primary: true,
exchangeRate: 1
},
{
type: "item",
name: "Lingot de Thrytil",
img: "systems/naheulbeuk/assets/from-rexard-icons/Objets/Materiaux/objet%20(291).webp",
abbreviation: "{#}LT",
data: {
uuid: "Compendium.naheulbeuk.trucs.tOTNc2WYpkyf2Yyl"
},
primary: false,
exchangeRate: 0.01
},
{
type: "item",
name: "Lingot de Berylium",
img: "systems/naheulbeuk/assets/from-rexard-icons/Objets/Materiaux/objet%20(252).webp",
abbreviation: "{#}LB",
data: {
uuid: "Compendium.naheulbeuk.trucs.r4qLXqXaIIdyKzOf"
},
primary: false,
exchangeRate: 0.002
}
]
}
2 changes: 1 addition & 1 deletion src/systems/swade.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {

"VERSION": "1.0.3",
"VERSION": "1.0.4",

// The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.
"ACTOR_CLASS_TYPE": "character",
Expand Down
43 changes: 0 additions & 43 deletions src/systems/twodsix.js

This file was deleted.

0 comments on commit 1746de4

Please sign in to comment.