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
+211 -34

No files matched your search

+5 -1
View File
@@ -1,7 +1,7 @@
{ {
"Midgard6": { "Midgard6": {
"Biography": {
"name": "Name", "name": "Name",
"Biography": {
"spezies": "Spezies", "spezies": "Spezies",
"kultur": "Kultur", "kultur": "Kultur",
"abenteuertyp": "Abenteuertyp", "abenteuertyp": "Abenteuertyp",
@@ -14,6 +14,10 @@
"speichern": "Speichern", "speichern": "Speichern",
"löschen": "Löschen" "löschen": "Löschen"
}, },
"Gegenstand": {
"wert": "Wert",
"gewicht": "Gewicht"
},
"Skills": { "Skills": {
"gruppen": { "gruppen": {
"kampf": "Kampf", "kampf": "Kampf",
+17 -2
View File
@@ -1,13 +1,28 @@
function defineSchema() { function defineSchema() {
const fields = foundry.data.fields; const fields = foundry.data.fields;
return { return {
description: new fields.HTMLField({ initial: "" }), beschreibung: new fields.HTMLField({ initial: "" }),
quantity: new fields.NumberField({ anzahl: new fields.NumberField({
required: true, required: true,
nullable: false, nullable: false,
integer: true, integer: true,
initial: 1, initial: 1,
min: 0 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 = { static DEFAULT_OPTIONS = {
classes: ["M6", "actor"], classes: ["M6", "actor"],
window: { window: {
icon: "fa-solid fa-dice-d10",
resizable: true resizable: true
}, },
position: { position: {
@@ -130,6 +129,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
break; break;
case "items": case "items":
context.itemTypes = this._getItems(); context.itemTypes = this._getItems();
context.gewicht = this._clacWeight();
context.tab = context.tabs[partId]; context.tab = context.tabs[partId];
break; break;
} }
@@ -284,6 +284,20 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
return types; 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(); await roll.evaluate();
roll.toMessage(); roll.toMessage();
roll.toAnchor();
} }
async rollDialog(rollDialogRequest) { async rollDialog(rollDialogRequest) {
@@ -5,19 +5,22 @@ export async function addSpezialisierung(event, target) {
const dataset = target.dataset; const dataset = target.dataset;
const path = dataset.path.replace(".value", ""); const path = dataset.path.replace(".value", "");
const name = dataset.name; const name = dataset.name;
const skill = foundry.utils.getProperty(this.actor, path);
let level = 1; let level = 1;
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs"); const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
const templateData = { const templateData = {
classes: ["M6", "dialog"], classes: ["M6", "dialog"],
level 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); const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
return foundry.applications.api.DialogV2.wait({ return foundry.applications.api.DialogV2.wait({
window: { 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: { position: {
width: 600 width: 600
@@ -26,9 +29,8 @@ export async function addSpezialisierung(event, target) {
actions: {}, actions: {},
render: (_event, dialog) => { render: (_event, dialog) => {
const dialogHTML = dialog.element; const dialogHTML = dialog.element;
const display = dialogHTML.querySelector("#rollDisplay");
// Variable bei jeder Änderung aktualisieren // 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) => { radio.addEventListener("change", (e) => {
level = parseInt(e.target.value); level = parseInt(e.target.value);
}); });
@@ -61,16 +63,17 @@ export async function editSepzialisierung(event, target) {
const dataset = target.dataset; const dataset = target.dataset;
const path = dataset.path; const path = dataset.path;
const name = dataset.name; const name = dataset.name;
const skill = foundry.utils.getProperty(this.actor, path);
let level = 1; let level = 1;
let spezName = dataset.name; let spezName = dataset.name;
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs"); const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
const templateData = { const templateData = {
classes: ["M6", "dialog"], classes: ["M6", "dialog"],
spezName, spezName,
level level
}; };
console.warn(path.replace(/^.*\.(?=[^.]+$)/g, ""));
const skill = foundry.utils.getProperty(this.actor, path);
// 2. Render the Handlebars template into an HTML string // 2. Render the Handlebars template into an HTML string
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData); const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
return foundry.applications.api.DialogV2.wait({ return foundry.applications.api.DialogV2.wait({
@@ -87,9 +90,8 @@ export async function editSepzialisierung(event, target) {
actions: {}, actions: {},
render: (_event, dialog) => { render: (_event, dialog) => {
const dialogHTML = dialog.element; const dialogHTML = dialog.element;
const display = dialogHTML.querySelector("#rollDisplay");
// Variable bei jeder Änderung aktualisieren dialogHTML.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
document.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
radio.addEventListener("change", (e) => { radio.addEventListener("change", (e) => {
level = parseInt(e.target.value); 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) { export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
/** @inheritdoc */ /** @inheritdoc */
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
window: {
resizable: true
},
position: { position: {
width: 600 width: 600,
height: 400
}, },
classes: ["M6", "item", "standard-form"], classes: ["M6", "item", "standard-form"],
actions: { actions: {
@@ -31,13 +35,15 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
primary: { primary: {
tabs: [ tabs: [
{ {
id: "properties" id: "description",
icon: "fa-feather-pointed"
}, },
{ {
id: "effects" id: "effects",
icon: "fa-bolt"
} }
], ],
initial: "properties", initial: "description",
labelPrefix: "M6.Sheets.Tabs" labelPrefix: "M6.Sheets.Tabs"
} }
}; };
@@ -50,11 +56,10 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
template: systemPath("templates/item/header.hbs") template: systemPath("templates/item/header.hbs")
}, },
tabs: { tabs: {
// Foundry-provided generic template template: systemPath("templates/actor/tabs.hbs")
template: "templates/generic/tab-navigation.hbs"
}, },
properties: { description: {
template: systemPath("templates/shared/properties.hbs"), template: systemPath("templates/item/description.hbs"),
scrollable: [""] scrollable: [""]
}, },
effects: { effects: {
@@ -104,8 +109,20 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
context.effects = prepareActiveEffectCategories(this.item.effects); context.effects = prepareActiveEffectCategories(this.item.effects);
context.tab = context.tabs[partId]; context.tab = context.tabs[partId];
break; break;
case "properties": case "description":
context.fields = await this._getFields(); 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]; context.tab = context.tabs[partId];
break; break;
} }
+1
View File
@@ -3,6 +3,7 @@
@import url("./tabs.scss"); @import url("./tabs.scss");
@import url("./resistenzen.scss"); @import url("./resistenzen.scss");
@import url("./dialog.scss"); @import url("./dialog.scss");
@import url("./items-page.scss");
:root { :root {
--M6-background-grey: #d3d7d7; --M6-background-grey: #d3d7d7;
+28 -1
View File
@@ -1,4 +1,5 @@
.sheet-header { .application.sheet.M6 {
.sheet-header {
margin-top: 8px; margin-top: 8px;
margin-right: 12px; margin-right: 12px;
.profile-img { .profile-img {
@@ -18,4 +19,30 @@
padding: 8px; padding: 8px;
background-color: var(--M6-background-grey); background-color: var(--M6-background-grey);
} }
}
&.item {
.custom-input {
&.left {
padding-left: 30px;
}
&.right {
padding-right: 30px;
}
}
.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 { section {
&.window-content { &.window-content {
backdrop-filter: blur(0rem); backdrop-filter: blur(0rem);
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-6"> <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.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}}" /> <input class="text" type="text" placeholder="{{localize "Midgard6.Biography.kultur"}}" name="system.biography.kultur" value="{{system.biography.kultur}}" />
</div> </div>
+9
View File
@@ -49,4 +49,13 @@
</ul> </ul>
{{/each}} {{/each}}
</ul> </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> </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>
+21 -5
View File
@@ -1,14 +1,30 @@
<header class="sheet-header flexrow"> <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 <img
class="profile-img" class="profile-img"
src="{{item.img}}" style="z-index:1"
alt="{{item.name}}" src="{{actor.img}}"
alt="{{actor.name}}"
{{#if editable}} {{#if editable}}
data-action="editImage" data-action="editImage"
data-edit="img" data-edit="img"
{{/if}} {{/if}}
data-tooltip="{{item.name}}" data-tooltip="{{actor.name}}"
height="100" width="100" height="100" width="100"
> >
{{formInput itemFields.name value=item.name}} </div>
</div>
</header> </header>