add GewichtField and use it for Gegenstand
This commit is contained in:
parent
0639ce11d7
commit
67bd01f56d
@ -312,7 +312,7 @@
|
|||||||
<div>{{localize "DSA41.inventar.bewaffnung"}}</div>
|
<div>{{localize "DSA41.inventar.bewaffnung"}}</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="center">{{localize "DSA41.weight"}}</div>
|
<div class="center">{{localize "DSA41.weight.label"}}</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -347,7 +347,7 @@
|
|||||||
<div class="row">{{localize "DSA41.inventar.ruestungen"}}</div>
|
<div class="row">{{localize "DSA41.inventar.ruestungen"}}</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="center">{{localize "DSA41.weight"}}</div>
|
<div class="center">{{localize "DSA41.weight.label"}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#unless (ne actor.itemTypes.Ruestung.length 0)}}
|
{{#unless (ne actor.itemTypes.Ruestung.length 0)}}
|
||||||
@ -373,7 +373,7 @@
|
|||||||
<div>{{localize "DSA41.inventar.gegenstaende"}}</div>
|
<div>{{localize "DSA41.inventar.gegenstaende"}}</div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="center">{{localize "DSA41.weight"}}</div>
|
<div class="center">{{localize "DSA41.weight.label"}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#unless (ne actor.itemTypes.Gegenstand.length 0)}}
|
{{#unless (ne actor.itemTypes.Gegenstand.length 0)}}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
{{DSA41_input "name" subtitle="DSA41.name"}}
|
{{DSA41_input "name" subtitle="DSA41.name"}}
|
||||||
<div class="grid2 gap">
|
<div class="grid2 gap">
|
||||||
{{DSA41_input "system.gewicht" subtitle="DSA41.weight"}}
|
{{DSA41_input "system.gewicht" subtitle="DSA41.weight.label"}}
|
||||||
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
{{DSA41_input "name" subtitle="DSA41.name"}}
|
{{DSA41_input "name" subtitle="DSA41.name"}}
|
||||||
<div class="grid2 gap">
|
<div class="grid2 gap">
|
||||||
{{DSA41_input "system.gewicht" subtitle="DSA41.weight"}}
|
{{DSA41_input "system.gewicht" subtitle="DSA41.weight.label"}}
|
||||||
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
{{DSA41_input "name" subtitle="DSA41.name"}}
|
{{DSA41_input "name" subtitle="DSA41.name"}}
|
||||||
<div class="grid2 gap">
|
<div class="grid2 gap">
|
||||||
{{DSA41_input "system.gewicht" subtitle="DSA41.weight"}}
|
{{DSA41_input "system.gewicht" subtitle="DSA41.weight.label"}}
|
||||||
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
{{DSA41_input "system.preis" subtitle="DSA41.price"}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
"culture": "Kultur",
|
"culture": "Kultur",
|
||||||
"profession": "Profession",
|
"profession": "Profession",
|
||||||
"sozialstatus": "Sozialstatus",
|
"sozialstatus": "Sozialstatus",
|
||||||
"weight": "Gewicht",
|
|
||||||
"price": "Preis",
|
"price": "Preis",
|
||||||
"abenteuerpunkte": "Abenteuerpunkte",
|
"abenteuerpunkte": "Abenteuerpunkte",
|
||||||
|
|
||||||
@ -34,6 +33,18 @@
|
|||||||
"kreuzer": "Kreuzer"
|
"kreuzer": "Kreuzer"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"weight": {
|
||||||
|
"label": "Gewicht",
|
||||||
|
|
||||||
|
"gran": "Gran",
|
||||||
|
"karat": "Karat",
|
||||||
|
"skrupel": "Skrupel",
|
||||||
|
"unze": "Unze",
|
||||||
|
"stein": "Stein",
|
||||||
|
"sack": "Sack",
|
||||||
|
"quader": "Quader"
|
||||||
|
},
|
||||||
|
|
||||||
"steigerungskategorie": {
|
"steigerungskategorie": {
|
||||||
"A_Star": "A*",
|
"A_Star": "A*",
|
||||||
"A": "A",
|
"A": "A",
|
||||||
|
|||||||
@ -132,6 +132,15 @@ html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .weight-input {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(min-content, 1fr) max-content;
|
||||||
|
|
||||||
|
& input {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
& .placeholder {
|
& .placeholder {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
border-top: 1px solid;
|
border-top: 1px solid;
|
||||||
|
|||||||
41
src/main.mjs
41
src/main.mjs
@ -313,6 +313,45 @@ class PreisField extends SchemaField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GewichtUnitField extends StringField {
|
||||||
|
constructor(options={}, context={}) {
|
||||||
|
return super({
|
||||||
|
required: true,
|
||||||
|
choices: {
|
||||||
|
"gran": "DSA41.weight.gran",
|
||||||
|
"karat": "DSA41.weight.karat",
|
||||||
|
"skrupel": "DSA41.weight.skrupel",
|
||||||
|
"unze": "DSA41.weight.unze",
|
||||||
|
"stein": "DSA41.weight.stein",
|
||||||
|
"sack": "DSA41.weight.sack",
|
||||||
|
"quader": "DSA41.weight.quader",
|
||||||
|
},
|
||||||
|
initial: "stein",
|
||||||
|
...options
|
||||||
|
}, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GewichtField extends SchemaField {
|
||||||
|
constructor() {
|
||||||
|
return super({
|
||||||
|
value: new NumberField({ initial: 0, min: 0 }),
|
||||||
|
unit: new GewichtUnitField(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_toInput(config) {
|
||||||
|
const value_input = this.fields["value"].toInput({ value: config.value.value, });
|
||||||
|
const unit_input = this.fields["unit"] .toInput({ value: config.value.unit, localize: true });
|
||||||
|
|
||||||
|
let outer_div = document.createElement("div");
|
||||||
|
outer_div.className = "weight-input";
|
||||||
|
outer_div.replaceChildren(value_input, unit_input);
|
||||||
|
|
||||||
|
return outer_div;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class AttributeField extends SchemaField {
|
class AttributeField extends SchemaField {
|
||||||
constructor() {
|
constructor() {
|
||||||
return super({
|
return super({
|
||||||
@ -720,7 +759,7 @@ class DSA41_CharacterData extends TypeDataModel {
|
|||||||
class DSA41_GegenstandData extends TypeDataModel {
|
class DSA41_GegenstandData extends TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
gewicht: new NumberField({ integer: false, initial: 0, min: 0 }),
|
gewicht: new GewichtField(),
|
||||||
preis: new PreisField(),
|
preis: new PreisField(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user