diff --git a/gulpfile.mjs b/gulpfile.mjs index 22138b5f..314b7354 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -113,6 +113,7 @@ async function prepareDB() { convert("./src/packs/_source/nachteile", "./src/packs/__source/vorteile", "Advantage", false); convert("./src/packs/_source/sonderfertigkeiten", "./src/packs/__source/sonderfertigkeiten", "SpecialAbility"); convert("./src/packs/_source/waffen", "./src/packs/__source/waffen", "Equipment"); + convert("./src/packs/_source/waehrungen", "./src/packs/__source/waehrungen", "Equipment"); convert("./src/packs/_source/munition", "./src/packs/__source/munition", "Equipment"); convert("./src/packs/_source/ruestzeug", "./src/packs/__source/ruestzeug", "Equipment"); convert("./src/packs/_source/liturgien-und-segnungen", "./src/packs/__source/liturgien", "Liturgy"); diff --git a/src/module/data/equipment.mjs b/src/module/data/equipment.mjs index fd2a4f33..59e457ed 100644 --- a/src/module/data/equipment.mjs +++ b/src/module/data/equipment.mjs @@ -52,6 +52,9 @@ export class EquipmentDataModel extends BaseItem { max: new NumberField({required: true, initial: 1}), count: new NumberField({required: true, initial: 1}), }, {required: false}), + + currencyName: new StringField({required: false}), + currencyDenominator: new NumberField({required: false}), } } diff --git a/src/module/sheets/character/equipment.mjs b/src/module/sheets/character/equipment.mjs index 6e3b732a..9f6d4730 100644 --- a/src/module/sheets/character/equipment.mjs +++ b/src/module/sheets/character/equipment.mjs @@ -38,6 +38,17 @@ export default { context.maxcarryingcapacity = actorData.system.attribute.kk.aktuell context.carryingpercentage = Math.min((context.carryingweight / context.maxcarryingcapacity) * 100, 100); + context.wealth = 0 + + actorData.itemTypes["Equipment"].forEach(coin => { + console.log(coin.name, coin.system.category) + if (coin.system.category.indexOf("Währung") !== -1) { + console.log(context.wealth, coin) + context.wealth += (coin.system.quantity * coin.system.currencyDenominator) + } + }) + console.log(context.wealth) + const maxSets = 3 const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"] context.sets = [] diff --git a/src/module/sheets/equipmentSheet.mjs b/src/module/sheets/equipmentSheet.mjs index 1f4c07f1..3af53364 100644 --- a/src/module/sheets/equipmentSheet.mjs +++ b/src/module/sheets/equipmentSheet.mjs @@ -62,6 +62,9 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2) ammunition: { template: `systems/DSA_4-1/templates/item/equipment/tab-ammunition.hbs` }, + currency: { + template: 'systems/DSA_4-1/templates/item/equipment/tab-currency.hbs' + }, armor: { template: `systems/DSA_4-1/templates/item/equipment/tab-armor.hbs` }, @@ -101,6 +104,8 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2) delete normalisedFormData.isAmmunition if (normalisedFormData.isArmor) normalisedFormData['system.category'].push("Rüstung") delete normalisedFormData.isArmor + if (normalisedFormData.isCurrency) normalisedFormData['system.category'].push("Währung") + delete normalisedFormData.isCurrency await this.document.update(normalisedFormData) // Note: formData.object } @@ -119,6 +124,12 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2) case 'armor': this.#prepareArmorContext(context) break; + case 'ammunition': + this.#prepareAmmunitionContext(context) + break; + case 'currency': + this.#prepareCurrencyContext(context) + break; case 'settings': this.#prepareSettingsContext(context) break; @@ -196,11 +207,16 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2) } + #prepareCurrencyContext(context) { + + } + #prepareSettingsContext(context) { context.isMelee = this.document.system.category.includes("Nahkampfwaffe") context.isRanged = this.document.system.category.includes("Fernkampfwaffe") context.isAmmunition = this.document.system.category.includes("Munition") context.isArmor = this.document.system.category.includes("Rüstung") + context.isCurrency = this.document.system.category.includes("Währung") } /** @@ -234,6 +250,11 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2) id: 'armor', group: group, label: 'Rüstung' }) } + if (category.includes("Währung")) { + tabs.tabs.push({ + id: 'currency', group: group, label: 'Währung' + }) + } tabs.tabs.push({ id: 'settings', group: group, label: 'Einstellungen' diff --git a/src/packs/_source/waehrungen/ducat.json b/src/packs/_source/waehrungen/ducat.json new file mode 100644 index 00000000..e5bac303 --- /dev/null +++ b/src/packs/_source/waehrungen/ducat.json @@ -0,0 +1,12 @@ +{ + "name": "Dukate", + "image": "icons/commodities/currency/coin-embossed-cobra-gold.webp", + "category": [ + "Gegenstand", + "Währung" + ], + "weight": 0, + "price": 10, + "currencyDenominator": 10, + "currencyName": "Mittelreich" +} \ No newline at end of file diff --git a/src/packs/_source/waehrungen/heller.json b/src/packs/_source/waehrungen/heller.json new file mode 100644 index 00000000..2ee16950 --- /dev/null +++ b/src/packs/_source/waehrungen/heller.json @@ -0,0 +1,12 @@ +{ + "name": "Heller", + "image": "icons/commodities/currency/coin-inset-copper-axe.webp", + "category": [ + "Gegenstand", + "Währung" + ], + "weight": 0, + "price": 0.01, + "currencyDenominator": 0.01, + "currencyName": "Mittelreich" +} \ No newline at end of file diff --git a/src/packs/_source/waehrungen/kreutzer.json b/src/packs/_source/waehrungen/kreutzer.json new file mode 100644 index 00000000..dedd1c52 --- /dev/null +++ b/src/packs/_source/waehrungen/kreutzer.json @@ -0,0 +1,12 @@ +{ + "name": "Kreuzer", + "image": "icons/commodities/currency/coin-inset-compass-silver.webp", + "category": [ + "Gegenstand", + "Währung" + ], + "weight": 0, + "price": 0.1, + "currencyDenominator": 0.1, + "currencyName": "Mittelreich" +} \ No newline at end of file diff --git a/src/packs/_source/waehrungen/silver.json b/src/packs/_source/waehrungen/silver.json new file mode 100644 index 00000000..0fb07a45 --- /dev/null +++ b/src/packs/_source/waehrungen/silver.json @@ -0,0 +1,12 @@ +{ + "name": "Silbertaler", + "image": "icons/commodities/currency/coins-engraved-face-silver.webp", + "category": [ + "Gegenstand", + "Währung" + ], + "weight": 0, + "price": 1, + "currencyDenominator": 1, + "currencyName": "Mittelreich" +} \ No newline at end of file diff --git a/src/style/molecules/_equipment.scss b/src/style/molecules/_equipment.scss index 13a6c94d..58866df8 100644 --- a/src/style/molecules/_equipment.scss +++ b/src/style/molecules/_equipment.scss @@ -48,7 +48,7 @@ border: 1px solid #ccc; box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5); margin: -4px 4px 4px -4px; - padding: 0 0 0 0; + padding: 0 4px 4px 0; z-index: 2; } } \ No newline at end of file diff --git a/src/system.json b/src/system.json index 58e41840..16e3de17 100644 --- a/src/system.json +++ b/src/system.json @@ -63,6 +63,14 @@ "path": "packs/vorteile", "private": false }, + { + "name": "Currency", + "label": "Währung", + "system": "DSA_4-1", + "type": "Item", + "path": "packs/waehrungen", + "private": false + }, { "name": "Weapons", "label": "Waffen", diff --git a/src/templates/actor/character/tab-equipment.hbs b/src/templates/actor/character/tab-equipment.hbs index 8b6a83e4..5085dbae 100644 --- a/src/templates/actor/character/tab-equipment.hbs +++ b/src/templates/actor/character/tab-equipment.hbs @@ -11,7 +11,7 @@