From 9da36e6a6f960f2350876817783a4f85be756d37 Mon Sep 17 00:00:00 2001 From: Ender Date: Sat, 20 Jan 2024 14:57:17 +0100 Subject: [PATCH 1/2] - Container behavior for Weapons, Def. Weapons and Armor is now the same as for items - Fixed some Bugs --- lang/de.json | 12 +- source/index.ts | 10 + source/module/M5Base.ts | 1 + source/module/actors/M5Character.ts | 3 + source/style/Character-sheet.less | 11 +- templates/sheets/character/combat.hbs | 57 ++-- templates/sheets/character/gear.hbs | 426 ++++++++++++++++---------- 7 files changed, 324 insertions(+), 196 deletions(-) diff --git a/lang/de.json b/lang/de.json index 6e39d06..622128d 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", @@ -239,8 +240,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", @@ -254,6 +255,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/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/M5Base.ts b/source/module/M5Base.ts index 72e3358..98d7325 100644 --- a/source/module/M5Base.ts +++ b/source/module/M5Base.ts @@ -157,6 +157,7 @@ export interface M5AttributeCalculated extends M5ModResult { export interface M5CharacterCalculatedData { level: number; + initiative: number; attributes: { st: M5AttributeCalculated; gs: M5AttributeCalculated; diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 0ce24d6..c363383 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -39,6 +39,7 @@ export class M5Character extends Actor { ): M5CharacterCalculatedData { let ret: M5CharacterCalculatedData = { level: 0, + initiative: 0, attributes: { st: { value: 0, bonus: 0, mods: [] }, gs: { value: 0, bonus: 0, mods: [] }, @@ -101,6 +102,8 @@ export class M5Character extends Actor { ret.level = M5Character.levelFromExp(data.info.race === "Zwerg" ? Math.min(data.calc.stats?.hoard * 2 || 0, data.es) : data.es); + ret.initiative = data.skills.general.anfuehren.fw; + ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st); // TODO item effects ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs); ret.attributes.gw.value = M5Character.attributeMinMax(data.attributes.gw); diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index 75a86bb..6cc4357 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -11,30 +11,31 @@ .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; } diff --git a/templates/sheets/character/combat.hbs b/templates/sheets/character/combat.hbs index e26b12a..857b6dc 100644 --- a/templates/sheets/character/combat.hbs +++ b/templates/sheets/character/combat.hbs @@ -1,5 +1,32 @@
-
+ +
+
+
{{localize "midgard5.calculated-values"}}
+ + + + + + + + + + + + + + + + + + + +
{{localize "midgard5.initiative"}} {{data.calc.initiative}}{{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 6f88e2a..9e80345 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -1,6 +1,7 @@ +

{{localize "midgard5.wealthAndContainers"}}

-
+
{{localize "midgard5.currency"}}
@@ -29,165 +30,9 @@
- -
-
- - {{localize "midgard5.gear"}} - (alle ) -
- - - - - - - - - - - - - - - {{#each data.calc.gear.items as |item itemId|}} - {{#if (or ../data.info.showAllItems (eq item.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}}
-
- -
-
{{localize "midgard5.weapons"}}
- - - - - - - - - - - - {{#each data.calc.gear.weapons as |item itemId|}} - - - - - - - {{/each}} - -
{{localize "TYPES.Item.weapon"}}{{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}} -
-
- -
-
{{localize "midgard5.defensive-weapons"}}
- - - - - - - - - - - {{#each data.calc.gear.defensiveWeapons as |item itemId|}} - - - - - - - {{/each}} - -
{{localize "TYPES.Item.defensiveWeapon"}}{{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}} -
-
- -
-
{{localize "midgard5.armor"}}
- - - - - - - - - - - {{#each data.calc.gear.armor as |item itemId|}} - - - - - - - {{/each}} - -
{{localize "TYPES.Item.armor"}}{{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}} -
-
-
{{localize "TYPES.Item.container"}}
@@ -197,7 +42,7 @@ - + @@ -226,8 +71,13 @@
{{localize "midgard5.item-value"}}  
+
+
- {{#each data.calc.gear.containers as |container containerId|}} +

{{localize "midgard5.itemsInContainers"}}

+
+ {{#each data.calc.gear.containers as |container containerId|}} +
{{container.label}}
@@ -271,9 +121,265 @@ {{/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}}
+ {{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}}
+ {{/each}} +
+ +

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

+
+ {{#unless (eq (count data.calc.gear.items) 0)}} +
+
+
{{localize "midgard5.gear"}}
+ + + + + + + + + + + + + + + {{#each data.calc.gear.items as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.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}}
+
+
+ {{/unless}} + + {{#unless (eq (count data.calc.gear.weapons) 0)}} +
+
+
+ {{localize "midgard5.weapons"}}
+ + + + + + + + + + + + {{#each data.calc.gear.weapons as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + + + + + + + {{/if}} + {{/each}} + +
{{localize "TYPES.Item.weapon"}}{{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}} +
+
+
+ {{/unless}} + + {{#unless (eq (count data.calc.gear.defensiveWeapons) 0)}} +
+
+
{{localize "midgard5.defensive-weapons"}}
+ + + + + + + + + + + {{#each data.calc.gear.defensiveWeapons as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + + + + + + + {{/if}} + {{/each}} + +
{{localize "TYPES.Item.defensiveWeapon"}}{{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}} +
+
+
+ {{/unless}} + + {{#unless (eq (count data.calc.gear.armor) 0)}} +
+
+
{{localize "midgard5.armor"}}
+ + + + + + + + + + + {{#each data.calc.gear.armor as |item itemId|}} + {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + + + + + + + {{/if}} + {{/each}} + +
{{localize "TYPES.Item.armor"}}{{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}} +
+
+
+ {{/unless}} + + +
\ No newline at end of file -- 2.40.1 From d8df3d9611bca39471da775e58ac7229f9174a85 Mon Sep 17 00:00:00 2001 From: Ender Date: Thu, 25 Jan 2024 20:55:04 +0100 Subject: [PATCH 2/2] - Removed initiative - Reimplemented container Adding - Adjusted some colors and margins for better looking - Added LP and AP Max input fields to Werte und Boni - Made LP and AP Max a label in the health bar instead --- source/module/M5Base.ts | 1 - source/module/actors/M5Character.ts | 3 --- source/style/Character-sheet.less | 16 ++++++++++++---- templates/sheets/character/base_values.hbs | 6 ++++++ templates/sheets/character/combat.hbs | 4 ++-- templates/sheets/character/gear.hbs | 2 +- templates/sheets/character/main.hbs | 4 ++-- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/source/module/M5Base.ts b/source/module/M5Base.ts index 98d7325..72e3358 100644 --- a/source/module/M5Base.ts +++ b/source/module/M5Base.ts @@ -157,7 +157,6 @@ export interface M5AttributeCalculated extends M5ModResult { export interface M5CharacterCalculatedData { level: number; - initiative: number; attributes: { st: M5AttributeCalculated; gs: M5AttributeCalculated; diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index c363383..0ce24d6 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -39,7 +39,6 @@ export class M5Character extends Actor { ): M5CharacterCalculatedData { let ret: M5CharacterCalculatedData = { level: 0, - initiative: 0, attributes: { st: { value: 0, bonus: 0, mods: [] }, gs: { value: 0, bonus: 0, mods: [] }, @@ -102,8 +101,6 @@ export class M5Character extends Actor { ret.level = M5Character.levelFromExp(data.info.race === "Zwerg" ? Math.min(data.calc.stats?.hoard * 2 || 0, data.es) : data.es); - ret.initiative = data.skills.general.anfuehren.fw; - ret.attributes.st.value = M5Character.attributeMinMax(data.attributes.st); // TODO item effects ret.attributes.gs.value = M5Character.attributeMinMax(data.attributes.gs); ret.attributes.gw.value = M5Character.attributeMinMax(data.attributes.gw); diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index 6cc4357..a0047fd 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -42,8 +42,10 @@ .flexpart { gap: 0; padding: 0; - margin: 5px; + margin: 2px; background-color: beige; + border-collapse: separate; + border-radius: 10px; border: 2px solid black; } @@ -66,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 { @@ -247,7 +254,8 @@ padding: 1px; //align-items: stretch; - input { + input, + .max-value { flex: 0 0 2rem; text-align: center; height: 100%; 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 857b6dc..800610a 100644 --- a/templates/sheets/character/combat.hbs +++ b/templates/sheets/character/combat.hbs @@ -6,10 +6,10 @@ - - + + diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index 9e80345..451fa02 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -42,7 +42,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}}
-- 2.40.1
{{localize "midgard5.initiative"}} {{data.calc.initiative}} {{localize "midgard5.movementRange"}} {{data.calc.stats.movement.value}}
{{localize "midgard5.defense"}} {{data.calc.stats.defense.value}}{{localize "midgard5.item-value"}}