Compare commits
13
Commits
v0.9.1
...
84daa12b7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84daa12b7b | ||
|
|
4ab69c0905 | ||
|
|
1723a4dd6b | ||
|
|
d17cd3c9b6 | ||
|
|
113315f68f | ||
|
|
3406f2134c | ||
|
|
e8caa591c4 | ||
|
|
3448ce5a4c | ||
|
|
70bc6873d7 | ||
|
|
a4f8718bcd | ||
|
|
64b98dd379 | ||
|
|
7f9eda1c35 | ||
|
|
bde7ea7e2e |
No files matched your search
@@ -1,23 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run typecheck
|
||||
- run: npm run lint
|
||||
- run: npm run format:check
|
||||
- run: npm run test
|
||||
- run: npm run build
|
||||
+8
-1
@@ -3,5 +3,12 @@
|
||||
"singleQuote": false,
|
||||
"tabWidth": 2,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "none"
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.hbs",
|
||||
"options": {
|
||||
"parser": "glimmer"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,73 +1,25 @@
|
||||
# midgard6-lvd
|
||||
|
||||
A TypeScript + React + Vite boilerplate for building Foundry VTT (V14) game systems on top of **ApplicationV2**, with full type safety via [`fvtt-types`](https://github.com/League-of-Foundry-Developers/foundry-vtt-types).
|
||||
Dies ist eine [Foundry VTT](https://foundryvtt.com/) Implementation für [Midgard: Legenden von Damatu](https://pegasus.de/search?search=Midgard+legenden+von+damatu). Für die neuste Version und einer Liste von Änderungen schaue [hier](https://git.byroks.de/MidgardVTT-Entwicklung/midgard6-vtt/releases).
|
||||
|
||||
This is a starting point, not a ruleset: one `character` Actor type and one `item` Item type, each with a React-rendered sheet, just enough to prove the pipeline end-to-end (build → load in Foundry → render → write back to the document).
|
||||
Bisher hies das ein Fan Projekt und ist in keinster weise mit Pegaus Assoziiert. Die Nutzung & Verbreitung ist nur für den Privaten Gebrauch gedacht.
|
||||
|
||||
## Prerequisites
|
||||
## Beitragen
|
||||
|
||||
- Node.js 22+
|
||||
- Foundry VTT V14
|
||||
- This repo cloned/copied directly into your Foundry `Data/systems/<your-system-id>` folder (development is done live in place — there's no separate dev server)
|
||||
Fehlermeldungen oder Feature-Anfragen, sind sehr willkommen. Bitte nutzt hierfür die Seite [Issues](https://git.byroks.de/MidgardVTT-Entwicklung/midgard6-vtt/issues)!
|
||||
|
||||
## Quickstart
|
||||
Du kannst dich bei Problemen auch über Discord an Byroks wenden. Wir helfen euch gerne dabei, euer Spiel reibungslos zum Laufen zu bringen!
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm run dev # vite build --watch — rebuilds dist/ on every save
|
||||
```
|
||||
Bitte schau dir die Liste der Probleme an, bevor du neue Funktionen vorschlägst.
|
||||
|
||||
Then in Foundry: enable the system for a world (or create one), reload the world after each rebuild to see changes (`F5` in the Foundry window — AppV2/React state isn't hot-reloaded, only full document/sheet remounts pick up new JS).
|
||||
Der Hauptentwickler ist [Byroks](https://git.byroks.de/Byroks).
|
||||
|
||||
## Scripts
|
||||
Falls du selber Beitragen möchtest, schreibe Byroks auf Discord für eine Einladung in den Entwickler Discord und einem GiTea account.
|
||||
|
||||
| Script | What it does |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `npm run dev` | Vite build in watch mode |
|
||||
| `npm run build` | One-shot production build to `dist/` |
|
||||
| `npm run typecheck` | `tsc --noEmit` |
|
||||
| `npm run lint` | ESLint over the repo |
|
||||
| `npm run lint:fix` | ESLint with autofix |
|
||||
| `npm run format` | Prettier write |
|
||||
| `npm run format:check` | Prettier check (used in CI) |
|
||||
| `npm run test` | Vitest (pure-logic unit tests only — see [docs/testing-and-linting.md](docs/testing-and-linting.md)) |
|
||||
Gemäß der [KI-Inhaltsrichtlinie] von Foundry, ist es nicht gestattet, KI-generierten Code in das Repository zu integrieren, um die Richtlinien einzuhalten. Sollte der Verdacht bestehen, dass dein Merge-Request KI-generierten Code enthält, wird dieser geschlossen.
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
system.json Foundry manifest — documentTypes, esmodules, languages
|
||||
LICENSE.txt
|
||||
lang/en.json, fr.json i18n strings, BOILERPLATE.* namespace
|
||||
src/
|
||||
system.ts Entry point — registers DataModels + sheets on "init"
|
||||
i18n.ts localize() helper
|
||||
data/
|
||||
character-data.ts CharacterData DataModel (schema for Actor type "character")
|
||||
item-data.ts ItemData DataModel (schema for Item type "item")
|
||||
sheets/
|
||||
character-sheet.ts ActorSheetV2 subclass, mounts React
|
||||
item-sheet.ts ItemSheetV2 subclass, mounts React
|
||||
components/
|
||||
CharacterSheetApp.tsx React sheet UI
|
||||
CharacterSheetApp.logic.ts pure helpers (unit-tested)
|
||||
CharacterSheetApp.module.scss
|
||||
ItemSheetApp.tsx
|
||||
ItemSheetApp.module.scss
|
||||
types/
|
||||
data-config.d.ts DataModelConfig augmentation (types actor.system/item.system)
|
||||
foundry.d.ts *.module.scss ambient module declaration
|
||||
dist/ build output (gitignored) — esmodules/styles in system.json point here
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- [docs/architecture.md](docs/architecture.md) — how `documentTypes`, `DataModel`, AppV2, React mounting, and `fvtt-types` fit together
|
||||
- [docs/adding-content.md](docs/adding-content.md) — step-by-step: add a new Actor/Item subtype
|
||||
- [docs/styling.md](docs/styling.md) — SCSS module conventions
|
||||
- [docs/localization.md](docs/localization.md) — `lang/*.json` + `game.i18n` usage
|
||||
- [docs/testing-and-linting.md](docs/testing-and-linting.md) — what's tested, what isn't, and why
|
||||
- [docs/renaming-the-system.md](docs/renaming-the-system.md) — checklist for forking this template under a new name
|
||||
|
||||
## License
|
||||
## Lizenz
|
||||
|
||||
MIT — see [LICENSE.txt](LICENSE.txt).
|
||||
|
||||
[AI Content Policy]: https://foundryvtt.com/article/ai-policy/
|
||||
@@ -1,81 +0,0 @@
|
||||
# Adding a new Actor or Item subtype
|
||||
|
||||
Worked example: adding an Actor subtype called `npc` alongside the existing `character`. The same steps apply to a new Item subtype.
|
||||
|
||||
## 1. Schema — `src/data/npc-data.ts`
|
||||
|
||||
```ts
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
threatLevel: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 1
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
export class NpcData extends foundry.abstract.TypeDataModel<
|
||||
ReturnType<typeof defineSchema>,
|
||||
Actor.Implementation
|
||||
> {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
```
|
||||
|
||||
See [docs/architecture.md](architecture.md#datamodel-classes) for why `defineSchema` is a standalone function rather than an inline class method, and why `nullable: false` matters.
|
||||
|
||||
## 2. Type it — `src/types/data-config.d.ts`
|
||||
|
||||
```ts
|
||||
import type { NpcData } from "../data/npc-data";
|
||||
|
||||
declare module "fvtt-types/configuration" {
|
||||
interface DataModelConfig {
|
||||
Actor: { character: typeof CharacterData; npc: typeof NpcData };
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Declare it — `system.json`
|
||||
|
||||
```json
|
||||
"documentTypes": {
|
||||
"Actor": { "character": {}, "npc": {} }
|
||||
}
|
||||
```
|
||||
|
||||
## 4. Sheet — `src/sheets/npc-sheet.ts`
|
||||
|
||||
Copy `character-sheet.ts` verbatim, rename the class, point it at a new React component. The `_renderHTML`/`_replaceHTML`/`close` lifecycle is identical for every AppV2 sheet in this boilerplate.
|
||||
|
||||
## 5. React component — `src/sheets/components/NpcSheetApp.tsx`
|
||||
|
||||
Copy the shape of `CharacterSheetApp.tsx`: accept the typed document as a prop, read `actor.system.*`, write via `actor.update({ system: { ... } })` (nested object — see the architecture doc's gotcha), localize labels via `localize()` from `src/i18n.ts`.
|
||||
|
||||
## 6. Register — `src/system.ts`
|
||||
|
||||
```ts
|
||||
CONFIG.Actor.dataModels.npc = NpcData;
|
||||
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||
Actor,
|
||||
"fvtt-ts-react-boilerplate",
|
||||
NpcSheet,
|
||||
{
|
||||
types: ["npc"],
|
||||
makeDefault: true
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## 7. i18n
|
||||
|
||||
Add `BOILERPLATE.Npc.*` keys to `lang/en.json` and `lang/fr.json` — see [docs/localization.md](localization.md).
|
||||
|
||||
## Verify
|
||||
|
||||
`npm run typecheck && npm run build`, then in Foundry create an Actor and pick the new subtype from the type dropdown.
|
||||
@@ -1,126 +0,0 @@
|
||||
# Architecture
|
||||
|
||||
## Why no `template.json`
|
||||
|
||||
Pre-V11 Foundry systems describe Actor/Item data shapes in `template.json`. This boilerplate uses the V11+ alternative instead: `system.json`'s `documentTypes` field declares which subtypes exist, and a `DataModel` class (registered at runtime) defines the actual schema. Two sources of truth (template.json + ad-hoc JS) collapses into one (the `DataModel` class), and you get real validation/casting for free.
|
||||
|
||||
```json
|
||||
// system.json
|
||||
"documentTypes": {
|
||||
"Actor": { "character": {} },
|
||||
"Item": { "item": {} }
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
// src/system.ts
|
||||
Hooks.once("init", () => {
|
||||
CONFIG.Actor.dataModels.character = CharacterData;
|
||||
CONFIG.Item.dataModels.item = ItemData;
|
||||
});
|
||||
```
|
||||
|
||||
## DataModel classes
|
||||
|
||||
`src/data/character-data.ts`:
|
||||
|
||||
```ts
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
biography: new fields.HTMLField({ initial: "" }),
|
||||
attributes: new fields.SchemaField({
|
||||
strength: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 10
|
||||
})
|
||||
// ...
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
export class CharacterData extends foundry.abstract.TypeDataModel<
|
||||
ReturnType<typeof defineSchema>,
|
||||
Actor.Implementation
|
||||
> {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
```
|
||||
|
||||
The `defineSchema` function is declared standalone, then assigned as a static — not written inline as a class method. This is required so `ReturnType<typeof defineSchema>` can be used as the `TypeDataModel` generic's `Schema` argument; a class can't reference its own static method's return type in its own `extends` clause.
|
||||
|
||||
**`nullable: false` matters.** Without it, `NumberField`'s inferred type is `number | null` (Foundry fields are nullable by default), which then leaks into every place that reads `attrs.strength` as if it could be `null`. Set it explicitly wherever you don't actually want `null` to be a valid value.
|
||||
|
||||
## fvtt-types + DataModelConfig
|
||||
|
||||
[`fvtt-types`](https://github.com/League-of-Foundry-Developers/foundry-vtt-types) (installed as the `fvtt-types` npm package) supplies ambient types for `Hooks`, `CONFIG`, `game`, `foundry.*`, `Actor`, `Item`, etc. Wired in via `tsconfig.json`:
|
||||
|
||||
```json
|
||||
{ "compilerOptions": { "types": ["fvtt-types"] } }
|
||||
```
|
||||
|
||||
By default, `actor.system` is untyped without telling the types package which `DataModel` class backs each subtype. `src/types/data-config.d.ts` does that via module augmentation:
|
||||
|
||||
```ts
|
||||
declare module "fvtt-types/configuration" {
|
||||
interface DataModelConfig {
|
||||
Actor: { character: typeof CharacterData };
|
||||
Item: { item: typeof ItemData };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
After this, `actor.system.attributes.strength` resolves to `number`, not `any`.
|
||||
|
||||
**Gotcha**: with real types in place, `actor.update({ "system.attributes.strength": 5 })` (dotted-path key) no longer type-checks — `update()`'s type wants a nested object. Foundry's runtime supports both forms (it expands dotted paths internally), but only the nested form satisfies the types:
|
||||
|
||||
```ts
|
||||
actor.update({ system: { attributes: { strength: 5 } } });
|
||||
```
|
||||
|
||||
**Version mismatch risk**: `fvtt-types`'s published versions track Foundry V13 builds (no V14-specific release exists at the time this was written). The AppV2/DataModel surface is stable since V13 so this mostly just works, but if you hit a type error that looks wrong for an API you know exists in V14, it may be a types-package gap rather than a real bug — check `tsc` output carefully before assuming the type is right.
|
||||
|
||||
## AppV2 sheets with React (no Handlebars)
|
||||
|
||||
`src/sheets/character-sheet.ts` extends `ActorSheetV2` directly — no `HandlebarsApplicationMixin`. Three lifecycle methods matter:
|
||||
|
||||
```ts
|
||||
export class CharacterSheet extends foundry.applications.sheets.ActorSheetV2 {
|
||||
#root: Root | null = null;
|
||||
|
||||
override async _renderHTML(...args) {
|
||||
return args[0]; // pass-through: no HTML string/template needed
|
||||
}
|
||||
|
||||
override _replaceHTML(...args) {
|
||||
const content = args[1]; // the sheet's content HTMLElement
|
||||
if (!this.#root) this.#root = createRoot(content);
|
||||
this.#root.render(React.createElement(CharacterSheetApp, { actor: this.document }));
|
||||
}
|
||||
|
||||
override async close(...args) {
|
||||
this.#root?.unmount();
|
||||
this.#root = null;
|
||||
return super.close(...args);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `_renderHTML` would normally render a Handlebars template to a string; here it's a no-op pass-through since React owns the DOM.
|
||||
- `_replaceHTML` is where the React root gets created (once) and (re-)rendered on every Foundry-triggered re-render (e.g. after `actor.update()`, on any client watching the same actor). React reconciles internally — no manual diffing needed on our side.
|
||||
- `close()` must unmount the React root, or you leak it (and React will warn about it).
|
||||
|
||||
Method signatures use `Parameters<foundry.applications.sheets.ActorSheetV2["_renderHTML"]>` rather than hand-typed parameters — this way if the base class signature changes in a newer `fvtt-types` release, `tsc` will flag the mismatch instead of silently drifting.
|
||||
|
||||
## Build (Vite)
|
||||
|
||||
`vite.config.ts` builds `src/system.ts` in **library mode** to a single ESM file (`dist/system.mjs`) — Foundry loads this directly as an `esmodule`, it can't resolve `node_modules` imports at runtime, so React/ReactDOM are bundled in, not externalized.
|
||||
|
||||
Two non-obvious settings:
|
||||
|
||||
- `define: { "process.env.NODE_ENV": JSON.stringify("production") }` — Vite's lib mode doesn't auto-replace `process.env.NODE_ENV` the way app mode does. Without this, React throws `Uncaught ReferenceError: process is not defined` at runtime in Foundry (there's no Node `process` global in a browser). Setting it also lets Rollup dead-code-eliminate React's dev-only warning paths, shrinking the bundle.
|
||||
- `css.preprocessorOptions.scss.api: "modern-compiler"` — silences a Sass legacy-JS-API deprecation warning on build; functionally inert otherwise.
|
||||
|
||||
CSS Modules (`*.module.scss`) are handled by Vite natively — `sass` is a dev dependency for SCSS compilation, no extra plugin needed.
|
||||
@@ -1,38 +0,0 @@
|
||||
# Localization
|
||||
|
||||
`system.json` registers two languages:
|
||||
|
||||
```json
|
||||
"languages": [
|
||||
{ "lang": "en", "name": "English", "path": "lang/en.json", "flags": {} },
|
||||
{ "lang": "fr", "name": "Français", "path": "lang/fr.json", "flags": {} }
|
||||
]
|
||||
```
|
||||
|
||||
All keys live under a single `BOILERPLATE` root namespace to avoid colliding with Foundry core or other systems/modules:
|
||||
|
||||
```json
|
||||
{
|
||||
"BOILERPLATE": {
|
||||
"Attributes": { "strength": "Strength", "agility": "Agility", "spirit": "Spirit" },
|
||||
"Sheet": { "Biography": "Biography", "SendToChat": "Send to chat", "...": "..." },
|
||||
"Item": { "Quantity": "Quantity", "Description": "Description" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In React components, use the `localize()` helper from `src/i18n.ts` rather than calling `game.i18n.localize()` directly:
|
||||
|
||||
```ts
|
||||
export const localize = (key: string) => game.i18n!.localize(key);
|
||||
```
|
||||
|
||||
```tsx
|
||||
import { localize } from "../../i18n";
|
||||
|
||||
<label>{localize("BOILERPLATE.Sheet.Biography")}</label>;
|
||||
```
|
||||
|
||||
**Why the helper instead of inline `game.i18n.localize()`**: `fvtt-types` types `game` (and `game.i18n`) as possibly `undefined`, since `game` genuinely isn't populated until Foundry's `"ready"` hook fires. Sheets only ever render after that point, so a single non-null assertion in one shared helper is safe and keeps every call site from repeating `game.i18n!.localize(...)`.
|
||||
|
||||
When adding a new string: add the key to **both** `lang/en.json` and `lang/fr.json`. Foundry does not fall back to English for a missing key in the active non-English language — `localize()` just returns the raw key string (e.g. `"BOILERPLATE.Sheet.Foo"`) if it's missing from the active language file.
|
||||
@@ -1,17 +0,0 @@
|
||||
# Renaming this template for a new system
|
||||
|
||||
If you're forking this boilerplate to start an actual system, every literal occurrence of `fvtt-ts-react-boilerplate` needs to change, plus the `character`/`item` placeholder type names if you're not keeping them. Checklist:
|
||||
|
||||
| Location | What to change |
|
||||
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Folder name | Rename the folder itself (`Data/systems/fvtt-ts-react-boilerplate` → `Data/systems/<your-id>`) |
|
||||
| `system.json` | `"id"`, `"title"`, `"description"`, `"authors"` |
|
||||
| `package.json` | `"name"` |
|
||||
| `src/system.ts` | The namespace string passed to `DocumentSheetConfig.registerSheet(..., "fvtt-ts-react-boilerplate", ...)` (two call sites) |
|
||||
| `src/sheets/character-sheet.ts`, `src/sheets/item-sheet.ts` | `DEFAULT_OPTIONS.classes` array — the `"fvtt-ts-react-boilerplate"` CSS class entry |
|
||||
| `lang/en.json`, `lang/fr.json` | The `BOILERPLATE` root key — pick a namespace that won't collide with other systems/modules (convention: uppercase, short, unique to your system) |
|
||||
| `LICENSE.txt` | Copyright holder name, if different from the original author |
|
||||
|
||||
If you're also renaming the placeholder `character`/`item` subtypes to your own (e.g. `hero`/`weapon`), that's a separate, larger change — follow [docs/adding-content.md](adding-content.md) to add the new subtype(s) first, then remove `character`/`item` (schema file, `DataModelConfig` entry, `documentTypes` entry, sheet, component, registration in `system.ts`) once nothing references them.
|
||||
|
||||
After renaming, run `npm run typecheck && npm run lint && npm run build` and reload Foundry — the system should appear under the new id in the system selection list (you may need to restart the Foundry server for it to notice the folder rename).
|
||||
@@ -1,28 +0,0 @@
|
||||
# Styling
|
||||
|
||||
Each sheet component has its own SCSS module, colocated and named after the component: `CharacterSheetApp.tsx` ↔ `CharacterSheetApp.module.scss`.
|
||||
|
||||
```tsx
|
||||
import styles from "./CharacterSheetApp.module.scss";
|
||||
|
||||
<div className={styles.sheet}> ... </div>;
|
||||
```
|
||||
|
||||
Vite compiles `*.module.scss` to locally-scoped, hashed class names automatically — no global CSS collisions between sheets, no need for a `newsystem`-prefixed BEM-style convention like older Foundry systems use.
|
||||
|
||||
Nest sub-element styles under their parent class using Sass nesting, e.g. in `CharacterSheetApp.module.scss`:
|
||||
|
||||
```scss
|
||||
.attributeLabel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.modifier {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
All compiled CSS (across every component) gets concatenated by Vite into the single `dist/style.css` that `system.json`'s `styles` array points at — you don't need to import each module's CSS manually anywhere except inside the component that uses it (Vite's CSS-in-JS-import handles collection).
|
||||
|
||||
There's no global stylesheet in this boilerplate by design — if you need truly global rules (e.g. a CSS variable reset), add a plain (non-module) `.scss` file and import it once from `src/system.ts`.
|
||||
@@ -1,31 +0,0 @@
|
||||
# Testing and linting
|
||||
|
||||
## What's tested, and why so little
|
||||
|
||||
`npm run test` (Vitest) only covers **pure game-logic functions** — currently `modifier`/`fmtMod` in `src/sheets/components/CharacterSheetApp.logic.ts`, exercised by `CharacterSheetApp.logic.test.ts`.
|
||||
|
||||
Anything that touches `actor`, `ChatMessage`, `game`, `Hooks`, or any other Foundry global needs a running Foundry server with a world loaded — there's no practical way to unit-test `actor.update(...)` or `ChatMessage.create(...)` calls in isolation, and mocking the entire Foundry runtime isn't worth the upkeep for a boilerplate.
|
||||
|
||||
**The pattern going forward**: when a component's logic is more than "read a prop, write an update," extract the part that's pure computation (no Foundry globals, no React) into a sibling `*.logic.ts` file, and unit-test _that_. The component itself stays thin glue between Foundry documents and the pure logic, and isn't tested directly.
|
||||
|
||||
## Linting
|
||||
|
||||
ESLint flat config (`eslint.config.js`): `typescript-eslint` recommended rules + `eslint-plugin-react` (JSX rules, `react-in-jsx-scope` and `prop-types` turned off — not relevant with the modern JSX transform + TypeScript prop typing) + `eslint-config-prettier` (turns off any ESLint formatting rules that would conflict with Prettier).
|
||||
|
||||
```sh
|
||||
npm run lint # check
|
||||
npm run lint:fix # autofix
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
Prettier (`.prettierrc`): double quotes, semicolons, 2-space indent, no trailing commas, 100-char print width — matches the style already used throughout `src/`.
|
||||
|
||||
```sh
|
||||
npm run format # write
|
||||
npm run format:check # check only (used in CI)
|
||||
```
|
||||
|
||||
## CI
|
||||
|
||||
`.github/workflows/ci.yml` runs on every push/PR to `main`: `npm ci` → typecheck → lint → format:check → test → build. This only actually executes once the repo has a GitHub remote with Actions enabled — if you've forked this template, push to your own remote and it'll pick up from there.
|
||||
+1
-18
@@ -1,27 +1,10 @@
|
||||
import js from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import react from "eslint-plugin-react";
|
||||
import prettier from "eslint-config-prettier";
|
||||
import globals from "globals";
|
||||
|
||||
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
|
||||
prettier,
|
||||
);
|
||||
@@ -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": {
|
||||
|
||||
Generated
+552
-4620
File diff suppressed because it is too large.
Load diff
+1
-6
@@ -17,20 +17,15 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.4",
|
||||
"@types/react": "^18.3.0",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"archiver": "^8.0.0",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"fvtt-types": "^13.346.0-beta.20250812191140",
|
||||
"globals": "^17.7.0",
|
||||
"prettier": "^3.8.4",
|
||||
"sass": "^1.101.0",
|
||||
"typescript": "^5.6.0",
|
||||
"typescript-eslint": "^8.62.0",
|
||||
"vite": "^5.4.0",
|
||||
"vitest": "^4.1.9"
|
||||
"vite": "^5.4.0"
|
||||
}
|
||||
}
|
||||
+5
-16
@@ -2,7 +2,6 @@ import fs from "fs";
|
||||
import path from "path";
|
||||
import { ZipArchive } from "archiver";
|
||||
|
||||
// Pfade definieren
|
||||
const GITEA_URL = process.env.GITEA_URL;
|
||||
const REPO = process.env.GITEA_REPOSITORY;
|
||||
const RELEASE_TAG = process.env.GITEA_REF_NAME || "v1.0.0";
|
||||
@@ -18,12 +17,12 @@ if (fs.existsSync(systemJsonPath)) {
|
||||
const systemJson = JSON.parse(fs.readFileSync(systemJsonPath, "utf8"));
|
||||
|
||||
systemJson.version = cleanVersion;
|
||||
systemJson.manifest = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/system.json`;
|
||||
systemJson.manifest = `${GITEA_URL}/${REPO}/releases/download/latest/system.json`;
|
||||
systemJson.download = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/midgard6-lvd.zip`;
|
||||
|
||||
fs.writeFileSync(systemJsonPath, JSON.stringify(systemJson, null, 2));
|
||||
console.log(
|
||||
`\x1b[32m✅ system.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`
|
||||
`\x1b[32m✅ system.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`,
|
||||
);
|
||||
} else {
|
||||
console.error(`\x1b[31m❌ system.json nicht gefunden unter: ${systemJsonPath}\x1b[0m`);
|
||||
@@ -37,7 +36,7 @@ if (fs.existsSync(packageJsonPath)) {
|
||||
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||
console.log(
|
||||
`\x1b[32m✅ package.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`
|
||||
`\x1b[32m✅ package.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`,
|
||||
);
|
||||
} else {
|
||||
console.log(`\x1b[33m⚠️ package.json nicht gefunden – Schritt übersprungen.\x1b[0m`);
|
||||
@@ -57,11 +56,10 @@ async function zipDirectory(sourceDir, outPath) {
|
||||
|
||||
archive.pipe(stream);
|
||||
archive.directory(sourceDir, false);
|
||||
archive.finalize(); // Finalize anstoßen
|
||||
archive.finalize();
|
||||
});
|
||||
}
|
||||
|
||||
// Name auf "build-zip" geändert, um Konflikte mit Vites "dist"-Ordner zu vermeiden!
|
||||
const zipTmpDir = path.resolve("./build-zip");
|
||||
|
||||
if (fs.existsSync(zipTmpDir)) {
|
||||
@@ -69,14 +67,7 @@ if (fs.existsSync(zipTmpDir)) {
|
||||
}
|
||||
fs.mkdirSync(zipTmpDir);
|
||||
|
||||
// Passe diese Liste an! Da Vite in "dist" baut, müssen die Pfade eventuell dorthin zeigen
|
||||
// Beispiel: Wenn dein CSS in dist/styles/M6.css liegt, schreibe 'dist/styles/M6.css' in die Liste.
|
||||
const filesToInclude = [
|
||||
"system.json",
|
||||
"templates",
|
||||
"dist", // Kopiert den gesamten Inhalt deines echten Vite-Build-Ordners mit in die Zip!
|
||||
"lang"
|
||||
];
|
||||
const filesToInclude = ["system.json", "templates", "dist", "lang", "assets"];
|
||||
|
||||
for (const file of filesToInclude) {
|
||||
if (fs.existsSync(file)) {
|
||||
@@ -90,9 +81,7 @@ for (const file of filesToInclude) {
|
||||
}
|
||||
}
|
||||
|
||||
// Wir zippen jetzt den sicheren "build-zip" Ordner
|
||||
await zipDirectory(zipTmpDir, "./midgard6-lvd.zip");
|
||||
console.log("\x1b[32m✅ system.zip wurde erfolgreich generiert.\x1b[0m");
|
||||
|
||||
// Optional: Den temporären Ordner nach dem Zippen wieder aufräumen
|
||||
fs.rmSync(zipTmpDir, { recursive: true, force: true });
|
||||
@@ -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", {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,]+/) });
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+6
-16
@@ -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;
|
||||
|
||||
+30
-14
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-8
@@ -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"],
|
||||
|
||||
@@ -81,6 +81,22 @@
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
{{#with itemTypes.gunst}}
|
||||
<div class="itemHeader" style="margin-bottom: 8px">
|
||||
<div class="document-controls">
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-create"
|
||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||
data-action="createDoc"
|
||||
data-document-class="Item"
|
||||
data-type="gunst"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
{{localize "DOCUMENT.Create" type=this.label}}
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{#each this.items as |gunst|}}
|
||||
<div
|
||||
class="collapsible"
|
||||
@@ -92,6 +108,13 @@
|
||||
<div>
|
||||
<i class="fas fa-expand"></i>
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
title="{{localize 'DOCUMENT.Update' type=gunst.name}}"
|
||||
data-action="viewDoc"
|
||||
>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a
|
||||
class="item-control item-delete"
|
||||
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
||||
@@ -112,6 +135,22 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{#with itemTypes.makel}}
|
||||
<div class="itemHeader" style="margin-bottom: 8px">
|
||||
<div class="document-controls">
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-create"
|
||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||
data-action="createDoc"
|
||||
data-document-class="Item"
|
||||
data-type="makel"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
{{localize "DOCUMENT.Create" type=this.label}}
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{#each this.items as |makel|}}
|
||||
<div
|
||||
type="button"
|
||||
@@ -124,9 +163,16 @@
|
||||
<div>
|
||||
<i class="fas fa-expand"></i>
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
title="{{localize 'DOCUMENT.Update' type=makel.name}}"
|
||||
data-action="viewDoc"
|
||||
>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a
|
||||
class="item-control item-delete"
|
||||
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
||||
title="{{localize 'DOCUMENT.Delete' type=makel.name}}"
|
||||
style="z-index:9999"
|
||||
data-action="deleteDoc"
|
||||
>
|
||||
@@ -177,14 +223,15 @@
|
||||
>{{legende.name}}
|
||||
<div>
|
||||
<i class="fas fa-expand"></i>
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||
data-action="viewDoc"
|
||||
>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||
data-action="viewDoc"
|
||||
>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a
|
||||
class="item-control item-delete"
|
||||
title="{{localize 'DOCUMENT.Delete' type=legende.name}}"
|
||||
@@ -240,6 +287,13 @@
|
||||
<div>
|
||||
<i class="fas fa-expand"></i>
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||
data-action="viewDoc"
|
||||
>
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a
|
||||
class="item-control item-delete"
|
||||
title="{{localize 'DOCUMENT.Delete' type=schicksalsgabe.name}}"
|
||||
|
||||
@@ -226,6 +226,9 @@
|
||||
</div>
|
||||
</ul>
|
||||
<div class="sticky-progress-container">
|
||||
<div class="tooltip-wrapper">
|
||||
<span class="tooltiptext">{{localize "Midgard6.Traglast"}}: {{gewicht.gewicht}} / {{gewicht.traglast}}</span>
|
||||
|
||||
<div class="progress-background">
|
||||
<progress
|
||||
class="progress-bar"
|
||||
@@ -234,4 +237,5 @@
|
||||
></progress>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -29,7 +29,7 @@
|
||||
<p class="col-3" style="padding-top: 8px">{{zauber.name}}</p>
|
||||
<p class="col-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
||||
<p class="col-2 item-name">{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}</p>
|
||||
<a class="align-self-center col-1 fa-solid {{#if zauber.system.equipped}}fa-book-open{{else}}fa-book{{/if}}" {{#unless @root.editable}}disabled{{/unless}} data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}}"></a>
|
||||
<a class="align-self-center col-1 fa-solid fa-book-open" {{#unless @root.editable}}disabled{{/unless}} data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}}"></a>
|
||||
<a class="align-self-center col-2 fa-solid fa-dice-d20" data-action="rollSpell" {{#unless @root.editable}}disabled{{/unless}} data-name="{{zauber.name}}" data-item-id="{{zauber._id}}"></a>
|
||||
<div class="col-1 d-flex document-controls" style="margin: 0.5rem 0; padding: 0">
|
||||
{{#if @root.editable}}
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if merkmale}}
|
||||
<div class="tags">
|
||||
{{#each merkmale as |merkmal|}}
|
||||
<div class="tag">{{merkmal}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="tags">
|
||||
{{#each merkmale as |merkmal|}}
|
||||
{{#if merkmal}}
|
||||
<div class="tag">{{merkmal}}</div>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if isRoll}}
|
||||
{{#each message.content as |roll|}}
|
||||
<fieldset>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{localize "Type"}}</label>
|
||||
<div class="form-fields">
|
||||
<select name="type">
|
||||
{{selectOptions types selected=type}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,25 +3,23 @@
|
||||
<legend>Modifikation</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{{! <div class="d-flex align-items-center"> }}
|
||||
<div class="col-6">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px;"
|
||||
name="customRoll"
|
||||
id="rollDisplay"
|
||||
placeholder="1d20 + {{skillValue}}"
|
||||
value="{{customRoll}}"
|
||||
/>
|
||||
</div>
|
||||
<div class="d-flex col-6" style="padding-left: 8px;">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="vorteil-segment" value="-1" />
|
||||
<span class="segmented-button__content">
|
||||
<i class="icon fa-solid fa-arrow-down" style="color:red"></i>
|
||||
<i class="icon fa-solid fa-dice-d20" style=""></i>
|
||||
<i class="icon fa-solid fa-caret-down"></i>
|
||||
<i class="icon fa-solid fa-dice-d20"></i>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
@@ -29,7 +27,7 @@
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="vorteil-segment" value="0" checked />
|
||||
<span class="segmented-button__content">
|
||||
<i class="icon fa-solid fa-dice-d20" style=""></i>
|
||||
<i class="icon fa-solid fa-dice-d20" ></i>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
@@ -37,55 +35,50 @@
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="vorteil-segment" value="1" />
|
||||
<span class="segmented-button__content">
|
||||
<i class="icon fa-solid fa-dice-d20" style=""></i>
|
||||
<i class="icon fa-solid fa-arrow-up" style="color:blue"></i>
|
||||
<i class="icon fa-solid fa-dice-d20"></i>
|
||||
<i class="icon fa-solid fa-caret-up"></i>
|
||||
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{{! </div> }}
|
||||
<div class="col-12 d-flex">
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
{{#each bonuses}}
|
||||
<label class="segmented-button">
|
||||
<input
|
||||
type="radio"
|
||||
name="spezialisierung-segment"
|
||||
value="{{level}}"
|
||||
data-name="{{name}}"
|
||||
{{#ifeq name preSelectedSpez}}checked{{/ifeq}}
|
||||
/>
|
||||
<span class="segmented-button__content">
|
||||
{{name}}:
|
||||
{{level}}
|
||||
</span>
|
||||
</label>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if damageRoll}}
|
||||
<div class="col-6">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
{{#if damageRoll}}
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px;"
|
||||
name="customRollDamage"
|
||||
id="rollDamageDisplay"
|
||||
placeholder="{{damageRoll}}"
|
||||
value="{{customDamageRoll}}"
|
||||
/>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<select style="max-width: 15rem; margin-left: 8px" name="rollMode" data-type="String">
|
||||
{{selectOptions rollModes selected=rollMode localize=true}}
|
||||
</select>
|
||||
<div class="col-6 d-flex" style="margin-bottom: 4px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
{{#each bonuses}}
|
||||
<label class="segmented-button">
|
||||
<input
|
||||
type="radio"
|
||||
name="spezialisierung-segment"
|
||||
value="{{level}}"
|
||||
data-name="{{name}}"
|
||||
{{#ifeq name preSelectedSpez}}checked{{/ifeq}}
|
||||
/>
|
||||
<span class="segmented-button__content">
|
||||
{{name}}:
|
||||
{{level}}
|
||||
</span>
|
||||
</label>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<select name="rollMode" data-type="String">
|
||||
{{selectOptions rollModes selected=rollMode localize=true}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -24,21 +24,23 @@
|
||||
<input class="right" type="text" placeholder="{{localize "Midgard6.Hintergrund.gruppe"}}" name="system.gruppe" value="{{system.gruppe}}" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<select
|
||||
class="text right"
|
||||
style="text-align: right"
|
||||
name="system.linkId"
|
||||
value="{{system.linkId}}"
|
||||
id="linkId"
|
||||
placeholder="{{system.linkId}}"
|
||||
>
|
||||
<option {{#unless system.linkId}}selected{{/unless}}value=""></option>
|
||||
{{#each schicksalsgaben as |schicksalsgabe|}}
|
||||
<option {{#ifeq schicksalsgabe.id ../system.linkId}}selected{{/ifeq}} value="{{schicksalsgabe.id}}">
|
||||
{{schicksalsgabe.name}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
{{#ifeq item.type "legende"}}
|
||||
<select
|
||||
class="text right"
|
||||
style="text-align: right"
|
||||
name="system.linkId"
|
||||
value="{{system.linkId}}"
|
||||
id="linkId"
|
||||
placeholder="{{system.linkId}}"
|
||||
>
|
||||
<option {{#unless system.linkId}}selected{{/unless}}value="">Keine Schicksalsgabe</option>
|
||||
{{#each schicksalsgaben as |schicksalsgabe|}}
|
||||
<option {{#ifeq schicksalsgabe.id ../system.linkId}}selected{{/ifeq}} value="{{schicksalsgabe.id}}">
|
||||
{{schicksalsgabe.name}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
{{/ifeq}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.anzahl"}}" name="system.anzahl" value="{{item.system.anzahl}}" />
|
||||
<i class="fa-solid fa-sack-dollar input-icon left"></i>
|
||||
<i class="input-icon right" style="right: 26px; top: 45%">x</i>
|
||||
</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}}" />
|
||||
@@ -28,7 +28,7 @@
|
||||
</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>
|
||||
<i class="fa-solid fa-weight-hanging input-icon right"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>{{localize "Midgard6.Item.rüstwert"}}</p>
|
||||
<input
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>{{localize "Midgard6.Item.schaden"}}</p>
|
||||
<input
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6"></div>
|
||||
<div class="col-6">
|
||||
<div class="col-6" style="margin-bottom: 4px">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>{{localize "Midgard6.Item.fertigkeit"}}</p>
|
||||
<select
|
||||
@@ -31,7 +31,7 @@
|
||||
name="system.fertigkeit"
|
||||
id="fertigkeit"
|
||||
placeholder="Nahkampf"
|
||||
/>
|
||||
>
|
||||
<option {{#ifeq system.fertigkeit "system.skills.kampf.fernkampf"}}selected{{/ifeq}} value="system.skills.kampf.fernkampf">{{localize
|
||||
"Midgard6.Skills.fernkampf"
|
||||
}}</option>
|
||||
@@ -50,8 +50,8 @@
|
||||
name="system.spezialisierung"
|
||||
id="system.spezialisierung"
|
||||
placeholder=""
|
||||
/>
|
||||
<option {{#ifeq system.spezialisierung ""}}selected{{/ifeq}} value=""></option>
|
||||
>
|
||||
<option {{#ifeq system.spezialisierung ""}}selected{{/ifeq}} value="">Keine Spezialisierung</option>
|
||||
{{#each bonuses as |bonus|}}
|
||||
<option {{#ifeq bonus.name ../system.spezialisierung}}selected{{/ifeq}} value="{{bonus.name}}">
|
||||
{{bonus.name}}
|
||||
@@ -63,7 +63,7 @@
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>{{localize "Midgard6.Item.waffenmerkmale"}}</p>
|
||||
<input style="margin-left: 8px;" type="text" data-action="splitIntoArray" id="merkmale" name="system.merkmale" list="merkmalOptions" value="{{splitArray system.merkmale}}">
|
||||
<input style="margin-left: 8px;" type="text" data-action="splitIntoArray" id="system.merkmale" name="system.merkmale" value="{{splitArray system.merkmale}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+9
-10
@@ -1,15 +1,14 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [],
|
||||
define: {
|
||||
"process.env.NODE_ENV": JSON.stringify("production")
|
||||
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: { api: "modern-compiler" }
|
||||
}
|
||||
scss: { api: "modern-compiler" },
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: "dist",
|
||||
@@ -17,13 +16,13 @@ export default defineConfig({
|
||||
lib: {
|
||||
entry: "src/system.mjs",
|
||||
formats: ["es"],
|
||||
fileName: () => "system.mjs"
|
||||
fileName: () => "system.mjs",
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// single-file bundle, no code-splitting: Foundry loads this one ESM file directly
|
||||
inlineDynamicImports: true
|
||||
}
|
||||
}
|
||||
}
|
||||
inlineDynamicImports: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user