diff --git a/lang/de.json b/lang/de.json index 56d02d2..622b0b7 100644 --- a/lang/de.json +++ b/lang/de.json @@ -17,6 +17,7 @@ "midgard5.phase-movement": "Bewegungsphase", "midgard5.no-encounter": "Kein Kampf", "midgard5.encounter-not-started": "Kein aktiver Kampf", + "midgard5.initiative": "Initiative", "midgard5.time-duration": "Dauer", "midgard5.time-round": "Runde(n)", @@ -36,7 +37,7 @@ "midgard5.attributes": "Eigenschaften", "midgard5.points": "Punkte", "midgard5.calculated-value": "Berechneter Wert", - "midgard5.calculated-values": "Sonstige Werte", + "midgard5.calculated-values": "Werte und Boni", "midgard5.skill": "Fertigkeit", "midgard5.skill-value": "Fertigkeitswert", @@ -247,8 +248,8 @@ "midgard5.weapon-skills": "Waffenfertigkeiten", "midgard5.unlearned-skill": "Ungelernte Fertigkeit", "midgard5.unlearned-skills": "Ungelernte Fertigkeiten", - "midgard5.innate-ability": "Angeborene/Besondere Fertigkeit", - "midgard5.innate-abilities": "Angeborene/Besondere Fertigkeit", + "midgard5.innate-ability": "Angeborene/Besondere Fähigkeit", + "midgard5.innate-abilities": "Angeborene und besondere Fähigkeiten", "midgard5.base-damage": "Grundschaden", "midgard5.weapon": "Waffe", @@ -262,6 +263,11 @@ "midgard5.active": "Aktiv", "midgard5.rangedWeapon": "Schusswaffe", "midgard5.assignItemToCharacter": "Füge Gegenstand einem Charakter hinzu, um hier etwas auswählen zu können", + "midgard5.showAll": "Alle anzeigen", + "midgard5.wealthAndContainers": "Vermögen und Aufbewahrung", + "midgard5.itemsInContainers": "Gegenstände in Aufbewahrung", + "midgard5.allItems": "Alle Gegenstände", + "midgard5.pw": "Prüfwurf", "midgard5.attack": "Angriff", diff --git a/package.json b/package.json index efe783e..3b476df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundry-system-midgard5", - "version": "2.4.0", + "version": "2.4.2", "description": "", "main": "index.js", "scripts": { diff --git a/source/index.ts b/source/index.ts index 42b83d9..f00d480 100644 --- a/source/index.ts +++ b/source/index.ts @@ -90,6 +90,16 @@ Hooks.once("init", async () => { return label.toLowerCase().includes(contains.toLowerCase()); }); + Handlebars.registerHelper("count", (object: any) => { + var length = 0; + for( var key in object ) { + if( object.hasOwnProperty(key) ) { + ++length; + } + } + return length; + }); + // Default Sheet für Items definieren und das Standardsheet deaktivieren Items.unregisterSheet("core", ItemSheet); Items.registerSheet("midgard5", M5ItemSheet, { makeDefault: true }); diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 61d05fe..e7283af 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -240,6 +240,51 @@ export class M5Character extends Actor { ret.skillMods = aggregate.calculate(); } + if (!skip?.items) { + context.items + ?.filter((item) => item.type === "item") + .forEach((item) => { + item.prepareDerivedData(); + + let label = item.name; + if (item.system.magic) { + label += "*"; + } + if (item.system.valuable) { + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); + } + if (item.system.hoarded) { + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); + } + + let icon = item.img; + let rollable = false; + + for (let key in item.system.rolls.formulas) { + rollable = item.system.rolls.formulas[key]?.enabled; + if (rollable) { + break; + } + } + + ret.gear.items[item.id] = { + label: label, + icon: icon, + magic: item.system.magic, + calc: item.system.calc, + equipped: item.system?.equipped, + valuable: item.system?.valuable, + hoarded: item.system?.hoarded, + weight: item.system.weight || 0, + containerId: item.system.containerId || "", + value: item.system.value || 0, + currency: item.system.currency || "", + quantity: item.system.quantity || 0, + rollExist: rollable, + }; + }); + } + if (!skip?.containers) { context.items ?.filter((item) => item.type === "container") @@ -348,10 +393,10 @@ export class M5Character extends Actor { ")"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (!!item.system.containerId) { ret.gear.containers[item.system.containerId].weight += item.system.weight; @@ -369,6 +414,7 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", calc: item.system.calc, special: item.system.special, damageBase: item.system.damageBase, @@ -387,20 +433,12 @@ export class M5Character extends Actor { label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } - if (!!item.system.containerId) { - ret.gear.containers[item.system.containerId].weight += item.system.weight; - if (ret.gear.containers[item.system.containerId].equipped) { - ret.stats.encumbrance += item.system.weight; - } - } else if (item.system.equipped) { - ret.stats.encumbrance += item.system.weight || 0; - } - + ret.gear.defensiveWeapons[item.id] = { label: label, skillId: item.system.skillId, @@ -408,6 +446,7 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", defenseBonus: item.system.stats.defenseBonus, calc: item.system.calc, equipped: item.system?.equipped, @@ -425,10 +464,10 @@ export class M5Character extends Actor { label += "*"; } if (item.system.valuable) { - ret.stats.wealth += this.calculateValue(item.system.value, item.system.currency); + ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (item.system.hoarded) { - ret.stats.hoard += item.system.value || 0; + ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency); } if (!!item.system.containerId) { ret.gear.containers[item.system.containerId].weight += item.system.weight; @@ -447,6 +486,7 @@ export class M5Character extends Actor { valuable: item.system?.valuable, hoarded: item.system?.hoarded, value: item.system.value || 0, + currency: item.system.currency || "", lpProtection: item.system.lpProtection, calc: item.system.calc, equipped: item.system?.equipped, diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index 75a86bb..a0047fd 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -11,38 +11,41 @@ .flexcolumn { flex-wrap: wrap; + flex-direction: column; } .flexcolumn-1 { - flex: 100%; + flex-basis: 100%; flex-wrap: wrap; } .flexcolumn-2 { - flex: 50%; + flex-basis: 50%; flex-wrap: wrap; } .flexcolumn-3 { - flex: 33%; + flex-basis: 33%; flex-wrap: wrap; } .flexcolumn-4 { - flex: 25%; + flex-basis: 25%; flex-wrap: wrap; } .flexcolumn-5 { - flex: 20%; + flex-basis: 20%; flex-wrap: wrap; } .flexpart { gap: 0; padding: 0; - margin: 5px; + margin: 2px; background-color: beige; + border-collapse: separate; + border-radius: 10px; border: 2px solid black; } @@ -65,10 +68,15 @@ h3 { padding: 0.5rem 0.5rem 0.5rem 0.5rem; + margin-top: 0.5rem; + margin-bottom: 0; text-align: left; font-weight: bold; - background-color: dimgray; - color: white; + background-color: #eeede0; + color: black; + border-collapse: separate; + border: 2px solid black; + border-radius: 10px; } .profile-img { @@ -246,7 +254,8 @@ padding: 1px; //align-items: stretch; - input { + input, + .max-value { flex: 0 0 2rem; text-align: center; height: 100%; diff --git a/source/system.json b/source/system.json index 829b8ca..adc1b88 100644 --- a/source/system.json +++ b/source/system.json @@ -3,7 +3,7 @@ "name": "midgard5", "title": "Midgard 5. Edition", "description": "The German RPG Midgard 5. Edition", - "version": "2.4.0", + "version": "2.4.2", "compatibility": { "minimum": "10", "verified": "11", @@ -158,8 +158,8 @@ "primaryTokenAttribute": "lp", "secondaryTokenAttribute": "ap", "url": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5", - "manifest": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.0/system.json", - "download": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.0/midgard5-v2.4.0.zip", + "manifest": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.2/system.json", + "download": "https://git.byroks.de/MidgardVTT-Entwicklung/foundry-vtt-system-midgard5/releases/download/v2.4.2/midgard5-v2.4.2.zip", "initiative": "@c.calc.attributes.gw.value", "license": "LICENSE.txt" } \ No newline at end of file diff --git a/templates/sheets/character/base_values.hbs b/templates/sheets/character/base_values.hbs index 6ac423c..9aa2fd6 100644 --- a/templates/sheets/character/base_values.hbs +++ b/templates/sheets/character/base_values.hbs @@ -67,6 +67,12 @@ {{localize "midgard5.movementRange"}} + + {{localize "midgard5.actor-lp-short"}} + + {{localize "midgard5.actor-ap-short"}} + + {{localize "midgard5.brawl"}} {{data.calc.stats.brawl.value}} diff --git a/templates/sheets/character/combat.hbs b/templates/sheets/character/combat.hbs index e26b12a..800610a 100644 --- a/templates/sheets/character/combat.hbs +++ b/templates/sheets/character/combat.hbs @@ -1,5 +1,32 @@
-
+ +
+
+
{{localize "midgard5.calculated-values"}}
+ + + + + + + + + + + + + + + + + + + +
{{localize "midgard5.movementRange"}}{{data.calc.stats.movement.value}}
{{localize "midgard5.defense"}}{{data.calc.stats.defense.value}}{{localize "midgard5.defenseBonus"}}{{data.calc.stats.defenseBonus.value}}
{{localize "midgard5.attackBonus"}}{{data.calc.stats.attackBonus.value}}{{localize "midgard5.damageBonus"}}{{data.calc.stats.damageBonus.value}}
+
+
+ +
{{localize "midgard5.attack"}}
@@ -78,33 +105,7 @@ -
-
-
{{localize "midgard5.calculated-values"}}
-
- - - - - - - - - - - - - - - - - - -
{{localize "midgard5.movementRange"}}{{data.calc.stats.movement.value}}  
{{localize "midgard5.defense"}}{{data.calc.stats.defense.value}}{{localize "midgard5.defenseBonus"}}{{data.calc.stats.defenseBonus.value}}
{{localize "midgard5.damageBonus"}}{{data.calc.stats.damageBonus.value}}{{localize "midgard5.attackBonus"}}{{data.calc.stats.attackBonus.value}}
-
-
- -
+
{{localize "midgard5.defense"}}
diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index 861a85d..2725388 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -1,6 +1,7 @@ +

{{localize "midgard5.wealthAndContainers"}}

-
+
{{localize "midgard5.currency"}}
@@ -29,13 +30,186 @@
+
+
-
- - {{localize "midgard5.gear"}} - (alle ) -
+
{{localize "TYPES.Item.container"}}
+ + + + + + + + + + + + + {{#each data.calc.gear.containers as |item itemId|}} + + + + + + + + {{/each}} + +
{{localize "TYPES.Item.container"}}{{localize "midgard5.item-value"}}
+ {{item.label}} + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + + {{#if item.equipped}} + + {{else}} + + {{/if}} + {{#if item.rollExist}}{{/if}}
+
+
+
+ +

{{localize "midgard5.itemsInContainers"}}

+
+ {{#each data.calc.gear.containers as |container containerId|}} +
+
+
{{container.label}}
+ + + + + + + + + + + + + + {{#each ../data.calc.gear.items as |item itemId|}} + {{#if (eq item.containerId containerId)}} + + + + + + + + + {{/if}} + {{/each}} + {{#each ../data.calc.gear.weapons as |item itemId|}} + {{#if (eq item.containerId containerId)}} + + + + + + + + + {{/if}} + {{/each}} + {{#each ../data.calc.gear.defensiveWeapons as |item itemId|}} + {{#if (eq item.containerId containerId)}} + + + + + + + + + {{/if}} + {{/each}} + {{#each ../data.calc.gear.armor as |item itemId|}} + {{#if (eq item.containerId containerId)}} + + + + + + + + + {{/if}} + {{/each}} + +
{{localize "TYPES.Item.item"}}{{localize "midgard5.item-quantity"}}{{localize "midgard5.item-value"}} 
+ {{item.label}} + + + {{item.quantity}} + + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + + {{#if item.equipped}} + + {{else}} + + {{/if}} + {{#if item.rollExist}}{{/if}}
+ {{item.label}} + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + + {{#if item.equipped}} + + {{else}} + + {{/if}} + {{#if item.rollExist}}{{/if}}
+ {{item.label}} + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + + {{#if item.equipped}} + + {{else}} + + {{/if}} + {{#if item.rollExist}}{{/if}}
+ {{item.label}} + + {{#unless (or (eq item.value 0) (eq item.currency ""))}} + {{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}} + {{/unless}} + + {{#if item.equipped}} + + {{else}} + + {{/if}} + {{#if item.rollExist}}{{/if}}
+
+
+ {{/each}} +
+ +

+ {{localize "midgard5.allItems"}} + + +

+
+ {{#unless (eq (count data.calc.gear.items) 0)}} +
+
+
{{localize "midgard5.gear"}}
@@ -82,14 +256,19 @@ - {{/if}} + {{/if}} {{/each}}
{{#if item.rollExist}}{{/if}}
+
+ {{/unless}} + {{#unless (eq (count data.calc.gear.weapons) 0)}} +
-
{{localize "midgard5.weapons"}}
+
+ {{localize "midgard5.weapons"}}
@@ -102,6 +281,7 @@ {{#each data.calc.gear.weapons as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + {{/if}} {{/each}}
{{item.label}} @@ -118,11 +298,16 @@
+
+ {{/unless}} + {{#unless (eq (count data.calc.gear.defensiveWeapons) 0)}} +
{{localize "midgard5.defensive-weapons"}}
@@ -136,6 +321,7 @@ {{#each data.calc.gear.defensiveWeapons as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + {{/if}} {{/each}}
{{item.label}} @@ -152,11 +338,16 @@
+
+ {{/unless}} + {{#unless (eq (count data.calc.gear.armor) 0)}} +
{{localize "midgard5.armor"}}
@@ -170,6 +361,7 @@ {{#each data.calc.gear.armor as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + {{/if}} {{/each}}
{{item.label}} @@ -186,6 +378,7 @@
diff --git a/templates/sheets/character/main.hbs b/templates/sheets/character/main.hbs index 7ca7632..1039fc3 100644 --- a/templates/sheets/character/main.hbs +++ b/templates/sheets/character/main.hbs @@ -89,7 +89,7 @@
{{/if}} {{/times}} - +
{{data.lp.max}}
@@ -105,7 +105,7 @@
{{/if}} {{/times}} - +
{{data.ap.max}}