From cb8e2e9c892f7a0668e317a8b2b29fed0826598b Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 26 Mar 2024 21:52:23 -0400 Subject: [PATCH] dnd4e support update --- src/systems.js | 4 +- src/systems/dnd4e-0.4.43.js | 151 ++++++++++++++++++++++++++++++++++++ src/systems/dnd4e.js | 22 +++--- 3 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 src/systems/dnd4e-0.4.43.js diff --git a/src/systems.js b/src/systems.js index 42696002..29a1b009 100644 --- a/src/systems.js +++ b/src/systems.js @@ -1,5 +1,6 @@ // ↓ IMPORT SYSTEMS HERE ↓ import dnd4e from "./systems/dnd4e.js"; +import dnd4e0443 from "./systems/dnd4e-0.4.43.js"; import dnd5e from "./systems/dnd5e.js"; import dnd5e203 from "./systems/dnd5e-2.0.3.js"; import pf1 from "./systems/pf1.js"; @@ -52,7 +53,8 @@ export const SYSTEMS = { "latest": alienrpg }, "dnd4e": { - "latest": dnd4e + "latest": dnd4e, + "0.4.43": dnd4e0443, }, "dnd5e": { "latest": dnd5e, diff --git a/src/systems/dnd4e-0.4.43.js b/src/systems/dnd4e-0.4.43.js new file mode 100644 index 00000000..dcab4df2 --- /dev/null +++ b/src/systems/dnd4e-0.4.43.js @@ -0,0 +1,151 @@ +export default { + + "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": "Player 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.price", + + // 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": "classFeats,feat,raceFeats,pathFeats,destinyFeats,ritual,power" + } + ], + + // This function is an optional system handler that specifically transforms an item when it is added to actors + "ITEM_TRANSFORMER": async (itemData) => { + ["equipped", "proficient", "prepared"].forEach(key => { + if (itemData?.system?.[key] !== undefined) { + delete itemData.system[key]; + } + }); + setProperty(itemData, "system.attunement", false); + 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: "attribute", + name: "DND4EBETA.CurrencyAD", + img: "icons/commodities/gems/gem-faceted-round-white.webp", + abbreviation: "{#}AD", + data: { + path: "system.currency.ad" + }, + primary: false, + exchangeRate: 10000 + }, + { + type: "attribute", + name: "DND4EBETA.CurrencyPP", + img: "icons/commodities/currency/coin-inset-snail-silver.webp", + abbreviation: "{#}PP", + data: { + path: "system.currency.pp" + }, + primary: false, + exchangeRate: 100 + }, + { + type: "attribute", + name: "DND4EBETA.CurrencyGP", + img: "icons/commodities/currency/coin-embossed-crown-gold.webp", + abbreviation: "{#}GP", + data: { + path: "system.currency.gp", + }, + primary: true, + exchangeRate: 1 + }, + { + type: "attribute", + name: "DND4EBETA.CurrencySP", + img: "icons/commodities/currency/coin-engraved-moon-silver.webp", + abbreviation: "{#}SP", + data: { + path: "system.currency.sp", + }, + primary: false, + exchangeRate: 0.1 + }, + { + type: "attribute", + name: "DND4EBETA.CurrencyCP", + img: "icons/commodities/currency/coin-engraved-waves-copper.webp", + abbreviation: "{#}CP", + data: { + path: "system.currency.cp", + }, + primary: false, + exchangeRate: 0.01 + }, + { + type: "attribute", + name: "DND4EBETA.RitualCompAR", + img: "icons/commodities/materials/bowl-powder-teal.webp", + abbreviation: "{#}AR", + data: { + path: "system.ritualcomp.ar", + }, + primary: false, + exchangeRate: 1 + }, + { + type: "attribute", + name: "DND4EBETA.RitualCompMS", + img: "icons/commodities/materials/bowl-liquid-white.webp", + abbreviation: "{#}MS", + data: { + path: "system.ritualcomp.ms", + }, + primary: false, + exchangeRate: 1 + }, + { + type: "attribute", + name: "DND4EBETA.RitualCompRH", + img: "icons/commodities/materials/plant-sprout-seed-brown-green.webp", + abbreviation: "{#}RH", + data: { + path: "system.ritualcomp.rh", + }, + primary: false, + exchangeRate: 1 + }, + { + type: "attribute", + name: "DND4EBETA.RitualCompSI", + img: "icons/commodities/materials/bowl-liquid-red.webp", + abbreviation: "{#}SI", + data: { + path: "system.ritualcomp.si", + }, + primary: false, + exchangeRate: 1 + }, + { + type: "attribute", + name: "DND4EBETA.RitualCompRS", + img: "icons/commodities/gems/gem-faceted-cushion-teal.webp", + abbreviation: "{#}RS", + data: { + path: "system.ritualcomp.rs", + }, + primary: false, + exchangeRate: 1 + } + ] +} diff --git a/src/systems/dnd4e.js b/src/systems/dnd4e.js index 8b36a174..7a1c0fe9 100644 --- a/src/systems/dnd4e.js +++ b/src/systems/dnd4e.js @@ -1,6 +1,6 @@ export default { - "VERSION": "1.0.4", + "VERSION": "1.0.5", // 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 Character", @@ -39,7 +39,7 @@ export default { "CURRENCIES": [ { type: "attribute", - name: "DND4EBETA.CurrencyAD", + name: "DND4E.CurrencyAD", img: "icons/commodities/gems/gem-faceted-round-white.webp", abbreviation: "{#}AD", data: { @@ -50,7 +50,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.CurrencyPP", + name: "DND4E.CurrencyPP", img: "icons/commodities/currency/coin-inset-snail-silver.webp", abbreviation: "{#}PP", data: { @@ -61,7 +61,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.CurrencyGP", + name: "DND4E.CurrencyGP", img: "icons/commodities/currency/coin-embossed-crown-gold.webp", abbreviation: "{#}GP", data: { @@ -72,7 +72,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.CurrencySP", + name: "DND4E.CurrencySP", img: "icons/commodities/currency/coin-engraved-moon-silver.webp", abbreviation: "{#}SP", data: { @@ -83,7 +83,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.CurrencyCP", + name: "DND4E.CurrencyCP", img: "icons/commodities/currency/coin-engraved-waves-copper.webp", abbreviation: "{#}CP", data: { @@ -94,7 +94,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.RitualCompAR", + name: "DND4E.RitualCompAR", img: "icons/commodities/materials/bowl-powder-teal.webp", abbreviation: "{#}AR", data: { @@ -105,7 +105,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.RitualCompMS", + name: "DND4E.RitualCompMS", img: "icons/commodities/materials/bowl-liquid-white.webp", abbreviation: "{#}MS", data: { @@ -116,7 +116,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.RitualCompRH", + name: "DND4E.RitualCompRH", img: "icons/commodities/materials/plant-sprout-seed-brown-green.webp", abbreviation: "{#}RH", data: { @@ -127,7 +127,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.RitualCompSI", + name: "DND4E.RitualCompSI", img: "icons/commodities/materials/bowl-liquid-red.webp", abbreviation: "{#}SI", data: { @@ -138,7 +138,7 @@ export default { }, { type: "attribute", - name: "DND4EBETA.RitualCompRS", + name: "DND4E.RitualCompRS", img: "icons/commodities/gems/gem-faceted-cushion-teal.webp", abbreviation: "{#}RS", data: {