diff --git a/.prettierrc b/.prettierrc index 765c6b5..de328cf 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,5 +3,12 @@ "singleQuote": false, "tabWidth": 2, "printWidth": 100, - "trailingComma": "none" + "overrides": [ + { + "files": "*.hbs", + "options": { + "parser": "glimmer" + } + } + ] } diff --git a/eslint.config.js b/eslint.config.js index b0a4da4..50f6979 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,20 +8,5 @@ export default tseslint.config( { ignores: ["dist/**", "node_modules/**"] }, js.configs.recommended, ...tseslint.configs.recommended, - { - files: ["src/**/*.{ts,tsx}"], - plugins: { react }, - languageOptions: { - globals: { ...globals.browser } - }, - rules: { - ...react.configs.recommended.rules, - "react/react-in-jsx-scope": "off", - "react/prop-types": "off" - }, - settings: { - react: { version: "18.3" } - } - }, prettier ); diff --git a/lang/de.json b/lang/de.json index 79ef643..129b070 100644 --- a/lang/de.json +++ b/lang/de.json @@ -7,6 +7,7 @@ "Fertigkeit": "Fertigkeit", "Stufe": "Stufe", "Schicksalsmünzen": "Schicksalsmünzen", + "Traglast": "Traglast", "Grad": { "grad": "Grad", "frei": "frei", @@ -98,6 +99,7 @@ "effects": "Effekte", "zauber": "Zauber", "biographie": "Biographie", + "beschreibung": "Beschreibung", "hintergrund": "Hintergrund", "sperre": "Sperre" }, @@ -170,7 +172,14 @@ "beschreibungChatActive": { "name": "Chat-Beschreibungen automatisch ausklappen", "hint": "Legt fest, ob Beschreibungen von Zaubern und Co. im Chat eingeklappt angezeigt werden oder vollständig." + }, + "maxSpezialisierung": { + "name": "Maximale Anzahl an Spezialisierungen pro Skill", + "hint": "Legt die Maximale Anzahl der möglichen Spezialisierungen für einen Skill fest die man besitzen kann." } + }, + "Warnings": { + "maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht" } }, "TYPES": { diff --git a/scripts/release.js b/scripts/release.js index 4f86c2a..73ca3f2 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -75,7 +75,8 @@ const filesToInclude = [ "system.json", "templates", "dist", // Kopiert den gesamten Inhalt deines echten Vite-Build-Ordners mit in die Zip! - "lang" + "lang", + "assets" ]; for (const file of filesToInclude) { diff --git a/src/helpers/settings.mjs b/src/helpers/settings.mjs index 09b7eca..97130c4 100644 --- a/src/helpers/settings.mjs +++ b/src/helpers/settings.mjs @@ -2,7 +2,7 @@ export const loadSettings = async function () { game.settings.register("midgard6-lvd", "zauberAlsTag", { name: game.i18n.localize("Midgard6.Settings.zauberAlsTag.name"), hint: game.i18n.localize("Midgard6.Settings.zauberAlsTag.hint"), - scope: "user", + scope: "client", config: true, default: false, type: Boolean, @@ -18,13 +18,13 @@ export const loadSettings = async function () { type: Boolean }); - game.settings.register("midgard6-lvd", "beschreibungChatActive", { - name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"), - hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"), - scope: "client", + game.settings.register("midgard6-lvd", "maxSpezialisierung", { + name: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.name"), + hint: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.hint"), + scope: "world", config: true, - default: false, - type: Boolean + default: 3, + type: Number }); game.settings.register("midgard6-lvd", "colorSuccessBg", { diff --git a/src/sheets/armor-sheet.mjs b/src/sheets/armor-sheet.mjs index e6ad70c..afac042 100644 --- a/src/sheets/armor-sheet.mjs +++ b/src/sheets/armor-sheet.mjs @@ -28,11 +28,11 @@ export class M6ArmorSheet extends M6ItemSheet { { id: "beschreibung", icon: "fa-feather-pointed" - }, - { - id: "effects", - icon: "fa-bolt" } + // { + // id: "effects", + // icon: "fa-bolt" + // } ], initial: "eigenschaften", labelPrefix: "Midgard6.Sheets.Tabs" @@ -54,11 +54,11 @@ export class M6ArmorSheet extends M6ItemSheet { beschreibung: { template: systemPath("templates/item/description.hbs"), scrollable: [""] - }, - effects: { - template: systemPath("templates/shared/effects.hbs"), - scrollable: [""] } + // effects: { + // template: systemPath("templates/shared/effects.hbs"), + // scrollable: [""] + // } }; static #cycleEquip() { diff --git a/src/sheets/character-sheet.mjs b/src/sheets/character-sheet.mjs index 77c456c..d08d9af 100644 --- a/src/sheets/character-sheet.mjs +++ b/src/sheets/character-sheet.mjs @@ -66,11 +66,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe { id: "biographie", icon: "fa-feather-pointed" - }, - { - id: "effects", - icon: "fa-bolt" } + // { + // id: "effects", + // icon: "fa-bolt" + // } ], initial: "eigenschaften", labelPrefix: "Midgard6.Sheets.Tabs" @@ -106,11 +106,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe biographie: { template: systemPath("templates/actor/biographie.hbs"), scrollable: [""] - }, - effects: { - template: systemPath("templates/shared/effects.hbs"), - scrollable: [""] } + // effects: { + // template: systemPath("templates/shared/effects.hbs"), + // scrollable: [""] + // } }; _attachPartListeners(partId, html, bubble) { @@ -123,11 +123,14 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe collapsible.forEach((node) => { node.addEventListener( "click", - function () { - node.classList.toggle("active"); - var content = node.nextElementSibling; - content.classList.toggle("active"); - node.getElementsByTagName("i")[0].classList.toggle("fa-compress"); + function (e) { + e = window.event || e; + if (this === e.target) { + node.classList.toggle("active"); + var content = node.nextElementSibling; + content.classList.toggle("active"); + node.getElementsByTagName("i")[0].classList.toggle("fa-compress"); + } }, { capture: true } ); @@ -163,7 +166,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe flags: this.actor.flags, config: CONFIG }); - console.warn(context); return context; } @@ -475,7 +477,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe if (["action", "documentClass"].includes(dataKey)) continue; foundry.utils.setProperty(docData, dataKey, value); } - docCls.create(docData, { parent: this.actor }); + const doc = await docCls.create(docData, { parent: this.actor }); + doc.sheet.render(true); } /* -------------------------------------------------- */ diff --git a/src/sheets/components/roll-actions.mjs b/src/sheets/components/roll-actions.mjs index 37993dd..0913106 100644 --- a/src/sheets/components/roll-actions.mjs +++ b/src/sheets/components/roll-actions.mjs @@ -302,32 +302,44 @@ async function rollDialog(rollDialogRequest) { const dialogHTML = dialog.element; const display = dialogHTML.querySelector("#rollDisplay"); - + let mainRoll = `1d20 + ${skillValue}`; + let spezText = ""; // Variable bei jeder Änderung aktualisieren document.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => { radio.addEventListener("change", (e) => { vorteil = parseInt(e.target.value); switch (vorteil) { case 1: - display.placeholder = `2d20kh + ${skillValue} (Vorteil)`; + mainRoll = `2d20kh + ${skillValue} (Vorteil)`; break; case -1: - display.placeholder = `2d20kl + ${skillValue} (Nachteil)`; + mainRoll = `2d20kl + ${skillValue} (Nachteil)`; break; default: - display.placeholder = `1d20 + ${skillValue}`; + mainRoll = `1d20 + ${skillValue}`; break; } + display.placeholder = mainRoll + spezText; }); }); document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => { - radio.addEventListener("change", (e) => { - spezLevel = parseInt(e.target.value); - spezName = e.target.dataset.name; + radio.addEventListener("click", (e) => { + if (spezName !== e.target.dataset.name) { + spezLevel = parseInt(e.target.value); + spezName = e.target.dataset.name; + spezText = ` + ${spezLevel + 1}`; + } else { + spezLevel = null; + spezName = null; + e.target.checked = false; + spezText = ""; + } + display.placeholder = mainRoll + spezText; }); if (radio.dataset.name === preSelectedSpez) { radio.click(); + display.placeholder = mainRoll + spezText; } }); }, diff --git a/src/sheets/components/spezialisierung-actions.mjs b/src/sheets/components/spezialisierung-actions.mjs index 694d7bf..bc4b1e7 100644 --- a/src/sheets/components/spezialisierung-actions.mjs +++ b/src/sheets/components/spezialisierung-actions.mjs @@ -6,7 +6,12 @@ export async function addSpezialisierung(event, target) { const path = dataset.path.replace(".value", ""); const name = dataset.name; const skill = foundry.utils.getProperty(this.actor, path); + const maxSpez = game.settings.get("midgard6-lvd", "maxSpezialisierung"); + if (skill.bonuses.length >= maxSpez) { + ui.notifications.warn(game.i18n.localize("Midgard6.Warnings.maxSpezReached")); + return; + } let level = 1; const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs"); diff --git a/src/sheets/hintergrund-sheet.mjs b/src/sheets/hintergrund-sheet.mjs index fcb4132..b150866 100644 --- a/src/sheets/hintergrund-sheet.mjs +++ b/src/sheets/hintergrund-sheet.mjs @@ -22,11 +22,11 @@ export class M6HintergrundSheet extends M6ItemSheet { { id: "beschreibung", icon: "fa-feather-pointed" - }, - { - id: "effects", - icon: "fa-bolt" } + // { + // id: "effects", + // icon: "fa-bolt" + // } ], initial: "beschreibung", labelPrefix: "Midgard6.Sheets.Tabs" @@ -44,11 +44,11 @@ export class M6HintergrundSheet extends M6ItemSheet { beschreibung: { template: systemPath("templates/hintergrund/description.hbs"), scrollable: [""] - }, - effects: { - template: systemPath("templates/shared/effects.hbs"), - scrollable: [""] } + // effects: { + // template: systemPath("templates/shared/effects.hbs"), + // scrollable: [""] + // } }; _addSpecifics(context) { diff --git a/src/sheets/item-sheet.mjs b/src/sheets/item-sheet.mjs index 8732ea6..03b5520 100644 --- a/src/sheets/item-sheet.mjs +++ b/src/sheets/item-sheet.mjs @@ -38,11 +38,11 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet { id: "beschreibung", icon: "fa-feather-pointed" - }, - { - id: "effects", - icon: "fa-bolt" } + // { + // id: "effects", + // icon: "fa-bolt" + // } ], initial: "beschreibung", labelPrefix: "Midgard6.Sheets.Tabs" @@ -62,11 +62,11 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet beschreibung: { template: systemPath("templates/item/description.hbs"), scrollable: [""] - }, - effects: { - template: systemPath("templates/shared/effects.hbs"), - scrollable: [""] } + // effects: { + // template: systemPath("templates/shared/effects.hbs"), + // scrollable: [""] + // } }; _attachPartListeners(partId, html, bubble) { @@ -88,8 +88,9 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet event.preventDefault(); const currentInput = event.currentTarget; const value = currentInput.value; + const location = currentInput.name || currentInput.id; console.log("Feld verlassen! Aktueller Wert:", value); - this.item.update({ [`${currentInput.name}`]: value.split(/[\s,]+/) }); + this.item.update({ [`${location}`]: value.split(/[\s,]+/) }); } /* -------------------------------------------------- */ diff --git a/src/sheets/weapon-sheet.mjs b/src/sheets/weapon-sheet.mjs index b63b5c0..96caf98 100644 --- a/src/sheets/weapon-sheet.mjs +++ b/src/sheets/weapon-sheet.mjs @@ -27,11 +27,11 @@ export class M6WeaponSheet extends M6ItemSheet { { id: "beschreibung", icon: "fa-feather-pointed" - }, - { - id: "effects", - icon: "fa-bolt" } + // { + // id: "effects", + // icon: "fa-bolt" + // } ], initial: "eigenschaften", labelPrefix: "Midgard6.Sheets.Tabs" @@ -53,11 +53,11 @@ export class M6WeaponSheet extends M6ItemSheet { beschreibung: { template: systemPath("templates/item/description.hbs"), scrollable: [""] - }, - effects: { - template: systemPath("templates/shared/effects.hbs"), - scrollable: [""] } + // effects: { + // template: systemPath("templates/shared/effects.hbs"), + // scrollable: [""] + // } }; async _addSpecifics(context) { diff --git a/src/styles/dialog.scss b/src/styles/dialog.scss index c1ae867..50305f4 100644 --- a/src/styles/dialog.scss +++ b/src/styles/dialog.scss @@ -59,22 +59,22 @@ } } -/* Container für die gesamte Reihe */ .segmented-button-row { display: inline-flex; - overflow: hidden; + overflow: visible; height: 32px; + white-space: nowrap; + flex-wrap: wrap; } -/* Einzelnes Segment */ .segmented-button { position: relative; cursor: pointer; display: flex; align-items: center; + height: 100%; } -/* Versteckt den echten Radio-Button, behält aber die Tastatur-Navigation */ .segmented-button input[type="radio"] { position: absolute; opacity: 0; @@ -82,7 +82,6 @@ height: 0; } -/* Inhalt des Segments (Layout & Abstände) */ .segmented-button__content { display: flex; align-items: center; @@ -96,19 +95,11 @@ user-select: none; } -/* --- ZUSTÄNDE --- */ - -/* Selektiert (Selected State) */ .segmented-button input[type="radio"]:checked + .segmented-button__content { - // background-color: #e8def8; /* M3 Secondary Container Color */ - text-shadow: 0 0 10px var(--M6-text-brown) !important; - color: #1d192b; /* M3 On-Secondary Container Text */ - .icon { - text-shadow: 0 0 10px var(--M6-text-brown) !important; - } + background-color: var(--M6-background-brown); + color: #1d192b; } -/* Hover-Effekt */ .segmented-button:hover .segmented-button__content { background-color: rgba(73, 69, 79, 0.08); } @@ -116,7 +107,6 @@ background-color: rgba(232, 222, 248, 0.85); } -/* Tastatur-Fokus (Barrierefreiheit) */ .segmented-button input[type="radio"]:focus-visible + .segmented-button__content { outline: 2px solid #6750a4; outline-offset: -2px; diff --git a/src/styles/items-page.scss b/src/styles/items-page.scss index 6053313..09055e5 100644 --- a/src/styles/items-page.scss +++ b/src/styles/items-page.scss @@ -18,37 +18,53 @@ display: flex; justify-content: center; align-items: center; - z-index: 9999; /* Bleibt immer im Vordergrund */ + z-index: 100; + } + + .tooltip-wrapper { + position: relative; + width: 90%; + cursor: pointer; } - /* Der graue Hintergrund des Balkens */ .progress-background { - width: 90%; /* Breite des Balkens auf dem Bildschirm */ - max-width: 800px; /* Maximale Breite auf großen Bildschirmen */ + width: 100%; background-color: #e0e0e0; - overflow: hidden; /* Schneidet den inneren Balken sauber ab */ + overflow: hidden; 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; + background-color: #808080; width: 100%; + color: var(--M6-background-brown); } + progress::-moz-progress-bar { background: var(--M6-background-brown); } progress::-webkit-progress-value { background: var(--M6-background-brown); } - progress { - color: var(--M6-background-brown); + + .tooltiptext { + visibility: hidden; + background-color: black; + color: #fff; + text-align: center; + border-radius: 6px; + padding: 5px 0; + position: absolute; + width: 130px; + bottom: 120%; + left: 50%; + margin-left: -65px; + z-index: 200; + } + + .tooltip-wrapper:hover .tooltiptext { + visibility: visible; } } } diff --git a/src/system.mjs b/src/system.mjs index 525751c..25a1b58 100644 --- a/src/system.mjs +++ b/src/system.mjs @@ -17,28 +17,33 @@ import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs"; import { M6HintergrundSheet } from "./sheets/hintergrund-sheet.mjs"; import { M6ChatMessage } from "./ui/chat-message.mjs"; import "./styles/M6.scss"; +import { localizeHelper } from "./helpers/utils.mjs"; Hooks.once("init", () => { CONFIG.ChatMessage.documentClass = M6ChatMessage; CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs"); - CONFIG.Actor.dataModels.character = CharacterData; + CONFIG.Actor.dataModels = { + character: CharacterData + }; + CONFIG.Item.dataModels = { + item: ItemData, + geld: ItemData, + weapon: WeaponData, + armor: ArmorData, + zauber: ZauberData, + hintergrund: HintergrundData + }; CONFIG.Actor.trackableAttributes = { pc: { bar: ["resources.leben", "resources.ausdauer"], - value: ["level"] + value: ["schicksalsmünzen"] }, npc: { bar: ["resources.leben", "resources.ausdauer"], value: [] } }; - CONFIG.Item.dataModels.item = ItemData; - CONFIG.Item.dataModels.geld = ItemData; - CONFIG.Item.dataModels.weapon = WeaponData; - CONFIG.Item.dataModels.armor = ArmorData; - CONFIG.Item.dataModels.zauber = ZauberData; - CONFIG.Item.dataModels.hintergrund = HintergrundData; foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, { types: ["character"], diff --git a/templates/actor/hintergrund.hbs b/templates/actor/hintergrund.hbs index 25f3213..695100b 100644 --- a/templates/actor/hintergrund.hbs +++ b/templates/actor/hintergrund.hbs @@ -81,6 +81,22 @@
{{#with itemTypes.gunst}} +
+
+ {{#if @root.editable}} + + + {{localize "DOCUMENT.Create" type=this.label}} + + {{/if}} +
+
{{#each this.items as |gunst|}}
{{#if @root.editable}} + + +
{{#with itemTypes.makel}} + {{#each this.items as |makel|}}
{{#if @root.editable}} + + + @@ -177,14 +223,15 @@ >{{legende.name}}
- - - + {{#if @root.editable}} + + + {{#if @root.editable}} + + +
+
+ {{localize "Midgard6.Traglast"}}: {{gewicht.gewicht}} / {{gewicht.traglast}} +
+
\ No newline at end of file diff --git a/templates/actor/zauber.hbs b/templates/actor/zauber.hbs index 9cc98ed..d04cdee 100644 --- a/templates/actor/zauber.hbs +++ b/templates/actor/zauber.hbs @@ -29,7 +29,7 @@

{{zauber.name}}

{{zauber.system.eigenschaften.ursprung}}

{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}

-
+
{{#if @root.editable}} diff --git a/templates/chat/message-default.hbs b/templates/chat/message-default.hbs index 05a306b..21fd829 100644 --- a/templates/chat/message-default.hbs +++ b/templates/chat/message-default.hbs @@ -28,13 +28,13 @@ {{/each}}
{{/if}} - {{#if merkmale}} -
- {{#each merkmale as |merkmal|}} -
{{merkmal}}
- {{/each}} -
- {{/if}} +
+ {{#each merkmale as |merkmal|}} + {{#if merkmal}} +
{{merkmal}}
+ {{/if}} + {{/each}} +
{{#if isRoll}} {{#each message.content as |roll|}}
diff --git a/templates/dialog/roll-dialog.hbs b/templates/dialog/roll-dialog.hbs index cbd3490..a8a3994 100644 --- a/templates/dialog/roll-dialog.hbs +++ b/templates/dialog/roll-dialog.hbs @@ -3,25 +3,23 @@ Modifikation
- {{!
}} -
+
-
+
@@ -29,7 +27,7 @@ @@ -37,55 +35,50 @@
- {{!
}} -
-
-
- - {{#each bonuses}} - - {{/each}} -
-
-
- {{#if damageRoll}} -
+
+ {{#if damageRoll}} + {{/if}}
- {{/if}} -
-
- +
+
+ + {{#each bonuses}} + + {{/each}} +
+
+
+ +
-
\ No newline at end of file diff --git a/templates/hintergrund/header.hbs b/templates/hintergrund/header.hbs index 1fc36bc..8ee194d 100644 --- a/templates/hintergrund/header.hbs +++ b/templates/hintergrund/header.hbs @@ -24,21 +24,23 @@
- + {{#ifeq item.type "legende"}} + + {{/ifeq}}
diff --git a/templates/item/header.hbs b/templates/item/header.hbs index 14e9066..d4995bc 100644 --- a/templates/item/header.hbs +++ b/templates/item/header.hbs @@ -20,7 +20,7 @@
- + x
@@ -28,7 +28,7 @@
- +
diff --git a/templates/item/rüstung/eigenschaften.hbs b/templates/item/rüstung/eigenschaften.hbs index 3380ef2..87891a9 100644 --- a/templates/item/rüstung/eigenschaften.hbs +++ b/templates/item/rüstung/eigenschaften.hbs @@ -8,7 +8,7 @@ {{localize "Midgard6.Item.Eigenschaften"}}
-
+

{{localize "Midgard6.Item.rüstwert"}}

{{localize "Midgard6.Item.Eigenschaften"}}
-
+

{{localize "Midgard6.Item.schaden"}}

-
+

{{localize "Midgard6.Item.fertigkeit"}}

+