From a60bf3f3d075d6130b459df50621c360fe39a842 Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Tue, 5 Mar 2024 17:19:19 -0500 Subject: [PATCH 1/9] added IntelliJ project file type --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7bfd985b..c1a1bab4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ dist/* .vite-cache/* module.js module.js.map -style.css \ No newline at end of file +style.css +*.iml \ No newline at end of file From 765836767e2f68a8fa3f695684b9083ea370076a Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Tue, 5 Mar 2024 18:37:45 -0500 Subject: [PATCH 2/9] first version of shadowdark system --- src/systems/shadowdark.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/systems/shadowdark.js diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js new file mode 100644 index 00000000..112dd3b1 --- /dev/null +++ b/src/systems/shadowdark.js @@ -0,0 +1,18 @@ +export default { + "VERSION": "1.0.0", + + "ACTOR_CLASS_TYPE": "character", + + "ITEM_QUANTITY_ATTRIBUTE": "system.quantity", + + "ITEM_PRICE_ATTRIBUTE": "system.cost", + + "ITEM_FILTERS": [ + { + "path": "type", + "filters": "script,Spell" + } + ], + + "ITEM_SIMILARITIES": [ "name", "type" ] +} \ No newline at end of file From 048dabc58b7defd983cc29ff22074f47da70a9ac Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Wed, 6 Mar 2024 06:15:02 -0500 Subject: [PATCH 3/9] added shadowdark to systems.js, fixed actor class type --- src/systems.js | 4 ++++ src/systems/shadowdark.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systems.js b/src/systems.js index c65bdb19..1afc02ee 100644 --- a/src/systems.js +++ b/src/systems.js @@ -13,6 +13,7 @@ import wfrp4e from "./systems/wfrp4e.js"; import splittermond from "./systems/splittermond.js"; import forbiddenLands from "./systems/forbidden-lands.js"; import icrpg from "./systems/icrpg.js"; +import shadowdark from "./systems/shadowdark.js"; import swse from "./systems/swse.js"; import sw5e from "./systems/sw5e.js"; import sw5e203 from "./systems/sw5e-2.0.3.2.3.8.js"; @@ -153,6 +154,9 @@ export const SYSTEMS = { "demonlord": { "latest": demonlord }, + "shadowdark": { + "latest": shadowdark + }, // ↑ ADD SYSTEMS HERE ↑ }, diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index 112dd3b1..53b020c8 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -1,7 +1,7 @@ export default { "VERSION": "1.0.0", - "ACTOR_CLASS_TYPE": "character", + "ACTOR_CLASS_TYPE": "Player", "ITEM_QUANTITY_ATTRIBUTE": "system.quantity", From 3a4d409709eec2f4775d2c1d0f90cadf6697a28a Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Wed, 6 Mar 2024 06:20:25 -0500 Subject: [PATCH 4/9] formatted shadowdark.js in dnd5e style --- src/systems/shadowdark.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index 53b020c8..9c4f5d71 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -1,18 +1,24 @@ export default { - "VERSION": "1.0.0", - "ACTOR_CLASS_TYPE": "Player", + "VERSION": "1.0.0", - "ITEM_QUANTITY_ATTRIBUTE": "system.quantity", + // 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": "Player", - "ITEM_PRICE_ATTRIBUTE": "system.cost", + // 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", - "ITEM_FILTERS": [ - { - "path": "type", - "filters": "script,Spell" - } - ], + // The item price attribute is the path to the attribute on each item that determine how much it costs + "ITEM_PRICE_ATTRIBUTE": "system.cost", - "ITEM_SIMILARITIES": [ "name", "type" ] + // Item 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": "script,Spell" + }, + ], + + // Item similarities determines how item piles detect similarities and differences in the system + "ITEM_SIMILARITIES": ["name", "type"], } \ No newline at end of file From 69b379b753b0164e4415083c134c3bb4a5270ea2 Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Sun, 10 Mar 2024 07:25:01 -0400 Subject: [PATCH 5/9] added all filtered item types --- src/systems/shadowdark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index 9c4f5d71..45c2a630 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -15,7 +15,7 @@ export default { "ITEM_FILTERS": [ { "path": "type", - "filters": "script,Spell" + "filters": "Ancestry,Background,Boon,Class Ability,Class,Deity,Effect,Language,NPC Attack,NPC Special Attack,NPC Spell,NPC Feature,Property,Spell,Talent" }, ], From 98e9539f09ab44ffbacb6f02de9399f73aca3a6a Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Sun, 10 Mar 2024 07:35:21 -0400 Subject: [PATCH 6/9] fixed indentation --- src/systems.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systems.js b/src/systems.js index 997e5900..07ea3118 100644 --- a/src/systems.js +++ b/src/systems.js @@ -156,9 +156,9 @@ export const SYSTEMS = { "demonlord": { "latest": demonlord }, - "shadowdark": { - "latest": shadowdark - }, + "shadowdark": { + "latest": shadowdark + }, // ↑ ADD SYSTEMS HERE ↑ }, From a0436092dec8e1959af40f8097d726a3c842c8af Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Thu, 14 Mar 2024 22:44:29 -0400 Subject: [PATCH 7/9] added CURRENCIES and ITEM_COST_TRANSFORMER --- src/systems/shadowdark.js | 93 ++++++++++++++++++++++++++++++++------- 1 file changed, 77 insertions(+), 16 deletions(-) diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index 45c2a630..46c3cf60 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -1,24 +1,85 @@ export default { - "VERSION": "1.0.0", + "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": "Player", + // 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": "Player", - // 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 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.cost", + // The item price attribute is the path to the attribute on each item that determine how much it costs + "ITEM_PRICE_ATTRIBUTE": "system.cost", - // Item 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": "Ancestry,Background,Boon,Class Ability,Class,Deity,Effect,Language,NPC Attack,NPC Special Attack,NPC Spell,NPC Feature,Property,Spell,Talent" - }, - ], + // Item 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": "Ancestry,Background,Boon,Class Ability,Class,Deity,Effect,Language,NPC Attack,NPC Special Attack,NPC Spell,NPC Feature,Property,Spell,Talent" + }, + ], + + // 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: "attribute", + name: "SHADOWDARK.CurrencyGP", + img: "icons/commodities/currency/coin-embossed-crown-gold.webp", + abbreviation: "{#}GP", + data: { + path: "system.coins.gp", + }, + primary: true, + exchangeRate: 1 + }, + { + type: "attribute", + name: "SHADOWDARK.CurrencySP", + img: "icons/commodities/currency/coin-engraved-moon-silver.webp", + abbreviation: "{#}SP", + data: { + path: "system.coins.sp", + }, + primary: false, + exchangeRate: 0.1 + }, + { + type: "attribute", + name: "SHADOWDARK.CurrencyCP", + img: "icons/commodities/currency/coin-engraved-waves-copper.webp", + abbreviation: "{#}CP", + data: { + path: "system.coins.cp", + }, + primary: false, + exchangeRate: 0.01 + } + ], + + // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format + "ITEM_COST_TRANSFORMER": (item, currencies) => { + const cost = getProperty(item, "system.cost") ?? {}; + let totalCost = 0; + for (const costDenomination in cost) { + const subCost = Number(getProperty(cost, costDenomination)) ?? 0; + if (subCost === 0) { + continue; + } - // Item similarities determines how item piles detect similarities and differences in the system - "ITEM_SIMILARITIES": ["name", "type"], + const currencyDenomination = currencies + .filter(currency => currency.type === "attribute") + .find(currency => { + return currency.data.path.toLowerCase().endsWith(costDenomination); + }); + + totalCost += subCost * currencyDenomination?.exchangeRate ?? 1; + } + + return totalCost; + }, } \ No newline at end of file From 5957ce46746c01ce537d6ba61364f544a8626497 Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Fri, 15 Mar 2024 21:27:30 -0400 Subject: [PATCH 8/9] removed ITEM_PRICE_ATTRIBUTE, updated currency names --- src/systems/shadowdark.js | 55 ++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index 46c3cf60..e26ba508 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -1,6 +1,6 @@ export default { - "VERSION": "1.0.0", + "VERSION": "1.0.2", // 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": "Player", @@ -8,9 +8,6 @@ export default { // 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.cost", - // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes "ITEM_FILTERS": [ { @@ -27,37 +24,37 @@ export default { // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data "CURRENCIES": [ { - type: "attribute", - name: "SHADOWDARK.CurrencyGP", - img: "icons/commodities/currency/coin-embossed-crown-gold.webp", - abbreviation: "{#}GP", - data: { - path: "system.coins.gp", + "type": "attribute", + "name": "Gold Pieces", + "img": "icons/commodities/currency/coin-embossed-crown-gold.webp", + "abbreviation": "{#}GP", + "data": { + "path": "system.coins.gp", }, - primary: true, - exchangeRate: 1 + "primary": true, + "exchangeRate": 1 }, { - type: "attribute", - name: "SHADOWDARK.CurrencySP", - img: "icons/commodities/currency/coin-engraved-moon-silver.webp", - abbreviation: "{#}SP", - data: { - path: "system.coins.sp", + "type": "attribute", + "name": "Silver Pieces", + "img": "icons/commodities/currency/coin-engraved-moon-silver.webp", + "abbreviation": "{#}SP", + "data": { + "path": "system.coins.sp", }, - primary: false, - exchangeRate: 0.1 + "primary": false, + "exchangeRate": 0.1 }, { - type: "attribute", - name: "SHADOWDARK.CurrencyCP", - img: "icons/commodities/currency/coin-engraved-waves-copper.webp", - abbreviation: "{#}CP", - data: { - path: "system.coins.cp", + "type": "attribute", + "name": "Copper Pieces", + "img": "icons/commodities/currency/coin-engraved-waves-copper.webp", + "abbreviation": "{#}CP", + "data": { + "path": "system.coins.cp", }, - primary: false, - exchangeRate: 0.01 + "primary": false, + "exchangeRate": 0.01 } ], @@ -81,5 +78,5 @@ export default { } return totalCost; - }, + } } \ No newline at end of file From 225458e9fdbfbdae3d3f31d02c871a31badccabd Mon Sep 17 00:00:00 2001 From: Jason Burke Date: Sat, 16 Mar 2024 06:35:36 -0400 Subject: [PATCH 9/9] default exchangeRate to 0 if not found --- src/systems/shadowdark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/shadowdark.js b/src/systems/shadowdark.js index e26ba508..2d6b5ca8 100644 --- a/src/systems/shadowdark.js +++ b/src/systems/shadowdark.js @@ -74,7 +74,7 @@ export default { return currency.data.path.toLowerCase().endsWith(costDenomination); }); - totalCost += subCost * currencyDenomination?.exchangeRate ?? 1; + totalCost += subCost * currencyDenomination?.exchangeRate ?? 0; } return totalCost;