diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs
index f1c144d..70f254e 100644
--- a/src/ActorSheet.hbs
+++ b/src/ActorSheet.hbs
@@ -357,6 +357,7 @@
{{localize "DSA41.inventar.bewaffnung"}}
+
{{localize "DSA41.weight.label"}}
@@ -380,6 +381,7 @@
+
{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}
@@ -392,7 +394,9 @@
{{localize "DSA41.inventar.ruestungen"}}
+
{{localize "DSA41.weight.label"}}
+
{{#unless (ne actor.itemTypes.Ruestung.length 0)}}
@@ -406,6 +410,7 @@
{{this.name}}
+
{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}
@@ -417,8 +422,10 @@
{{#unless (ne actor.itemTypes.Gegenstand.length 0)}}
@@ -432,8 +439,9 @@
{{this.name}}
+ {{>editable-input type="number" size=(string-length system.anzahl) data-name="system.anzahl" value=system.anzahl}}
- {{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}
+ {{mul this.system.gewicht.value this.system.anzahl}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}
{{/each}}
diff --git a/src/EditableInput.hbs b/src/EditableInput.hbs
index b893feb..84786fe 100644
--- a/src/EditableInput.hbs
+++ b/src/EditableInput.hbs
@@ -2,7 +2,7 @@
{{#if (eq type "checkbox")}}
{{else}}
-
+
{{/if}}
{{#if placeholder}}
diff --git a/src/lang/de.json b/src/lang/de.json
index ca8ae11..d23b519 100644
--- a/src/lang/de.json
+++ b/src/lang/de.json
@@ -479,7 +479,8 @@
"inventar": {
"bewaffnung": "Bewaffnung",
"ruestungen": "Rüstungen",
- "gegenstaende": "Gegenstände"
+ "gegenstaende": "Gegenstände",
+ "anzahl": "Anzahl"
},
"kampf": {
diff --git a/src/main.css b/src/main.css
index c2717bf..87c410f 100644
--- a/src/main.css
+++ b/src/main.css
@@ -588,7 +588,7 @@ html {
}
&[data-tab="inventar"] {
- grid-template-columns: minmax(min-content, max-content) auto min-content minmax(min-content, max-content) min-content;
+ grid-template-columns: minmax(min-content, max-content) auto max-content min-content minmax(min-content, max-content) min-content;
& > * {
grid-column: 1 / -1;
@@ -597,6 +597,11 @@ html {
& [data-equipped="false"] {
color: #464c5f;
}
+
+ & .anzahl input {
+ background: transparent;
+ field-sizing: content;
+ }
}
&[data-tab="kampf"] {
diff --git a/src/main.mjs b/src/main.mjs
index 2a358ab..8acf5e3 100644
--- a/src/main.mjs
+++ b/src/main.mjs
@@ -80,6 +80,18 @@ Hooks.once("init", async function() {
]
});
+ Handlebars.registerHelper({
+ "string-length": (value, options) => {
+ return value.toString().length;
+ }
+ });
+
+ Handlebars.registerHelper({
+ "mul": (a, b, options) => {
+ return a * b;
+ }
+ });
+
Handlebars.registerHelper({
maybeLocalize: (value, options) => {
const prefix = options.hash.prefix ? options.hash.prefix.string : null;
@@ -927,6 +939,7 @@ class DSA41_GegenstandData extends TypeDataModel {
return {
gewicht: new GewichtField(),
preis: new PreisField(),
+ anzahl: new NumberField({ integer: true, initial: 1, min: 0 }),
beschreibung: new StringField({ initial: "" }),
};