Gegenstände

This commit is contained in:
Byroks committed 2026-10-19 11:13:42 +02:00
1 parent 4351e5bd1f
commit 14e70d422c
13 files changed
+234 -57

No files matched your search

+5 -1
View File
@@ -1,7 +1,7 @@
{
"Midgard6": {
"name": "Name",
"Biography": {
"name": "Name",
"spezies": "Spezies",
"kultur": "Kultur",
"abenteuertyp": "Abenteuertyp",
@@ -14,6 +14,10 @@
"speichern": "Speichern",
"löschen": "Löschen"
},
"Gegenstand": {
"wert": "Wert",
"gewicht": "Gewicht"
},
"Skills": {
"gruppen": {
"kampf": "Kampf",
+17 -2
View File
@@ -1,13 +1,28 @@
function defineSchema() {
const fields = foundry.data.fields;
return {
description: new fields.HTMLField({ initial: "" }),
quantity: new fields.NumberField({
beschreibung: new fields.HTMLField({ initial: "" }),
anzahl: new fields.NumberField({
required: true,
nullable: false,
integer: true,
initial: 1,
min: 0
}),
wert: new fields.NumberField({
required: true,
nullable: false,
integer: true,
initial: 1,
min: 0
}),
gewicht: new fields.NumberField({
required: true,
nullable: false,
integer: true,
initial: 1,
step: 1,
min: 0
})
};
}
+15 -3
View File
@@ -12,7 +12,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
static DEFAULT_OPTIONS = {
classes: ["M6", "actor"],
window: {
icon: "fa-solid fa-dice-d10",
resizable: true
},
position: {
@@ -130,6 +129,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
break;
case "items":
context.itemTypes = this._getItems();
context.gewicht = this._clacWeight();
context.tab = context.tabs[partId];
break;
}
@@ -284,6 +284,20 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
return types;
}
_clacWeight() {
const items = this._getItems();
let gewicht = items.item.items.reduce(
(accumulator, item) => accumulator + item.system.gewicht,
0
);
let traglast = Math.max(this.actor.system.skills.körper.athletik.value, 10);
return {
traglast,
gewicht
};
}
/* -------------------------------------------------- */
/**
@@ -425,8 +439,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
await roll.evaluate();
roll.toMessage();
roll.toAnchor();
}
async rollDialog(rollDialogRequest) {
@@ -5,19 +5,22 @@ export async function addSpezialisierung(event, target) {
const dataset = target.dataset;
const path = dataset.path.replace(".value", "");
const name = dataset.name;
const skill = foundry.utils.getProperty(this.actor, path);
let level = 1;
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
const templateData = {
classes: ["M6", "dialog"],
level
};
const skill = foundry.utils.getProperty(this.actor, path);
console.warn(skill);
// 2. Render the Handlebars template into an HTML string
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
return foundry.applications.api.DialogV2.wait({
window: {
title: "Würfel Modifikatoren: " + game.i18n.localize(`Midgard6.Skills.${name}`)
title:
game.i18n.localize("Midgard6.Sheets.spezialisierung") +
" " +
game.i18n.localize(`Midgard6.Skills.${name}`)
},
position: {
width: 600
@@ -26,9 +29,8 @@ export async function addSpezialisierung(event, target) {
actions: {},
render: (_event, dialog) => {
const dialogHTML = dialog.element;
const display = dialogHTML.querySelector("#rollDisplay");
// Variable bei jeder Änderung aktualisieren
document.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
dialogHTML.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
radio.addEventListener("change", (e) => {
level = parseInt(e.target.value);
});
@@ -61,16 +63,17 @@ export async function editSepzialisierung(event, target) {
const dataset = target.dataset;
const path = dataset.path;
const name = dataset.name;
const skill = foundry.utils.getProperty(this.actor, path);
let level = 1;
let spezName = dataset.name;
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
const templateData = {
classes: ["M6", "dialog"],
spezName,
level
};
console.warn(path.replace(/^.*\.(?=[^.]+$)/g, ""));
const skill = foundry.utils.getProperty(this.actor, path);
// 2. Render the Handlebars template into an HTML string
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
return foundry.applications.api.DialogV2.wait({
@@ -87,9 +90,8 @@ export async function editSepzialisierung(event, target) {
actions: {},
render: (_event, dialog) => {
const dialogHTML = dialog.element;
const display = dialogHTML.querySelector("#rollDisplay");
// Variable bei jeder Änderung aktualisieren
document.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
dialogHTML.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
radio.addEventListener("change", (e) => {
level = parseInt(e.target.value);
});
+26 -9
View File
@@ -8,8 +8,12 @@ const { api, sheets } = foundry.applications;
export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
/** @inheritdoc */
static DEFAULT_OPTIONS = {
window: {
resizable: true
},
position: {
width: 600
width: 600,
height: 400
},
classes: ["M6", "item", "standard-form"],
actions: {
@@ -31,13 +35,15 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
primary: {
tabs: [
{
id: "properties"
id: "description",
icon: "fa-feather-pointed"
},
{
id: "effects"
id: "effects",
icon: "fa-bolt"
}
],
initial: "properties",
initial: "description",
labelPrefix: "M6.Sheets.Tabs"
}
};
@@ -50,11 +56,10 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
template: systemPath("templates/item/header.hbs")
},
tabs: {
// Foundry-provided generic template
template: "templates/generic/tab-navigation.hbs"
template: systemPath("templates/actor/tabs.hbs")
},
properties: {
template: systemPath("templates/shared/properties.hbs"),
description: {
template: systemPath("templates/item/description.hbs"),
scrollable: [""]
},
effects: {
@@ -104,8 +109,20 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
context.effects = prepareActiveEffectCategories(this.item.effects);
context.tab = context.tabs[partId];
break;
case "properties":
case "description":
context.fields = await this._getFields();
context.enrichedBeschreibung =
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.item.system.beschreibung,
{
// Whether to show secret blocks in the finished html
secrets: this.document.isOwner,
// Data to fill in for inline rolls
rollData: this.item.getRollData(),
// Relative UUID resolution
relativeTo: this.item
}
);
context.tab = context.tabs[partId];
break;
}
+1
View File
@@ -3,6 +3,7 @@
@import url("./tabs.scss");
@import url("./resistenzen.scss");
@import url("./dialog.scss");
@import url("./items-page.scss");
:root {
--M6-background-grey: #d3d7d7;
+43 -16
View File
@@ -1,21 +1,48 @@
.sheet-header {
margin-top: 8px;
margin-right: 12px;
.profile-img {
position: absolute;
top: 24px;
left: calc(50% - 50px - 6px);
background-color: var(--M6-background-white);
&:hover {
cursor: pointer;
.application.sheet.M6 {
.sheet-header {
margin-top: 8px;
margin-right: 12px;
.profile-img {
position: absolute;
top: 24px;
left: calc(50% - 50px - 6px);
background-color: var(--M6-background-white);
&:hover {
cursor: pointer;
}
}
.text {
margin-bottom: 4px;
}
.container {
padding: 8px;
background-color: var(--M6-background-grey);
}
}
.text {
margin-bottom: 4px;
}
&.item {
.custom-input {
&.left {
padding-left: 30px;
}
&.right {
padding-right: 30px;
}
}
.container {
padding: 8px;
background-color: var(--M6-background-grey);
.input-icon {
position: absolute;
top: 40%;
transform: translateY(-50%);
color: #888;
/* Prevent the icon from blocking input clicks if it's purely decorative */
pointer-events: none;
&.left {
left: 18px;
}
&.right {
right: 18px;
}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
.application.sheet.M6.actor {
.tab[data-tab="items"] {
ul {
padding-bottom: 20px;
margin: 0;
list-style: none;
padding-left: 5px;
}
.sticky-progress-container {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #f1f1f1;
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
padding: 10px 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999; /* Bleibt immer im Vordergrund */
}
/* Der graue Hintergrund des Balkens */
.progress-background {
width: 90%; /* Breite des Balkens auf dem Bildschirm */
max-width: 800px; /* Maximale Breite auf großen Bildschirmen */
background-color: #e0e0e0;
overflow: hidden; /* Schneidet den inneren Balken sauber ab */
transform: skewX(-30deg);
}
/* Der eigentliche, animierte Ladebalken */
.progress-bar {
height: 20px;
background-color: var(--M6-background-brown); /* Grün */
text-align: center;
line-height: 20px;
color: white;
font-size: 12px;
font-weight: bold;
width: 100%;
}
progress::-moz-progress-bar {
background: var(--M6-background-brown);
}
progress::-webkit-progress-value {
background: var(--M6-background-brown);
}
progress {
color: var(--M6-background-brown);
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
.application.sheet.M6.actor.character {
.application.sheet.M6 {
section {
&.window-content {
backdrop-filter: blur(0rem);
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="container">
<div class="row">
<div class="col-6">
<input class="text" type="text" placeholder="{{localize "Midgard6.Biography.name"}}" name="name" value="{{actor.name}}" />
<input class="text" type="text" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{actor.name}}" />
<input class="text" type="text" placeholder="{{localize "Midgard6.Biography.spezies"}}" name="system.biography.spezies" value="{{system.biography.spezies}}" />
<input class="text" type="text" placeholder="{{localize "Midgard6.Biography.kultur"}}" name="system.biography.kultur" value="{{system.biography.kultur}}" />
</div>
+9
View File
@@ -49,4 +49,13 @@
</ul>
{{/each}}
</ul>
<div class="sticky-progress-container">
<div class="progress-background">
<progress
class="progress-bar"
value="{{gewicht.gewicht}}"
max="{{gewicht.traglast}}"
>65%</progress>
</div>
</div>
</section>
+20
View File
@@ -0,0 +1,20 @@
{{! Beschreibung Allgemein Tab }}
<section class="tab {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
{{! Editors must receive enriched text data from getData to properly handle rolls, UUID links, etc. }}
<fieldset style="height:100%">
{{#if editable}}
<prose-mirror
style="height:100%"
name="system.beschreibung"
data-document-u-u-i-d="{{actor.uuid}}"
value="{{system.beschreibung}}"
collaborate="true"
toggled="true"
>
{{{enrichedBeschreibung}}}
</prose-mirror>
{{else}}
{{{enrichedBeschreibung}}}
{{/if}}
</fieldset>
</section>
+29 -13
View File
@@ -1,14 +1,30 @@
<header class="sheet-header flexrow">
<img
class="profile-img"
src="{{item.img}}"
alt="{{item.name}}"
{{#if editable}}
data-action="editImage"
data-edit="img"
{{/if}}
data-tooltip="{{item.name}}"
height="100" width="100"
>
{{formInput itemFields.name value=item.name}}
<header class="sheet-header" style="margin: 1px;">
<div class="container">
<div class="row align-items-end" style="height: 108px" >
<div class="col-12" style="height:36px"></div>
<div class="col-6">
<input class="custom-input left text" type="number" placeholder="{{localize "Midgard6.Gegenstand.wert"}}" name="system.wert" value="{{item.system.wert}}" />
<i class="fa-solid fa-sack-dollar input-icon left"></i>
</div>
<div class="col-6">
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.gewicht"}}" name="system.gewicht" value="{{item.system.gewicht}}" />
<i class="fa-solid fa-weight-hanging input-icon right"></i>
</div>
<div class="col-12">
<input class="text" type="text" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{item.name}}" />
</div>
<img
class="profile-img"
style="z-index:1"
src="{{actor.img}}"
alt="{{actor.name}}"
{{#if editable}}
data-action="editImage"
data-edit="img"
{{/if}}
data-tooltip="{{actor.name}}"
height="100" width="100"
>
</div>
</div>
</header>