add anzahl to Gegenstaende

This commit is contained in:
Sven Balzer 2025-11-09 12:44:37 +01:00
parent bf5a3fa06b
commit b6b0411473
5 changed files with 31 additions and 4 deletions

View File

@ -357,6 +357,7 @@
<div>{{localize "DSA41.inventar.bewaffnung"}}</div>
<div></div>
<div></div>
<div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div>
</div>
@ -380,6 +381,7 @@
</div>
</div>
<div></div>
<div></div>
<div class="center fas fa-sword" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div>
@ -392,7 +394,9 @@
<div class="row">{{localize "DSA41.inventar.ruestungen"}}</div>
<div></div>
<div></div>
<div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div>
</div>
{{#unless (ne actor.itemTypes.Ruestung.length 0)}}
@ -406,6 +410,7 @@
<span class="center">{{this.name}}</span>
</div>
<div></div>
<div></div>
<div class="center fas fa-shield-halved" data-action="toggle_equipped" data-equipped="{{system.angelegt}}"></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div>
@ -417,8 +422,10 @@
<div class="list-header">
<div>{{localize "DSA41.inventar.gegenstaende"}}</div>
<div></div>
<div class="center">{{localize "DSA41.inventar.anzahl"}}</div>
<div></div>
<div class="center">{{localize "DSA41.weight.label"}}</div>
<div></div>
</div>
{{#unless (ne actor.itemTypes.Gegenstand.length 0)}}
@ -432,8 +439,9 @@
<span class="center">{{this.name}}</span>
</div>
<div></div>
<div class="center anzahl">{{>editable-input type="number" size=(string-length system.anzahl) data-name="system.anzahl" value=system.anzahl}}</div>
<div></div>
<div class="center">{{this.system.gewicht.value}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center">{{mul this.system.gewicht.value this.system.anzahl}} {{localize (concat "DSA41.weight." this.system.gewicht.unit)}}</div>
<div class="center fas fa-trash" data-action="item-delete"></div>
</div>
{{/each}}

View File

@ -2,7 +2,7 @@
{{#if (eq type "checkbox")}}
<input type="checkbox" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{checked value}}>
{{else}}
<input type="{{type}}" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} value="{{value}}" placeholder="{{placeholder}}">
<input type="{{type}}" name="{{name}}" {{#if data-name}}data-name="{{data-name}}"{{/if}} {{#if size}}size="{{size}}"{{/if}} value="{{value}}" placeholder="{{placeholder}}">
{{/if}}
{{#if placeholder}}

View File

@ -479,7 +479,8 @@
"inventar": {
"bewaffnung": "Bewaffnung",
"ruestungen": "Rüstungen",
"gegenstaende": "Gegenstände"
"gegenstaende": "Gegenstände",
"anzahl": "Anzahl"
},
"kampf": {

View File

@ -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"] {

View File

@ -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: "" }),
};