Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c097f7013 | ||
|
|
59f887fa5e | ||
|
|
4b99668b83 | ||
|
|
3867690520 | ||
|
|
5f02f5ba83 | ||
|
|
ec33ccb381 | ||
|
|
fcb5d232b5 | ||
|
|
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,
|
"singleQuote": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"printWidth": 100,
|
"printWidth": 100,
|
||||||
"trailingComma": "none"
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.hbs",
|
||||||
|
"options": {
|
||||||
|
"parser": "glimmer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -1,73 +1,25 @@
|
|||||||
# midgard6-lvd
|
# 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+
|
Fehlermeldungen oder Feature-Anfragen, sind sehr willkommen. Bitte nutzt hierfür die Seite [Issues](https://git.byroks.de/MidgardVTT-Entwicklung/midgard6-vtt/issues)!
|
||||||
- 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)
|
|
||||||
|
|
||||||
## 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
|
Bitte schau dir die Liste der Probleme an, bevor du neue Funktionen vorschlägst.
|
||||||
npm install
|
|
||||||
npm run dev # vite build --watch — rebuilds dist/ on every save
|
|
||||||
```
|
|
||||||
|
|
||||||
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 |
|
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.
|
||||||
| ---------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
||||||
| `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)) |
|
|
||||||
|
|
||||||
## Project structure
|
## Lizenz
|
||||||
|
|
||||||
```
|
|
||||||
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
|
|
||||||
|
|
||||||
MIT — see [LICENSE.txt](LICENSE.txt).
|
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.
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Aktive Effekte
|
||||||
|
|
||||||
|
Das System unterstützt grundlegende Aktive effekte und ist dafür gedacht Vor-, Nachteile und Bonus Schaden für Spielercharaktere zu Automatisieren. Effekte auf Items werden dem besitzenden Charakter hinzugefügt. Hierbei ist der Ausgerüstet Status derzeit nicht relevant.
|
||||||
|
|
||||||
|
## Aufbau
|
||||||
|
|
||||||
|
Ein Aktiver Effekt besteht aus 3 Teilen:
|
||||||
|
|
||||||
|
- Key
|
||||||
|
- Modus
|
||||||
|
- Wert
|
||||||
|
|
||||||
|
### Key
|
||||||
|
|
||||||
|
Der Key bestimmt welcher Wurf verändert werden soll. Dabei wird es über @[name].vorteil und @[name].nachteil eingetragen. Name entspricht hier dem entsprechenden Wurf.
|
||||||
|
|
||||||
|
Alle derzeit besonderen Keys:
|
||||||
|
|
||||||
|
- @schaden
|
||||||
|
- @rüstwert
|
||||||
|
|
||||||
|
### Modus
|
||||||
|
|
||||||
|
Derzeit bietet das System die Foundry Standart Modi an, Addition, Subtration, Multiplikation etc.. Es ist ausreichend die Addition zu verwenden um die Anzahln an Vor & Nachteilen auf einem Wurf zu erhöhen. Da diese Separat gespeichert werden pro Fertigkeit, reicht es diese hoch zu addieren. Eine Auswertung erfolgt dann Automatisch beim Wurf. Damit kann Addition am ehesten als "Hinzufügen" gesehen werden.
|
||||||
|
|
||||||
|
### Wert
|
||||||
|
|
||||||
|
Der Wert ist die Anzahl der Vor- oder Nachteile die einem Skill hinzugefügt werden soll.
|
||||||
|
Für @schaden sieht dies etwas anders aus, hier wird zurzeit ein JSON Objekt in Form von {"schaden":"1d3", "condition":"nahkampf"} benötigt (Langfristig wird hierfür die Eingabe vereinfacht). Condition gibt dabei den Skill an auf dem der Bonusschaden hinzugefügt werden soll. Falls condition weggelassen wird, wird der Schaden sowohl Fern-, Nahkampfangriffen als auch Zauberschaden hinzugefügt.
|
||||||
|
|
||||||
|
### Beispiel
|
||||||
|
|
||||||
|
- Vorteil auf Reflexe: @reflexe.vorteil Addiert 1
|
||||||
|
- Nachteil auf Zaubern: @zaubern.nachteil Addiert 1
|
||||||
|
- Bonusschaden nur für Nahkampf: @schaden Addiert {"schaden":"1d3", "condition":"nahkampf"}
|
||||||
|
- Rüstwert um 1 Erhöhen, zusätzlich zu Rüstung: @rüstwert Addiert 1
|
||||||
|
- Rüstwert auf 3 Setzen, ungeachtet anderer Rüstung: @rüstwert.mod Überschreiben 3
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Derzeit bringt das System 5 verschiedene Token Stati mit. Davon aktivieren "Erschöpft" als auch "Verwundet" eigene Aktive Effekte, welche verschwinden sobald dieser Status wieder deaktiviert wird.
|
||||||
|
|
||||||
|
## Einbindung
|
||||||
|
|
||||||
|
Aktive Effekte können an alle Gegenstände und Hintergründe (Gunst, Makel, Legende & Schicksalsgabe) angefügt werden um Regelmechaniken abzubilden.
|
||||||
|
|
||||||
|
Vorteile für Spezifische Waffen, müssen in der Waffe selber eingestellt werden, dafür sind wie bei der Würfel Dialog die Vorteil/Nachteil buttons vorgesehen.
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- Heilen/Schaden pro runde
|
||||||
|
- Vor- & Nachteile, Bonusschaden durch Aktive Effekte für Nebenfiguren
|
||||||
@@ -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 js from "@eslint/js";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
import react from "eslint-plugin-react";
|
|
||||||
import prettier from "eslint-config-prettier";
|
import prettier from "eslint-config-prettier";
|
||||||
import globals from "globals";
|
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
{ ignores: ["dist/**", "node_modules/**"] },
|
{ ignores: ["dist/**", "node_modules/**"] },
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
{
|
prettier,
|
||||||
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
|
|
||||||
);
|
);
|
||||||
+46
-2
@@ -7,6 +7,7 @@
|
|||||||
"Fertigkeit": "Fertigkeit",
|
"Fertigkeit": "Fertigkeit",
|
||||||
"Stufe": "Stufe",
|
"Stufe": "Stufe",
|
||||||
"Schicksalsmünzen": "Schicksalsmünzen",
|
"Schicksalsmünzen": "Schicksalsmünzen",
|
||||||
|
"Traglast": "Traglast",
|
||||||
"Grad": {
|
"Grad": {
|
||||||
"grad": "Grad",
|
"grad": "Grad",
|
||||||
"frei": "frei",
|
"frei": "frei",
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
"effects": "Effekte",
|
"effects": "Effekte",
|
||||||
"zauber": "Zauber",
|
"zauber": "Zauber",
|
||||||
"biographie": "Biographie",
|
"biographie": "Biographie",
|
||||||
|
"beschreibung": "Beschreibung",
|
||||||
"hintergrund": "Hintergrund",
|
"hintergrund": "Hintergrund",
|
||||||
"sperre": "Sperre"
|
"sperre": "Sperre"
|
||||||
},
|
},
|
||||||
@@ -159,6 +161,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"NSC": {
|
||||||
|
"Größe": {
|
||||||
|
"winzig": "Winzig",
|
||||||
|
"klein": "Klein",
|
||||||
|
"normal": "Normal",
|
||||||
|
"groß": "Groß",
|
||||||
|
"riesig": "Riesig"
|
||||||
|
},
|
||||||
|
"kompetenz": {
|
||||||
|
"miserabel": "Miserabel",
|
||||||
|
"mittelmäßig": "Mittelmäßig",
|
||||||
|
"kompetent": "Sehr Gut",
|
||||||
|
"würfe": "Kompetenz Würfe",
|
||||||
|
"hinzufügen": "Kompetenz hinzufügen",
|
||||||
|
"kompetenz": "Kompetenz"
|
||||||
|
},
|
||||||
|
"angriff": {
|
||||||
|
"singular": "Angriff",
|
||||||
|
"plural": "Angriffe"
|
||||||
|
},
|
||||||
|
"merkmal": {
|
||||||
|
"singular": "Merkmal",
|
||||||
|
"plural": "Merkmale",
|
||||||
|
"hinzufügen": "Merkmal hinzufügen"
|
||||||
|
}
|
||||||
|
},
|
||||||
"RollList": {
|
"RollList": {
|
||||||
"RollMode": "Wurf-Modus"
|
"RollMode": "Wurf-Modus"
|
||||||
},
|
},
|
||||||
@@ -170,12 +198,27 @@
|
|||||||
"beschreibungChatActive": {
|
"beschreibungChatActive": {
|
||||||
"name": "Chat-Beschreibungen automatisch ausklappen",
|
"name": "Chat-Beschreibungen automatisch ausklappen",
|
||||||
"hint": "Legt fest, ob Beschreibungen von Zaubern und Co. im Chat eingeklappt angezeigt werden oder vollständig."
|
"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."
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Effect": {
|
||||||
|
"Temporary": "Temporär",
|
||||||
|
"Passive": "Passiv",
|
||||||
|
"Inactive": "Inaktiv",
|
||||||
|
"ToggleOn": "Aktivieren",
|
||||||
|
"ToggleOff": "Deaktivieren"
|
||||||
|
},
|
||||||
|
"Warnings": {
|
||||||
|
"maxSpezReached": "Die Maximale Anzahl erlaubter Spezialisierungen für einen Skill sind erreicht"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
"Actor": {
|
"Actor": {
|
||||||
"character": "Charakter"
|
"character": "Charakter",
|
||||||
|
"nsc": "Nebenfigur"
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": "Gegenstand",
|
"item": "Gegenstand",
|
||||||
@@ -186,7 +229,8 @@
|
|||||||
"makel": "Makel",
|
"makel": "Makel",
|
||||||
"schicksalsgabe": "Schicksalsgabe",
|
"schicksalsgabe": "Schicksalsgabe",
|
||||||
"legende": "Legende",
|
"legende": "Legende",
|
||||||
"geld": "Geld"
|
"geld": "Geld",
|
||||||
|
"merkmal": "Merkmal"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+552
-4620
File diff suppressed because it is too large.
Load diff
+1
-6
@@ -17,20 +17,15 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.39.4",
|
"@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",
|
"archiver": "^8.0.0",
|
||||||
"eslint": "^9.39.4",
|
"eslint": "^9.39.4",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
|
||||||
"fvtt-types": "^13.346.0-beta.20250812191140",
|
"fvtt-types": "^13.346.0-beta.20250812191140",
|
||||||
"globals": "^17.7.0",
|
"globals": "^17.7.0",
|
||||||
"prettier": "^3.8.4",
|
"prettier": "^3.8.4",
|
||||||
"sass": "^1.101.0",
|
"sass": "^1.101.0",
|
||||||
"typescript": "^5.6.0",
|
"typescript": "^5.6.0",
|
||||||
"typescript-eslint": "^8.62.0",
|
"typescript-eslint": "^8.62.0",
|
||||||
"vite": "^5.4.0",
|
"vite": "^5.4.0"
|
||||||
"vitest": "^4.1.9"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-16
@@ -2,7 +2,6 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { ZipArchive } from "archiver";
|
import { ZipArchive } from "archiver";
|
||||||
|
|
||||||
// Pfade definieren
|
|
||||||
const GITEA_URL = process.env.GITEA_URL;
|
const GITEA_URL = process.env.GITEA_URL;
|
||||||
const REPO = process.env.GITEA_REPOSITORY;
|
const REPO = process.env.GITEA_REPOSITORY;
|
||||||
const RELEASE_TAG = process.env.GITEA_REF_NAME || "v1.0.0";
|
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"));
|
const systemJson = JSON.parse(fs.readFileSync(systemJsonPath, "utf8"));
|
||||||
|
|
||||||
systemJson.version = cleanVersion;
|
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`;
|
systemJson.download = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/midgard6-lvd.zip`;
|
||||||
|
|
||||||
fs.writeFileSync(systemJsonPath, JSON.stringify(systemJson, null, 2));
|
fs.writeFileSync(systemJsonPath, JSON.stringify(systemJson, null, 2));
|
||||||
console.log(
|
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 {
|
} else {
|
||||||
console.error(`\x1b[31m❌ system.json nicht gefunden unter: ${systemJsonPath}\x1b[0m`);
|
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));
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||||
console.log(
|
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 {
|
} else {
|
||||||
console.log(`\x1b[33m⚠️ package.json nicht gefunden – Schritt übersprungen.\x1b[0m`);
|
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.pipe(stream);
|
||||||
archive.directory(sourceDir, false);
|
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");
|
const zipTmpDir = path.resolve("./build-zip");
|
||||||
|
|
||||||
if (fs.existsSync(zipTmpDir)) {
|
if (fs.existsSync(zipTmpDir)) {
|
||||||
@@ -69,14 +67,7 @@ if (fs.existsSync(zipTmpDir)) {
|
|||||||
}
|
}
|
||||||
fs.mkdirSync(zipTmpDir);
|
fs.mkdirSync(zipTmpDir);
|
||||||
|
|
||||||
// Passe diese Liste an! Da Vite in "dist" baut, müssen die Pfade eventuell dorthin zeigen
|
const filesToInclude = ["system.json", "templates", "dist", "lang", "assets"];
|
||||||
// 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"
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const file of filesToInclude) {
|
for (const file of filesToInclude) {
|
||||||
if (fs.existsSync(file)) {
|
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");
|
await zipDirectory(zipTmpDir, "./midgard6-lvd.zip");
|
||||||
console.log("\x1b[32m✅ system.zip wurde erfolgreich generiert.\x1b[0m");
|
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 });
|
fs.rmSync(zipTmpDir, { recursive: true, force: true });
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { SKILLS_CONFIG } from "../data/fields/skill-fields.mjs";
|
||||||
|
|
||||||
|
export class M6ActiveEffect extends ActiveEffect {
|
||||||
|
/** @override */
|
||||||
|
static applyChange(targetDoc, change, options) {
|
||||||
|
const originalKey = change.key?.trim().toLowerCase();
|
||||||
|
|
||||||
|
if (originalKey && originalKey.startsWith("@")) {
|
||||||
|
const parts = originalKey.slice(1).split(".");
|
||||||
|
const target = parts[0];
|
||||||
|
const subField = parts[1];
|
||||||
|
|
||||||
|
let finalPath = null;
|
||||||
|
|
||||||
|
const globalPaths = {
|
||||||
|
rüstwert: subField ? `system.rüstwert.${subField}` : "system.rüstwert.base",
|
||||||
|
|
||||||
|
reflexe: subField
|
||||||
|
? `system.resistenzen.reflexe.${subField}`
|
||||||
|
: "system.resistenzen.reflexe.value",
|
||||||
|
willenskraft: subField
|
||||||
|
? `system.resistenzen.willenskraft.${subField}`
|
||||||
|
: "system.resistenzen.willenskraft.value",
|
||||||
|
zähigkeit: subField
|
||||||
|
? `system.resistenzen.zähigkeit.${subField}`
|
||||||
|
: "system.resistenzen.zähigkeit.value",
|
||||||
|
|
||||||
|
schaden: "system.bonuses.schaden",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (globalPaths[target]) {
|
||||||
|
finalPath = globalPaths[target];
|
||||||
|
} else {
|
||||||
|
if (!this._skillPathCache) {
|
||||||
|
this._skillPathCache = {};
|
||||||
|
for (const [category, skills] of Object.entries(SKILLS_CONFIG)) {
|
||||||
|
for (const skill of skills) {
|
||||||
|
this._skillPathCache[skill.toLowerCase()] = `system.skills.${category}.${skill}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const skillBasePath = this._skillPathCache[target];
|
||||||
|
if (skillBasePath) {
|
||||||
|
const field = subField || "value";
|
||||||
|
finalPath = `${skillBasePath}.${field}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalPath) {
|
||||||
|
const modifiedChange = foundry.utils.mergeObject({}, change);
|
||||||
|
modifiedChange.key = finalPath;
|
||||||
|
|
||||||
|
console.log(`System V14 | AE Key übersetzt: ${originalKey} -> ${modifiedChange.key}`);
|
||||||
|
|
||||||
|
return super.applyChange(targetDoc, modifiedChange, options);
|
||||||
|
} else {
|
||||||
|
console.error(
|
||||||
|
`System V14 | Das Kürzel "${target}" existiert weder in den Resistenzen noch in den Skills.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.applyChange(targetDoc, change, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
+74
-302
@@ -1,5 +1,37 @@
|
|||||||
|
import { SKILLS_CONFIG } from "./fields/skill-fields.mjs";
|
||||||
|
|
||||||
function defineSchema() {
|
function defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
|
const createSkillField = (skillName) => {
|
||||||
|
return new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
max: 15,
|
||||||
|
min: 5,
|
||||||
|
initial: 5,
|
||||||
|
label: skillName,
|
||||||
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
bonuses: new fields.ArrayField(new fields.ObjectField()),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const skillsSchemaFields = Object.entries(SKILLS_CONFIG).reduce(
|
||||||
|
(categories, [categoryName, skillList]) => {
|
||||||
|
const categorySkills = skillList.reduce((skills, skillName) => {
|
||||||
|
skills[skillName] = createSkillField(skillName);
|
||||||
|
return skills;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
categories[categoryName] = new fields.SchemaField(categorySkills, { label: categoryName });
|
||||||
|
return categories;
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
locked: new fields.BooleanField({ initial: false }),
|
locked: new fields.BooleanField({ initial: false }),
|
||||||
biographie: new fields.SchemaField({
|
biographie: new fields.SchemaField({
|
||||||
@@ -8,370 +40,110 @@ function defineSchema() {
|
|||||||
glaube: new fields.StringField({ initial: "" }),
|
glaube: new fields.StringField({ initial: "" }),
|
||||||
spezies: new fields.StringField({ initial: "" }),
|
spezies: new fields.StringField({ initial: "" }),
|
||||||
kultur: new fields.StringField({ initial: "" }),
|
kultur: new fields.StringField({ initial: "" }),
|
||||||
beschreibung: new fields.HTMLField({ initial: "" })
|
beschreibung: new fields.HTMLField({ initial: "" }),
|
||||||
}),
|
}),
|
||||||
legende: new fields.HTMLField({ initial: "" }),
|
|
||||||
schicksalsmünzen: new fields.NumberField({ initial: 3, min: 0, required: true }),
|
schicksalsmünzen: new fields.NumberField({ initial: 3, min: 0, required: true }),
|
||||||
grad: new fields.SchemaField({
|
grad: new fields.SchemaField({
|
||||||
erfahrungspunkteFrei: new fields.NumberField({
|
erfahrungspunkteFrei: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
erfahrungspunkteEingesetzt: new fields.NumberField({
|
erfahrungspunkteEingesetzt: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
erfahrungsschatz: new fields.NumberField({
|
erfahrungsschatz: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
grad: new fields.NumberField({
|
grad: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 1,
|
min: 1,
|
||||||
initial: 1
|
initial: 1,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
rüstwert: new fields.SchemaField({
|
rüstwert: new fields.SchemaField({
|
||||||
base: new fields.NumberField({
|
base: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 0
|
initial: 0,
|
||||||
}),
|
}),
|
||||||
mod: new fields.NumberField({
|
mod: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 0
|
initial: 0,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
resources: new fields.SchemaField({
|
resources: new fields.SchemaField({
|
||||||
leben: new fields.SchemaField({
|
leben: new fields.SchemaField({
|
||||||
value: new fields.NumberField({
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
max: new fields.NumberField({
|
max: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 8
|
initial: 8,
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
ausdauer: new fields.SchemaField({
|
ausdauer: new fields.SchemaField({
|
||||||
value: new fields.NumberField({
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
max: new fields.NumberField({
|
max: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: 44
|
initial: 44,
|
||||||
})
|
}),
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
resistenzen: new fields.SchemaField(
|
resistenzen: new fields.SchemaField(
|
||||||
{
|
{
|
||||||
reflexe: new fields.NumberField({
|
reflexe: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
willenskraft: new fields.NumberField({
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
}),
|
||||||
|
willenskraft: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
}),
|
}),
|
||||||
zähigkeit: new fields.NumberField({
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
}),
|
||||||
|
zähigkeit: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
min: 0,
|
min: 0,
|
||||||
initial: 4
|
initial: 4,
|
||||||
})
|
}),
|
||||||
|
vorteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
nachteil: new fields.NumberField({ min: 0, initial: 0 }),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{ label: "resistenzen" }
|
{ label: "resistenzen" },
|
||||||
),
|
),
|
||||||
skills: new fields.SchemaField({
|
skills: new fields.SchemaField(skillsSchemaFields),
|
||||||
kampf: new fields.SchemaField(
|
bonuses: new fields.SchemaField({
|
||||||
{
|
schaden: new fields.ArrayField(
|
||||||
anführen: new fields.SchemaField({
|
new fields.AnyField({
|
||||||
value: new fields.NumberField({
|
initial: {},
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "anführen"
|
|
||||||
}),
|
}),
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
{ initial: [] },
|
||||||
}),
|
|
||||||
fernkampf: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "fernkampf"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
nahkampf: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "nahkampf"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "kampf" }
|
|
||||||
),
|
),
|
||||||
körper: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
athletik: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "athletik"
|
|
||||||
}),
|
}),
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
beweglichkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "beweglichkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
fingerfertigkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "fingerfertigkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
heimlichkeit: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "heimlichkeit"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
wahrnehmung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "wahrnehmung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "körper" }
|
|
||||||
),
|
|
||||||
ausdruck: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
darbietung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "darbietung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
einschüchterung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "einschüchterung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
empathie: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "empathie"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
gassenwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "gassenwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
manipulation: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "manipulation"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
überzeugen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "überzeugen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "ausdruck" }
|
|
||||||
),
|
|
||||||
geist: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
bildung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "bildung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
handwerk: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "handwerk"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
heilkunst: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "heilkunst"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
kulturwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "kulturwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
tierführung: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "tierführung"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
überlebenskunst: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "überlebenskunst"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "geist" }
|
|
||||||
),
|
|
||||||
magie: new fields.SchemaField(
|
|
||||||
{
|
|
||||||
thaumaturgie: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "thaumaturgie"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
zaubern: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "zaubern"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
}),
|
|
||||||
zauberwissen: new fields.SchemaField({
|
|
||||||
value: new fields.NumberField({
|
|
||||||
required: true,
|
|
||||||
nullable: false,
|
|
||||||
max: 15,
|
|
||||||
min: 5,
|
|
||||||
initial: 5,
|
|
||||||
label: "zauberwissen"
|
|
||||||
}),
|
|
||||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{ label: "magie" }
|
|
||||||
)
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
export const SKILLS_CONFIG = {
|
||||||
|
kampf: ["anführen", "fernkampf", "nahkampf"],
|
||||||
|
körper: ["athletik", "beweglichkeit", "fingerfertigkeit", "heimlichkeit", "wahrnehmung"],
|
||||||
|
ausdruck: [
|
||||||
|
"darbietung",
|
||||||
|
"einschüchterung",
|
||||||
|
"empathie",
|
||||||
|
"gassenwissen",
|
||||||
|
"manipulation",
|
||||||
|
"überzeugen",
|
||||||
|
],
|
||||||
|
geist: ["bildung", "handwerk", "heilkunst", "kulturwissen", "tierführung", "überlebenskunst"],
|
||||||
|
magie: ["thaumaturgie", "zaubern", "zauberwissen"],
|
||||||
|
};
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
function defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
locked: new fields.BooleanField({ initial: false }),
|
||||||
|
biographie: new fields.SchemaField({
|
||||||
|
spezies: new fields.StringField({ initial: "" }),
|
||||||
|
kultur: new fields.StringField({ initial: "" }),
|
||||||
|
beschreibung: new fields.HTMLField({ initial: "" }),
|
||||||
|
}),
|
||||||
|
größe: new fields.StringField({ initial: "normal" }),
|
||||||
|
kompetenz: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
integer: true,
|
||||||
|
initial: 1,
|
||||||
|
max: 10,
|
||||||
|
min: 0,
|
||||||
|
}),
|
||||||
|
resources: new fields.SchemaField({
|
||||||
|
leben: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
max: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 8,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
ausdauer: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
max: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 44,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
resistenzen: new fields.SchemaField(
|
||||||
|
{
|
||||||
|
reflexe: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: -1,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
willenskraft: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
zähigkeit: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: 1,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ label: "resistenzen" },
|
||||||
|
),
|
||||||
|
rüstwert: new fields.SchemaField({
|
||||||
|
base: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
mod: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
merkmale: new fields.ArrayField(new fields.StringField({}), { initial: [] }),
|
||||||
|
angriffe: new fields.ArrayField(new fields.ObjectField({}), { initial: [] }),
|
||||||
|
fertigkeiten: new fields.ArrayField(new fields.ObjectField({}), { initial: [] }),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NSCData extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema = defineSchema;
|
||||||
|
}
|
||||||
@@ -8,7 +8,8 @@ function defineSchema() {
|
|||||||
equipped: new fields.BooleanField({ inital: false }),
|
equipped: new fields.BooleanField({ inital: false }),
|
||||||
fertigkeit: new fields.StringField({ initial: "system.skills.kampf.nahkampf" }),
|
fertigkeit: new fields.StringField({ initial: "system.skills.kampf.nahkampf" }),
|
||||||
spezialisierung: new fields.StringField({ initial: "" }),
|
spezialisierung: new fields.StringField({ initial: "" }),
|
||||||
customRoll: new fields.StringField({ initial: "" })
|
customRoll: new fields.StringField({ initial: "" }),
|
||||||
|
angriffMod: new fields.NumberField({ initial: 0, required: true, step: 1 }),
|
||||||
};
|
};
|
||||||
|
|
||||||
return Object.assign(baseData, extendData);
|
return Object.assign(baseData, extendData);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export const loadSettings = async function () {
|
|||||||
game.settings.register("midgard6-lvd", "zauberAlsTag", {
|
game.settings.register("midgard6-lvd", "zauberAlsTag", {
|
||||||
name: game.i18n.localize("Midgard6.Settings.zauberAlsTag.name"),
|
name: game.i18n.localize("Midgard6.Settings.zauberAlsTag.name"),
|
||||||
hint: game.i18n.localize("Midgard6.Settings.zauberAlsTag.hint"),
|
hint: game.i18n.localize("Midgard6.Settings.zauberAlsTag.hint"),
|
||||||
scope: "user",
|
scope: "client",
|
||||||
config: true,
|
config: true,
|
||||||
default: false,
|
default: false,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -18,13 +18,13 @@ export const loadSettings = async function () {
|
|||||||
type: Boolean
|
type: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register("midgard6-lvd", "beschreibungChatActive", {
|
game.settings.register("midgard6-lvd", "maxSpezialisierung", {
|
||||||
name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"),
|
name: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.name"),
|
||||||
hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"),
|
hint: game.i18n.localize("Midgard6.Settings.maxSpezialisierung.hint"),
|
||||||
scope: "client",
|
scope: "world",
|
||||||
config: true,
|
config: true,
|
||||||
default: false,
|
default: 3,
|
||||||
type: Boolean
|
type: Number
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register("midgard6-lvd", "colorSuccessBg", {
|
game.settings.register("midgard6-lvd", "colorSuccessBg", {
|
||||||
|
|||||||
@@ -27,19 +27,19 @@ export function prepareActiveEffectCategories(effects) {
|
|||||||
const categories = {
|
const categories = {
|
||||||
temporary: {
|
temporary: {
|
||||||
type: "temporary",
|
type: "temporary",
|
||||||
label: game.i18n.localize("M6.Effect.Temporary"),
|
label: game.i18n.localize("Midgard6.Effect.Temporary"),
|
||||||
effects: []
|
effects: [],
|
||||||
},
|
},
|
||||||
passive: {
|
passive: {
|
||||||
type: "passive",
|
type: "passive",
|
||||||
label: game.i18n.localize("M6.Effect.Passive"),
|
label: game.i18n.localize("Midgard6.Effect.Passive"),
|
||||||
effects: []
|
effects: [],
|
||||||
},
|
},
|
||||||
inactive: {
|
inactive: {
|
||||||
type: "inactive",
|
type: "inactive",
|
||||||
label: game.i18n.localize("M6.Effect.Inactive"),
|
label: game.i18n.localize("Midgard6.Effect.Inactive"),
|
||||||
effects: []
|
effects: [],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Iterate over active effects, classifying them into categories
|
// Iterate over active effects, classifying them into categories
|
||||||
|
|||||||
@@ -0,0 +1,611 @@
|
|||||||
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the basic ActorSheet with some very simple modifications.
|
||||||
|
*/
|
||||||
|
export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) {
|
||||||
|
/** @inheritdoc */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["M6", "actor"],
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
width: 800,
|
||||||
|
height: 800,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
viewDoc: this.#viewDoc,
|
||||||
|
createDoc: this.#createDoc,
|
||||||
|
deleteDoc: this.#deleteDoc,
|
||||||
|
toggleEffect: this.#toggleEffect,
|
||||||
|
increaseDoc: this.#increaseDoc,
|
||||||
|
decreaseDoc: this.#decreaseDoc,
|
||||||
|
cycleLock: this.#cycleLock,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [],
|
||||||
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static PARTS = {};
|
||||||
|
|
||||||
|
_attachPartListeners(partId, html, bubble) {
|
||||||
|
super._attachPartListeners(partId, html, bubble);
|
||||||
|
|
||||||
|
const collapsible = html.querySelectorAll("[data-action=collapsible]");
|
||||||
|
if (collapsible) {
|
||||||
|
collapsible.forEach((node) => {
|
||||||
|
node.addEventListener(
|
||||||
|
"click",
|
||||||
|
function (e) {
|
||||||
|
e = window.event || e;
|
||||||
|
|
||||||
|
if (this === e.target) {
|
||||||
|
const header = node.closest("div[data-action=collapsible]");
|
||||||
|
header.classList.toggle("active");
|
||||||
|
const content = header.nextElementSibling;
|
||||||
|
content.classList.toggle("active");
|
||||||
|
const icon = node.closest(".fa-expand") || node.getElementsByTagName("i")[0];
|
||||||
|
icon.classList.toggle("fa-compress");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ capture: true },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
_initializeApplicationOptions(options) {
|
||||||
|
const initialized = super._initializeApplicationOptions(options);
|
||||||
|
|
||||||
|
initialized.classes.push(initialized.document.type);
|
||||||
|
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _prepareContext(options) {
|
||||||
|
const context = await super._prepareContext(options);
|
||||||
|
|
||||||
|
Object.assign(context, {
|
||||||
|
owner: this.document.isOwner,
|
||||||
|
limited: this.document.limited,
|
||||||
|
actor: this.actor,
|
||||||
|
system: this.actor.system,
|
||||||
|
flags: this.actor.flags,
|
||||||
|
config: CONFIG,
|
||||||
|
});
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the system fields for the form-fields generic.
|
||||||
|
* @returns {object[]}
|
||||||
|
*/
|
||||||
|
async _getFields() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields;
|
||||||
|
const fieldSets = [];
|
||||||
|
// TODO: Find a clever way to handle enrichment
|
||||||
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
|
const path = `system.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
const fieldset = { fieldset: true, legend: field.label, fields: [] };
|
||||||
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
fieldSets.push(fieldset);
|
||||||
|
} else {
|
||||||
|
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively add system model fields to the fieldset.
|
||||||
|
*/
|
||||||
|
async #addSystemFields(fieldset, schema, source, _path = "system") {
|
||||||
|
for (const field of Object.values(schema)) {
|
||||||
|
const path = `${_path}.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
} else if (field.constructor.hasFormSupport) {
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from Actor#itemTypes.
|
||||||
|
*/
|
||||||
|
_getItems() {
|
||||||
|
const types = Object.fromEntries(
|
||||||
|
game.documentTypes.Item.map((t) => {
|
||||||
|
return [t, { label: game.i18n.localize(CONFIG.Item.typeLabels[t]), items: [] }];
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
for (const item of this.actor.items) {
|
||||||
|
types[item.type].items.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of this.actor.items) {
|
||||||
|
types[item.type].items.sort((a, b) => a.sort - b.sort);
|
||||||
|
}
|
||||||
|
// Only show Base if it's actually being used
|
||||||
|
if (types.base.items.length === 0) delete types.base;
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static async #cycleLock(event) {
|
||||||
|
const actor = this.actor;
|
||||||
|
|
||||||
|
// Update the locked state
|
||||||
|
actor.update({ "system.locked": !actor.system.locked });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions performed after any render of the Application.
|
||||||
|
* Post-render steps are not awaited by the render process.
|
||||||
|
* @param {ApplicationRenderContext} context Prepared context data.
|
||||||
|
* @param {RenderOptions} options Provided render options.
|
||||||
|
* @protected
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async _onRender(context, options) {
|
||||||
|
await super._onRender(context, options);
|
||||||
|
this.#disableOverrides();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Event handlers */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static async #increaseDoc(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
if (event.shiftKey || event.ctrlKey) {
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl += 10) });
|
||||||
|
}
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl += 1) });
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #decreaseDoc(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
if (event.shiftKey || event.ctrlKey) {
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 10) });
|
||||||
|
}
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 1) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders an embedded document's sheet.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #viewDoc(event, target) {
|
||||||
|
const doc = this._getEmbeddedDocument(target);
|
||||||
|
doc.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles item deletion.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #deleteDoc(event, target) {
|
||||||
|
const doc = this._getEmbeddedDocument(target);
|
||||||
|
doc.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #createDoc(event, target) {
|
||||||
|
const docCls = getDocumentClass(target.dataset.documentClass);
|
||||||
|
const docData = {
|
||||||
|
name: docCls.defaultName({
|
||||||
|
type: target.dataset.type,
|
||||||
|
parent: this.actor,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
|
foundry.utils.setProperty(docData, dataKey, value);
|
||||||
|
}
|
||||||
|
const doc = await docCls.create(docData, { parent: this.actor });
|
||||||
|
doc.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines effect parent to pass to helper.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #toggleEffect(event, target) {
|
||||||
|
const effect = this._getEmbeddedDocument(target);
|
||||||
|
effect.update({ disabled: !effect.disabled });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Helper functions */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the embedded document representing the containing HTML element.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} target The element subject to search.
|
||||||
|
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
||||||
|
*/
|
||||||
|
_getEmbeddedDocument(target) {
|
||||||
|
const docRow = target.closest("[data-document-class]");
|
||||||
|
if (docRow.dataset.documentClass === "Item") {
|
||||||
|
return this.actor.items.get(docRow.dataset.itemId);
|
||||||
|
} else if (docRow.dataset.documentClass === "ActiveEffect") {
|
||||||
|
const parent =
|
||||||
|
docRow.dataset.parentId === this.actor.id
|
||||||
|
? this.actor
|
||||||
|
: this.actor.items.get(docRow?.dataset.parentId);
|
||||||
|
return parent.effects.get(docRow.dataset.effectId);
|
||||||
|
} else {
|
||||||
|
console.warn("Could not find document class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Actor override handling */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a document update based on the processed form data.
|
||||||
|
* @param {SubmitEvent} event The originating form submission event.
|
||||||
|
* @param {HTMLFormElement} form The form element that was submitted.
|
||||||
|
* @param {object} submitData Processed and validated form data to be used for a document update.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async _processSubmitData(event, form, submitData) {
|
||||||
|
const overrides = foundry.utils.flattenObject(this.actor.overrides);
|
||||||
|
for (const k of Object.keys(overrides)) delete submitData[k];
|
||||||
|
this.document.update(submitData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables inputs subject to active effects.
|
||||||
|
*/
|
||||||
|
#disableOverrides() {
|
||||||
|
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
||||||
|
for (const override of Object.keys(flatOverrides)) {
|
||||||
|
const input = this.element.querySelector(`[name="${override}"]`);
|
||||||
|
if (input) input.disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Drag and drop */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for dragging.
|
||||||
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragStart(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for the drop target.
|
||||||
|
* @returns {boolean} Can the current user drop on this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragDrop(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const li = event.currentTarget;
|
||||||
|
const dataset = event.target.dataset;
|
||||||
|
|
||||||
|
if ("link" in event.target.dataset) return;
|
||||||
|
|
||||||
|
let dragData = null;
|
||||||
|
|
||||||
|
if (li.dataset.effectId) {
|
||||||
|
const effect = this.item.effects.get(li.dataset.effectId);
|
||||||
|
dragData = effect.toDragData();
|
||||||
|
}
|
||||||
|
|
||||||
|
dragData = {
|
||||||
|
type: dataset.type,
|
||||||
|
itemId: dataset.itemId,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!dragData) return;
|
||||||
|
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
|
const item = this.item;
|
||||||
|
|
||||||
|
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||||
|
if (allowed === false) return;
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "ActiveEffect":
|
||||||
|
return this._onDropActiveEffect(event, data);
|
||||||
|
case "Actor":
|
||||||
|
return this._onDropActor(event, data);
|
||||||
|
case "Item":
|
||||||
|
return this._onDropItem(event, data);
|
||||||
|
case "Folder":
|
||||||
|
return this._onDropFolder(event, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActiveEffect(event, data) {
|
||||||
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
|
const effect = await aeCls.fromDropData(data);
|
||||||
|
if (!this.item.isOwner || !effect) return false;
|
||||||
|
|
||||||
|
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
||||||
|
aeCls.create(effect, { parent: this.item });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts an Active Effect based on its surrounding attributes.
|
||||||
|
*
|
||||||
|
* @param {DragEvent} event
|
||||||
|
* @param {ActiveEffect} effect
|
||||||
|
*/
|
||||||
|
_onEffectSort(event, effect) {
|
||||||
|
const effects = this.item.effects;
|
||||||
|
const dropTarget = event.target.closest("[data-effect-id]");
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = effects.get(dropTarget.dataset.effectId);
|
||||||
|
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (effect.id === target.id) return;
|
||||||
|
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.effectId;
|
||||||
|
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
|
target,
|
||||||
|
siblings,
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target._id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an Actor data onto another Actor sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
||||||
|
* not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActor(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
async _onDropItemCreate(actor, itemData) {
|
||||||
|
itemData = itemData instanceof Array ? itemData : [itemData];
|
||||||
|
return actor.createEmbeddedDocuments("Item", itemData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropItem(event, data) {
|
||||||
|
if (!this.actor.isOwner) return false;
|
||||||
|
if (this.actor.items.get(data.itemId)) return this._onSortItem(event, data);
|
||||||
|
|
||||||
|
const item = await Item.implementation.fromDropData(data);
|
||||||
|
const itemData = item.toObject();
|
||||||
|
|
||||||
|
return this._onDropItemCreate(this.actor, itemData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a drop event for an existing embedded Item to sort that Item relative to its siblings
|
||||||
|
* @param {Event} event
|
||||||
|
* @param {Item} item
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_onSortItem(event, item) {
|
||||||
|
// Get the drag source and drop target
|
||||||
|
const items = this.actor.items;
|
||||||
|
const dropTarget = event.target.closest("[data-item-id]");
|
||||||
|
const source = items.get(item.itemId);
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = items.get(dropTarget.dataset.itemId);
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (source.id === target.id) return;
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.itemId;
|
||||||
|
if (siblingId && siblingId !== source.id) siblings.push(items.get(siblingId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(source, {
|
||||||
|
target,
|
||||||
|
siblings,
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target.id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
return this.actor.updateEmbeddedDocuments("Item", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of a Folder on an Actor Sheet.
|
||||||
|
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropFolder(event, data) {
|
||||||
|
if (!this.item.isOwner) return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* The following pieces set up drag */
|
||||||
|
/* handling and are unlikely to need modification */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
// This is marked as private because there's no real need
|
||||||
|
// for subclasses or external hooks to mess with it directly
|
||||||
|
#dragDrop = this.#createDragDropHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of DragDrop instances.
|
||||||
|
* @type {DragDrop[]}
|
||||||
|
*/
|
||||||
|
get dragDrop() {
|
||||||
|
return this.#dragDrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application.
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this),
|
||||||
|
};
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this),
|
||||||
|
};
|
||||||
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-18
@@ -13,8 +13,8 @@ export class M6ArmorSheet extends M6ItemSheet {
|
|||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions,
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
cycleEquip: this.#cycleEquip, // Fügt NUR für dieses Sheet die neue Action hinzu
|
cycleEquip: this.#cycleEquip, // Fügt NUR für dieses Sheet die neue Action hinzu
|
||||||
cycleHelmet: this.#cycleHelmet
|
cycleHelmet: this.#cycleHelmet,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,57 +23,57 @@ export class M6ArmorSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "effects",
|
id: "effects",
|
||||||
icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/item/rüstung/eigenschaften.hbs"),
|
template: systemPath("templates/item/rüstung/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static #cycleEquip() {
|
static #cycleEquip() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !this.item.system.equipped
|
equipped: !this.item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static #cycleHelmet() {
|
static #cycleHelmet() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
zusätzlich: !this.item.system.zusätzlich
|
zusätzlich: !this.item.system.zusätzlich,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+44
-584
@@ -2,44 +2,29 @@ import { systemPath } from "../constants.mjs";
|
|||||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
||||||
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
||||||
import { rollSpell, rollWeapon, rollSkill } from "./components/roll-actions.mjs";
|
import { roll } from "./components/roll-actions.mjs";
|
||||||
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
import { SKILLS_CONFIG } from "../data/fields/skill-fields.mjs";
|
||||||
|
|
||||||
const { api, sheets } = foundry.applications;
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the basic ActorSheet with some very simple modifications.
|
* Extend the M6ActorSheet.
|
||||||
*/
|
*/
|
||||||
export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) {
|
export class M6CharacterSheet extends M6ActorSheet {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static get DEFAULT_OPTIONS() {
|
||||||
classes: ["M6", "actor"],
|
return {
|
||||||
window: {
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Options aus M6ActorSheet
|
||||||
resizable: true
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
width: 800,
|
|
||||||
height: 800
|
|
||||||
},
|
|
||||||
actions: {
|
actions: {
|
||||||
viewDoc: this.#viewDoc,
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
createDoc: this.#createDoc,
|
|
||||||
deleteDoc: this.#deleteDoc,
|
|
||||||
toggleEffect: this.#toggleEffect,
|
|
||||||
rollSkill: rollSkill,
|
|
||||||
rollWeapon: rollWeapon,
|
|
||||||
rollSpell: rollSpell,
|
|
||||||
cycleEquip: this.#cycleEquip,
|
cycleEquip: this.#cycleEquip,
|
||||||
cycleLock: this.#cycleLock,
|
roll: roll,
|
||||||
addSpezialisierung: addSpezialisierung,
|
addSpezialisierung: addSpezialisierung,
|
||||||
editSepzialisierung: editSepzialisierung,
|
editSepzialisierung: editSepzialisierung,
|
||||||
increaseDoc: this.#increaseDoc,
|
|
||||||
decreaseDoc: this.#decreaseDoc
|
|
||||||
},
|
},
|
||||||
form: {
|
|
||||||
submitOnChange: true
|
|
||||||
},
|
|
||||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
@@ -48,33 +33,32 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "items",
|
id: "items",
|
||||||
icon: "fa-suitcase"
|
icon: "fa-suitcase",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "zauber",
|
id: "zauber",
|
||||||
icon: "fa-hand-sparkles"
|
icon: "fa-hand-sparkles",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "hintergrund",
|
id: "hintergrund",
|
||||||
icon: "fa-list"
|
icon: "fa-list",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "biographie",
|
id: "biographie",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "effects",
|
id: "effects",
|
||||||
icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -82,71 +66,36 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/actor/header.hbs")
|
template: systemPath("templates/actor/header.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/actor/eigenschaften.hbs"),
|
template: systemPath("templates/actor/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
zauber: {
|
zauber: {
|
||||||
template: systemPath("templates/actor/zauber.hbs"),
|
template: systemPath("templates/actor/zauber.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
items: {
|
items: {
|
||||||
template: systemPath("templates/actor/items.hbs"),
|
template: systemPath("templates/actor/items.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
hintergrund: {
|
hintergrund: {
|
||||||
template: systemPath("templates/actor/hintergrund.hbs"),
|
template: systemPath("templates/actor/hintergrund.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
biographie: {
|
biographie: {
|
||||||
template: systemPath("templates/actor/biographie.hbs"),
|
template: systemPath("templates/actor/biographie.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_attachPartListeners(partId, html, bubble) {
|
|
||||||
super._attachPartListeners(partId, html, bubble);
|
|
||||||
|
|
||||||
switch (partId) {
|
|
||||||
case "hintergrund":
|
|
||||||
const collapsible = html.querySelectorAll("div[data-action=collapsible]");
|
|
||||||
if (collapsible) {
|
|
||||||
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");
|
|
||||||
},
|
},
|
||||||
{ capture: true }
|
};
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/** @inheritdoc */
|
|
||||||
_initializeApplicationOptions(options) {
|
|
||||||
const initialized = super._initializeApplicationOptions(options);
|
|
||||||
|
|
||||||
initialized.classes.push(initialized.document.type);
|
|
||||||
|
|
||||||
return initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
@@ -161,9 +110,10 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
system: this.actor.system,
|
system: this.actor.system,
|
||||||
skills: this.actor.system.skills,
|
skills: this.actor.system.skills,
|
||||||
flags: this.actor.flags,
|
flags: this.actor.flags,
|
||||||
config: CONFIG
|
config: CONFIG,
|
||||||
});
|
});
|
||||||
console.warn(context);
|
|
||||||
|
context.itemTypes = await super._getItems();
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,16 +135,14 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "items":
|
case "items":
|
||||||
context.itemTypes = await this._getItems();
|
|
||||||
context.gewicht = await prepWeight(this.actor);
|
context.gewicht = await prepWeight(this.actor);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "zauber":
|
case "zauber":
|
||||||
context.zauber = await this._getZauber();
|
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "hintergrund":
|
case "hintergrund":
|
||||||
context.fields = await this._getFields();
|
context.fields = await super._getFields();
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "biographie":
|
case "biographie":
|
||||||
@@ -207,8 +155,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
// Data to fill in for inline rolls
|
// Data to fill in for inline rolls
|
||||||
rollData: this.actor.getRollData(),
|
rollData: this.actor.getRollData(),
|
||||||
// Relative UUID resolution
|
// Relative UUID resolution
|
||||||
relativeTo: this.actor
|
relativeTo: this.actor,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
@@ -218,29 +166,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the system fields for the form-fields generic.
|
|
||||||
* @returns {object[]}
|
|
||||||
*/
|
|
||||||
async _getFields() {
|
|
||||||
const doc = this.actor;
|
|
||||||
const source = doc._source;
|
|
||||||
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields;
|
|
||||||
const fieldSets = [];
|
|
||||||
// TODO: Find a clever way to handle enrichment
|
|
||||||
for (const field of Object.values(systemFields ?? {})) {
|
|
||||||
const path = `system.${field.name}`;
|
|
||||||
if (field instanceof foundry.data.fields.SchemaField) {
|
|
||||||
const fieldset = { fieldset: true, legend: field.label, fields: [] };
|
|
||||||
await this.#addSystemFields(fieldset, field.fields, source, path);
|
|
||||||
fieldSets.push(fieldset);
|
|
||||||
} else {
|
|
||||||
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fieldSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
async _getSkills() {
|
async _getSkills() {
|
||||||
@@ -255,7 +180,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.Skills.gruppen.${field.label}`,
|
legend: `Midgard6.Skills.gruppen.${field.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
await this.#addSkillFields(fieldset, field.fields, source, path);
|
await this.#addSkillFields(fieldset, field.fields, source, path);
|
||||||
fieldSets.push(fieldset);
|
fieldSets.push(fieldset);
|
||||||
@@ -271,12 +196,12 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const path = `${_path}.${field.name}`;
|
const path = `${_path}.${field.name}`;
|
||||||
if (field instanceof foundry.data.fields.SchemaField) {
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
this.#addSkillFields(fieldset, field.fields, source, path);
|
this.#addSkillFields(fieldset, field.fields, source, path);
|
||||||
} else if (field.constructor.hasFormSupport) {
|
} else if (field.name === "value") {
|
||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Skills." + field.label,
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
bonuses: foundry.utils.getProperty(source, _path).bonuses
|
bonuses: foundry.utils.getProperty(source, _path).bonuses,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,14 +216,14 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.Attribute.${systemFields.label}`,
|
legend: `Midgard6.Attribute.${systemFields.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
for (const field of Object.values(systemFields.fields ?? {})) {
|
for (const field of Object.values(systemFields.fields ?? {})) {
|
||||||
const path = `system.resistenzen.${field.name}`;
|
const path = `system.resistenzen.${field.name}`;
|
||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Resistenzen." + field.name
|
localizationName: "Midgard6.Resistenzen." + field.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return fieldset;
|
return fieldset;
|
||||||
@@ -316,7 +241,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.resources.${field.label}`,
|
legend: `Midgard6.resources.${field.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
await this.#addSystemFields(fieldset, field.fields, source, path);
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
fieldSets.push(fieldset);
|
fieldSets.push(fieldset);
|
||||||
@@ -331,18 +256,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const item = this.actor.items.get(target.dataset.itemId);
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
item.update({
|
item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !item.system.equipped
|
equipped: !item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #cycleLock(event) {
|
|
||||||
const actor = this.actor;
|
|
||||||
|
|
||||||
// Update the locked state
|
|
||||||
actor.update({ "system.locked": !actor.system.locked });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -357,7 +275,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Skills." + field.label
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,465 +283,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapted from Actor#itemTypes.
|
|
||||||
*/
|
|
||||||
_getItems() {
|
|
||||||
const types = Object.fromEntries(
|
|
||||||
game.documentTypes.Item.map((t) => {
|
|
||||||
return [t, { label: game.i18n.localize(CONFIG.Item.typeLabels[t]), items: [] }];
|
|
||||||
})
|
|
||||||
);
|
|
||||||
for (const item of this.actor.items) {
|
|
||||||
types[item.type].items.push(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const item of this.actor.items) {
|
|
||||||
types[item.type].items.sort((a, b) => a.sort - b.sort);
|
|
||||||
}
|
|
||||||
// Only show Base if it's actually being used
|
|
||||||
if (types.base.items.length === 0) delete types.base;
|
|
||||||
return types;
|
|
||||||
}
|
|
||||||
|
|
||||||
_getZauber() {
|
_getZauber() {
|
||||||
return this.actor.items.filter((item) => item.type === "zauber");
|
return this.actor.items.filter((item) => item.type === "zauber");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actions performed after any render of the Application.
|
|
||||||
* Post-render steps are not awaited by the render process.
|
|
||||||
* @param {ApplicationRenderContext} context Prepared context data.
|
|
||||||
* @param {RenderOptions} options Provided render options.
|
|
||||||
* @protected
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
async _onRender(context, options) {
|
|
||||||
await super._onRender(context, options);
|
|
||||||
this.#disableOverrides();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Event handlers */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
static async #increaseDoc(event, target) {
|
|
||||||
const item = this.actor.items.get(target.dataset.itemId);
|
|
||||||
if (event.shiftKey || event.ctrlKey) {
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl += 10) });
|
|
||||||
}
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl += 1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
static async #decreaseDoc(event, target) {
|
|
||||||
const item = this.actor.items.get(target.dataset.itemId);
|
|
||||||
if (event.shiftKey || event.ctrlKey) {
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 10) });
|
|
||||||
}
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders an embedded document's sheet.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
static async #viewDoc(event, target) {
|
|
||||||
const doc = this._getEmbeddedDocument(target);
|
|
||||||
doc.sheet.render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles item deletion.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
static async #deleteDoc(event, target) {
|
|
||||||
const doc = this._getEmbeddedDocument(target);
|
|
||||||
doc.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
static async #createDoc(event, target) {
|
|
||||||
const docCls = getDocumentClass(target.dataset.documentClass);
|
|
||||||
const docData = {
|
|
||||||
name: docCls.defaultName({
|
|
||||||
type: target.dataset.type,
|
|
||||||
parent: this.actor
|
|
||||||
})
|
|
||||||
};
|
|
||||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
|
||||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
|
||||||
foundry.utils.setProperty(docData, dataKey, value);
|
|
||||||
}
|
|
||||||
docCls.create(docData, { parent: this.actor });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines effect parent to pass to helper.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
static async #toggleEffect(event, target) {
|
|
||||||
const effect = this._getEmbeddedDocument(target);
|
|
||||||
effect.update({ disabled: !effect.disabled });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Helper functions */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the embedded document representing the containing HTML element.
|
|
||||||
*
|
|
||||||
* @param {HTMLElement} target The element subject to search.
|
|
||||||
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
|
||||||
*/
|
|
||||||
_getEmbeddedDocument(target) {
|
|
||||||
const docRow = target.closest("[data-document-class]");
|
|
||||||
if (docRow.dataset.documentClass === "Item") {
|
|
||||||
return this.actor.items.get(docRow.dataset.itemId);
|
|
||||||
} else if (docRow.dataset.documentClass === "ActiveEffect") {
|
|
||||||
const parent =
|
|
||||||
docRow.dataset.parentId === this.actor.id
|
|
||||||
? this.actor
|
|
||||||
: this.actor.items.get(docRow?.dataset.parentId);
|
|
||||||
return parent.effects.get(docRow.dataset.effectId);
|
|
||||||
} else {
|
|
||||||
console.warn("Could not find document class");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Actor override handling */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit a document update based on the processed form data.
|
|
||||||
* @param {SubmitEvent} event The originating form submission event.
|
|
||||||
* @param {HTMLFormElement} form The form element that was submitted.
|
|
||||||
* @param {object} submitData Processed and validated form data to be used for a document update.
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
* @protected
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
async _processSubmitData(event, form, submitData) {
|
|
||||||
const overrides = foundry.utils.flattenObject(this.actor.overrides);
|
|
||||||
for (const k of Object.keys(overrides)) delete submitData[k];
|
|
||||||
this.document.update(submitData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables inputs subject to active effects.
|
|
||||||
*/
|
|
||||||
#disableOverrides() {
|
|
||||||
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
|
||||||
for (const override of Object.keys(flatOverrides)) {
|
|
||||||
const input = this.element.querySelector(`[name="${override}"]`);
|
|
||||||
if (input) input.disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Drag and drop */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
|
||||||
* @param {string} selector The candidate HTML selector for dragging.
|
|
||||||
* @returns {boolean} Can the current user drag this selector?
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_canDragStart(selector) {
|
|
||||||
return this.isEditable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector.
|
|
||||||
* @param {string} selector The candidate HTML selector for the drop target.
|
|
||||||
* @returns {boolean} Can the current user drop on this selector?
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_canDragDrop(selector) {
|
|
||||||
return this.isEditable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur at the beginning of a drag start workflow.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_onDragStart(event) {
|
|
||||||
const li = event.currentTarget;
|
|
||||||
const dataset = event.target.dataset;
|
|
||||||
|
|
||||||
if ("link" in event.target.dataset) return;
|
|
||||||
|
|
||||||
let dragData = null;
|
|
||||||
|
|
||||||
if (li.dataset.effectId) {
|
|
||||||
const effect = this.item.effects.get(li.dataset.effectId);
|
|
||||||
dragData = effect.toDragData();
|
|
||||||
}
|
|
||||||
|
|
||||||
dragData = {
|
|
||||||
type: dataset.type,
|
|
||||||
itemId: dataset.itemId
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!dragData) return;
|
|
||||||
|
|
||||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur when a dragged element is over a drop target.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_onDragOver(event) {}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur when a dragged element is dropped on a target.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDrop(event) {
|
|
||||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
|
||||||
const item = this.item;
|
|
||||||
|
|
||||||
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
|
||||||
if (allowed === false) return;
|
|
||||||
// Handle different data types
|
|
||||||
switch (data.type) {
|
|
||||||
case "ActiveEffect":
|
|
||||||
return this._onDropActiveEffect(event, data);
|
|
||||||
case "Actor":
|
|
||||||
return this._onDropActor(event, data);
|
|
||||||
case "Item":
|
|
||||||
return this._onDropItem(event, data);
|
|
||||||
case "Folder":
|
|
||||||
return this._onDropFolder(event, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropActiveEffect(event, data) {
|
|
||||||
const aeCls = getDocumentClass("ActiveEffect");
|
|
||||||
const effect = await aeCls.fromDropData(data);
|
|
||||||
if (!this.item.isOwner || !effect) return false;
|
|
||||||
|
|
||||||
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
|
||||||
aeCls.create(effect, { parent: this.item });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sorts an Active Effect based on its surrounding attributes.
|
|
||||||
*
|
|
||||||
* @param {DragEvent} event
|
|
||||||
* @param {ActiveEffect} effect
|
|
||||||
*/
|
|
||||||
_onEffectSort(event, effect) {
|
|
||||||
const effects = this.item.effects;
|
|
||||||
const dropTarget = event.target.closest("[data-effect-id]");
|
|
||||||
if (!dropTarget) return;
|
|
||||||
const target = effects.get(dropTarget.dataset.effectId);
|
|
||||||
|
|
||||||
// Don't sort on yourself
|
|
||||||
if (effect.id === target.id) return;
|
|
||||||
|
|
||||||
// Identify sibling items based on adjacent HTML elements
|
|
||||||
const siblings = [];
|
|
||||||
for (let el of dropTarget.parentElement.children) {
|
|
||||||
const siblingId = el.dataset.effectId;
|
|
||||||
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the sort
|
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
|
||||||
target,
|
|
||||||
siblings
|
|
||||||
});
|
|
||||||
const updateData = sortUpdates.map((u) => {
|
|
||||||
const update = u.update;
|
|
||||||
update._id = u.target._id;
|
|
||||||
return update;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Perform the update
|
|
||||||
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of an Actor data onto another Actor sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
|
||||||
* not permitted.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropActor(event, data) {
|
|
||||||
if (!this.item.isOwner) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
async _onDropItemCreate(actor, itemData) {
|
|
||||||
itemData = itemData instanceof Array ? itemData : [itemData];
|
|
||||||
return actor.createEmbeddedDocuments("Item", itemData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropItem(event, data) {
|
|
||||||
if (!this.actor.isOwner) return false;
|
|
||||||
|
|
||||||
if (this.actor.items.get(data.itemId)) return this._onSortItem(event, data);
|
|
||||||
|
|
||||||
const item = await Item.implementation.fromDropData(data);
|
|
||||||
const itemData = item.toObject();
|
|
||||||
|
|
||||||
return this._onDropItemCreate(this.actor, itemData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a drop event for an existing embedded Item to sort that Item relative to its siblings
|
|
||||||
* @param {Event} event
|
|
||||||
* @param {Item} item
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_onSortItem(event, item) {
|
|
||||||
// Get the drag source and drop target
|
|
||||||
const items = this.actor.items;
|
|
||||||
const dropTarget = event.target.closest("[data-item-id]");
|
|
||||||
const source = items.get(item.itemId);
|
|
||||||
if (!dropTarget) return;
|
|
||||||
const target = items.get(dropTarget.dataset.itemId);
|
|
||||||
// Don't sort on yourself
|
|
||||||
if (source.id === target.id) return;
|
|
||||||
// Identify sibling items based on adjacent HTML elements
|
|
||||||
const siblings = [];
|
|
||||||
for (let el of dropTarget.parentElement.children) {
|
|
||||||
const siblingId = el.dataset.itemId;
|
|
||||||
if (siblingId && siblingId !== source.id) siblings.push(items.get(siblingId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the sort
|
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(source, {
|
|
||||||
target,
|
|
||||||
siblings
|
|
||||||
});
|
|
||||||
const updateData = sortUpdates.map((u) => {
|
|
||||||
const update = u.update;
|
|
||||||
update._id = u.target.id;
|
|
||||||
return update;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Perform the update
|
|
||||||
return this.actor.updateEmbeddedDocuments("Item", updateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of a Folder on an Actor Sheet.
|
|
||||||
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<Item[]>}
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropFolder(event, data) {
|
|
||||||
if (!this.item.isOwner) return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* The following pieces set up drag */
|
|
||||||
/* handling and are unlikely to need modification */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
// This is marked as private because there's no real need
|
|
||||||
// for subclasses or external hooks to mess with it directly
|
|
||||||
#dragDrop = this.#createDragDropHandlers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of DragDrop instances.
|
|
||||||
* @type {DragDrop[]}
|
|
||||||
*/
|
|
||||||
get dragDrop() {
|
|
||||||
return this.#dragDrop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create drag-and-drop workflow handlers for this Application.
|
|
||||||
* @returns {DragDrop[]} An array of DragDrop handlers.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
#createDragDropHandlers() {
|
|
||||||
return this.options.dragDrop.map((d) => {
|
|
||||||
d.permissions = {
|
|
||||||
dragstart: this._canDragStart.bind(this),
|
|
||||||
drop: this._canDragDrop.bind(this)
|
|
||||||
};
|
|
||||||
d.callbacks = {
|
|
||||||
dragstart: this._onDragStart.bind(this),
|
|
||||||
dragover: this._onDragOver.bind(this),
|
|
||||||
drop: this._onDrop.bind(this)
|
|
||||||
};
|
|
||||||
return new foundry.applications.ux.DragDrop(d);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
export async function prepArmor(actor) {
|
export async function prepArmor(actor) {
|
||||||
const actorData = actor.system;
|
const actorData = actor.system;
|
||||||
// 1. Basis-Wert festlegen
|
|
||||||
let baseRüstwert = actorData.rüstwert.base || 0;
|
let baseRüstwert = actorData.rüstwert.base || 0;
|
||||||
// 2. Ausgerüstete Rüstung finden und addieren
|
|
||||||
const equippedMainArmor = actor.items.filter(
|
const equippedMainArmor = actor.items.filter(
|
||||||
(i) => i.type === "armor" && i.system.equipped && !i.system.zusätzlich
|
(i) => i.type === "armor" && i.system.equipped && !i.system.zusätzlich,
|
||||||
);
|
);
|
||||||
const equippedAddArmor = actor.items.filter(
|
const equippedAddArmor = actor.items.filter(
|
||||||
(i) => i.type === "armor" && i.system.equipped && i.system.zusätzlich
|
(i) => i.type === "armor" && i.system.equipped && i.system.zusätzlich,
|
||||||
);
|
);
|
||||||
let armorBonus = Math.max(...equippedMainArmor.map((x) => x.system.rüstwert), 0);
|
let armorBonus = Math.max(...equippedMainArmor.map((x) => x.system.rüstwert), 0);
|
||||||
for (let armor of equippedAddArmor) {
|
for (let armor of equippedAddArmor) {
|
||||||
armorBonus += armor.system.rüstwert;
|
armorBonus += armor.system.rüstwert;
|
||||||
}
|
}
|
||||||
// 3. Finalen Standard-Wert berechnen
|
|
||||||
actorData.rüstwert.mod = baseRüstwert + armorBonus;
|
actorData.rüstwert.mod = baseRüstwert + armorBonus;
|
||||||
|
|
||||||
const armors = [];
|
const armors = [];
|
||||||
@@ -25,7 +22,7 @@ export async function prepArmor(actor) {
|
|||||||
name: armor.name,
|
name: armor.name,
|
||||||
rüstwert: armor.system.rüstwert,
|
rüstwert: armor.system.rüstwert,
|
||||||
img: armor.img,
|
img: armor.img,
|
||||||
id: armor.id
|
id: armor.id,
|
||||||
};
|
};
|
||||||
armors.push(w);
|
armors.push(w);
|
||||||
});
|
});
|
||||||
@@ -44,9 +41,10 @@ export async function prepWeapons(actor) {
|
|||||||
bonusValue:
|
bonusValue:
|
||||||
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
||||||
img: weapon.img,
|
img: weapon.img,
|
||||||
|
angriffMod: weapon.system.angriffMod,
|
||||||
skillPath: weapon.system.fertigkeit,
|
skillPath: weapon.system.fertigkeit,
|
||||||
path: weapon.system.fertigkeit,
|
path: weapon.system.fertigkeit,
|
||||||
id: weapon.id
|
id: weapon.id,
|
||||||
};
|
};
|
||||||
weapons.push(w);
|
weapons.push(w);
|
||||||
});
|
});
|
||||||
@@ -66,7 +64,7 @@ export async function prepSpells(actor) {
|
|||||||
img: spell.img,
|
img: spell.img,
|
||||||
skillPath: "system.skills.magie.zaubern",
|
skillPath: "system.skills.magie.zaubern",
|
||||||
path: "Zaubern",
|
path: "Zaubern",
|
||||||
id: spell.id
|
id: spell.id,
|
||||||
};
|
};
|
||||||
spells.push(w);
|
spells.push(w);
|
||||||
});
|
});
|
||||||
@@ -77,12 +75,12 @@ export async function prepWeight(actor) {
|
|||||||
const items = actor.items.filter((x) => x.system.gewicht && !x.system.equipped);
|
const items = actor.items.filter((x) => x.system.gewicht && !x.system.equipped);
|
||||||
let gewicht = items.reduce(
|
let gewicht = items.reduce(
|
||||||
(accumulator, item) => accumulator + item.system.gewicht * item.system.anzahl,
|
(accumulator, item) => accumulator + item.system.gewicht * item.system.anzahl,
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let traglast = Math.max(actor.system.skills.körper.athletik.value, 10);
|
let traglast = Math.max(actor.system.skills.körper.athletik.value, 10);
|
||||||
return {
|
return {
|
||||||
traglast,
|
traglast,
|
||||||
gewicht
|
gewicht,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
export async function prepArmor(actor) {
|
||||||
|
const actorData = actor.system;
|
||||||
|
let baseRüstwert = actorData.rüstwert.base || 0;
|
||||||
|
const equippedMainArmor = actor.items.filter(
|
||||||
|
(i) => i.type === "armor" && i.system.equipped && !i.system.zusätzlich,
|
||||||
|
);
|
||||||
|
const equippedAddArmor = actor.items.filter(
|
||||||
|
(i) => i.type === "armor" && i.system.equipped && i.system.zusätzlich,
|
||||||
|
);
|
||||||
|
let armorBonus = Math.max(...equippedMainArmor.map((x) => x.system.rüstwert), 0);
|
||||||
|
for (let armor of equippedAddArmor) {
|
||||||
|
armorBonus += armor.system.rüstwert;
|
||||||
|
}
|
||||||
|
actorData.rüstwert.mod = baseRüstwert + armorBonus;
|
||||||
|
|
||||||
|
const armors = [];
|
||||||
|
const einschränkungen = [];
|
||||||
|
[...equippedMainArmor, ...equippedAddArmor]?.forEach((armor) => {
|
||||||
|
einschränkungen.push(...armor.system.merkmale);
|
||||||
|
|
||||||
|
const w = {
|
||||||
|
name: armor.name,
|
||||||
|
rüstwert: armor.system.rüstwert,
|
||||||
|
img: armor.img,
|
||||||
|
id: armor.id,
|
||||||
|
};
|
||||||
|
armors.push(w);
|
||||||
|
});
|
||||||
|
|
||||||
|
return { armors: armors, einschränkungen: [...new Set(einschränkungen)] };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function prepWeapons(actor) {
|
||||||
|
const weaponItems = actor.items.filter((x) => x.type === "weapon" && x.system.equipped);
|
||||||
|
const weapons = [];
|
||||||
|
weaponItems.forEach((weapon) => {
|
||||||
|
const skillValue =
|
||||||
|
actor.system.fertigkeiten.find((x) => x.name === weapon.fertigkeit)?.wurf ||
|
||||||
|
Math.floor((actor.system.kompetenz + 8) / 2);
|
||||||
|
const w = {
|
||||||
|
name: weapon.name,
|
||||||
|
skillValue,
|
||||||
|
schaden: weapon.system.schaden,
|
||||||
|
img: weapon.img,
|
||||||
|
id: weapon.id,
|
||||||
|
};
|
||||||
|
weapons.push(w);
|
||||||
|
});
|
||||||
|
return weapons;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function prepSpells(actor) {
|
||||||
|
const spellItems = actor.items.filter((x) => x.type === "zauber" && x.system.equipped);
|
||||||
|
const spells = [];
|
||||||
|
const skillValue =
|
||||||
|
actor.system.fertigkeiten.find((x) => x.name === "Zaubern")?.wurf ||
|
||||||
|
Math.floor((actor.system.kompetenz + 8) / 2);
|
||||||
|
spellItems.forEach((spell) => {
|
||||||
|
const w = {
|
||||||
|
name: spell.name,
|
||||||
|
skillValue,
|
||||||
|
schaden: spell.system.eigenschaften.schaden,
|
||||||
|
img: spell.img,
|
||||||
|
path: "Zaubern",
|
||||||
|
id: spell.id,
|
||||||
|
};
|
||||||
|
spells.push(w);
|
||||||
|
});
|
||||||
|
return spells;
|
||||||
|
}
|
||||||
@@ -1,281 +1,149 @@
|
|||||||
import { systemPath } from "../../constants.mjs";
|
import { systemPath } from "../../constants.mjs";
|
||||||
|
|
||||||
export async function rollSpell(event, target) {
|
function _getDieType(vorteilStatus) {
|
||||||
const dataset = target.dataset;
|
switch (vorteilStatus) {
|
||||||
const skill = foundry.utils.getProperty(this.actor, "system.skills.magie.zaubern");
|
|
||||||
const item = this.actor.items.get(dataset.itemId);
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: dataset.name,
|
|
||||||
skill,
|
|
||||||
damageRoll: item.system.eigenschaften.schaden,
|
|
||||||
preSelectedSpez: item.system.eigenschaften.ursprung,
|
|
||||||
actor
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
case -1:
|
||||||
die = "2d20kl";
|
return "2d20kl";
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
die = "2d20kh";
|
return "2d20kh";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
die = "1d20";
|
return "1d20";
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _applyBonusDamage(actor, baseDamage, skill) {
|
||||||
|
if (!baseDamage) return "";
|
||||||
|
let formula = baseDamage;
|
||||||
|
const bonusArray = actor.system.bonuses?.schaden || [];
|
||||||
|
for (const bonus of bonusArray) {
|
||||||
|
if (bonus.condition) {
|
||||||
|
if (!skill.includes(bonus.condition.toLowerCase())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bonus.schaden) formula += ` + ${bonus.schaden}`;
|
||||||
|
}
|
||||||
|
return formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Universelle Würfel-Aktion */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
export async function roll(event, target) {
|
||||||
|
const actor = this.actor;
|
||||||
|
const dataset = target.dataset;
|
||||||
|
|
||||||
|
const item = dataset.itemId ? actor.items.get(dataset.itemId) : null;
|
||||||
|
const itemType = item?.type;
|
||||||
|
|
||||||
|
let skill;
|
||||||
|
let damageRoll = "";
|
||||||
|
let preSelectedSpez = "";
|
||||||
|
let rollFlavor = "";
|
||||||
|
let itemVorteil = 0;
|
||||||
|
|
||||||
|
if (itemType === "zauber") {
|
||||||
|
skill = await foundry.utils.getProperty(actor, "system.skills.magie.zaubern");
|
||||||
|
damageRoll = _applyBonusDamage(actor, item.system.eigenschaften.schaden, "zaubern");
|
||||||
|
preSelectedSpez = item.system.eigenschaften.ursprung;
|
||||||
|
rollFlavor = `${game.i18n.localize("Midgard6.Zaubern")}: ${item.name}`;
|
||||||
|
} else if (itemType === "weapon") {
|
||||||
|
skill = await foundry.utils.getProperty(actor, item.system.fertigkeit);
|
||||||
|
damageRoll = _applyBonusDamage(actor, item.system.schaden, item.system.fertigkeit);
|
||||||
|
preSelectedSpez = item.system.spezialisierung;
|
||||||
|
rollFlavor = `${game.i18n.localize("Midgard6.Angriff")}: ${item.name}`;
|
||||||
|
itemVorteil = item.system.angriffMod;
|
||||||
|
} else {
|
||||||
|
const cleanPath = dataset.path.replace(".value", "");
|
||||||
|
skill = foundry.utils.getProperty(actor, cleanPath);
|
||||||
|
rollFlavor = dataset.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!skill) return ui.notifications.error("Zugehörige Fertigkeit nicht gefunden.");
|
||||||
|
|
||||||
|
const vorteil = (skill.vorteil || 0) - (skill.nachteil || 0) + itemVorteil;
|
||||||
|
|
||||||
|
const dialogResult = await rollDialog({
|
||||||
|
name: item ? item.name : dataset.name,
|
||||||
|
skill,
|
||||||
|
damageRoll,
|
||||||
|
preSelectedSpez,
|
||||||
|
vorteil,
|
||||||
|
actor,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!dialogResult || dialogResult === "abort") return;
|
||||||
|
|
||||||
|
const die = _getDieType(dialogResult.vorteil);
|
||||||
let rollTerm = "@die + @skill";
|
let rollTerm = "@die + @skill";
|
||||||
let rollFlavor = game.i18n.localize("Midgard6.Zaubern") + ": " + item.name;
|
|
||||||
let roll;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
if (dialogResult.spezLevel) {
|
||||||
rollTerm += " + @spezBonus";
|
rollTerm += " + @spezBonus";
|
||||||
rollFlavor += ": " + dialogResult.spezName;
|
rollFlavor +=
|
||||||
|
itemType === "weapon" ? ` (${dialogResult.spezName})` : `: ${dialogResult.spezName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rolls = [];
|
||||||
if (dialogResult.customRoll) {
|
if (dialogResult.customRoll) {
|
||||||
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
rolls.push(await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate());
|
||||||
} else {
|
} else {
|
||||||
roll = new Roll(
|
rolls.push(
|
||||||
rollTerm,
|
|
||||||
{
|
|
||||||
die: die,
|
|
||||||
skill: skillValue,
|
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
|
||||||
},
|
|
||||||
{ title: rollFlavor }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.system.eigenschaften.schaden) {
|
|
||||||
const attackRoll = await roll.evaluate();
|
|
||||||
roll = [
|
|
||||||
attackRoll,
|
|
||||||
await new Roll(
|
await new Roll(
|
||||||
"@die",
|
|
||||||
{ die: item.system.eigenschaften.schaden },
|
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") }
|
|
||||||
).evaluate()
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
// Execute the roll
|
|
||||||
await roll.evaluate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
|
||||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
|
||||||
|
|
||||||
const chatData = {
|
|
||||||
rolls: roll,
|
|
||||||
speaker: ChatMessage.getSpeaker(),
|
|
||||||
flags: {
|
|
||||||
"midgard6-lvd": {
|
|
||||||
title: rollFlavor,
|
|
||||||
eigenschaften: item.system.eigenschaften,
|
|
||||||
isSpell: true,
|
|
||||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
||||||
item.system.beschreibung,
|
|
||||||
{
|
|
||||||
// Whether to show secret blocks in the finished html
|
|
||||||
secrets: false,
|
|
||||||
// Data to fill in for inline rolls
|
|
||||||
rollData: this.actor.getRollData(),
|
|
||||||
// Relative UUID resolution
|
|
||||||
relativeTo: this.actor
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
|
||||||
|
|
||||||
await ChatMessage.create(chatData);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function rollSkill(event, target) {
|
|
||||||
const dataset = target.dataset;
|
|
||||||
const skill = foundry.utils.getProperty(this.actor, target.dataset.path.replace(".value", ""));
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: dataset.name,
|
|
||||||
skill,
|
|
||||||
actor
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value || skill;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
|
||||||
die = "2d20kl";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
die = "2d20kh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
die = "1d20";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollTerm = "@die + @skill";
|
|
||||||
let rollFlavor = dataset.name;
|
|
||||||
let roll;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
|
||||||
rollTerm += " + @spezBonus";
|
|
||||||
rollFlavor += ": " + dialogResult.spezName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dialogResult.customRoll) {
|
|
||||||
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
|
||||||
} else {
|
|
||||||
roll = new Roll(
|
|
||||||
rollTerm,
|
rollTerm,
|
||||||
{
|
{ die: die, skill: skill.value || skill, spezBonus: dialogResult.spezLevel + 1 },
|
||||||
die: die,
|
{ title: rollFlavor },
|
||||||
skill: skillValue,
|
).evaluate(),
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
|
||||||
},
|
|
||||||
{ title: rollFlavor }
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
const finalDamageFormula = dialogResult.customDamageRoll || damageRoll;
|
||||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
if (finalDamageFormula && (itemType === "weapon" || itemType === "zauber")) {
|
||||||
|
rolls.push(
|
||||||
|
await new Roll(
|
||||||
|
finalDamageFormula,
|
||||||
|
{ die: finalDamageFormula },
|
||||||
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
|
).evaluate(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the roll
|
const flagsData = { title: rollFlavor };
|
||||||
await roll.evaluate();
|
|
||||||
|
if (item) {
|
||||||
|
flagsData.beschreibung = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
|
item.system.beschreibung || "",
|
||||||
|
{ secrets: false, rollData: actor.getRollData(), relativeTo: actor },
|
||||||
|
);
|
||||||
|
flagsData.eigenschaften = item.system?.eigenschaften || item?.eigenschaften || [];
|
||||||
|
flagsData.merkmale = item.system?.merkmale || [];
|
||||||
|
flagsData.isSpell = itemType === "zauber";
|
||||||
|
}
|
||||||
|
|
||||||
const chatData = {
|
const chatData = {
|
||||||
rolls: roll,
|
rolls: rolls,
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
flags: {
|
flags: { "midgard6-lvd": flagsData },
|
||||||
"midgard6-lvd": {
|
|
||||||
title: rollFlavor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Nutze applyRollMode, um Sichtbarkeiten (Whisper, Blind) korrekt zu setzen
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
|
||||||
|
|
||||||
// Erstelle die Nachricht mit den manipulierten Daten
|
|
||||||
await ChatMessage.create(chatData);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function rollWeapon(event, target) {
|
|
||||||
const dataset = target.dataset;
|
|
||||||
const weapon = this.actor.items.get(dataset.itemId);
|
|
||||||
const skill = foundry.utils.getProperty(this.actor, weapon.system.fertigkeit);
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await rollDialog({
|
|
||||||
name: weapon.name,
|
|
||||||
skill,
|
|
||||||
damageRoll: weapon.system.schaden,
|
|
||||||
preSelectedSpez: weapon.system.spezialisierung,
|
|
||||||
actor
|
|
||||||
});
|
|
||||||
console.log("Dialog Result", dialogResult);
|
|
||||||
if (dialogResult === "abort") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = skill.value;
|
|
||||||
let die = "";
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case -1:
|
|
||||||
die = "2d20kl";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
die = "2d20kh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
die = "1d20";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let rollTerm = "@die + @skill";
|
|
||||||
let rollFlavor = game.i18n.localize("Midgard6.Angriff");
|
|
||||||
let attackRoll;
|
|
||||||
let damageRoll;
|
|
||||||
|
|
||||||
if (dialogResult.spezLevel) {
|
|
||||||
rollTerm += " + @spezBonus";
|
|
||||||
rollFlavor += " (" + dialogResult.spezName + ")";
|
|
||||||
}
|
|
||||||
rollFlavor += ": " + weapon.name;
|
|
||||||
|
|
||||||
if (dialogResult.customRoll) {
|
|
||||||
attackRoll = await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate();
|
|
||||||
} else {
|
|
||||||
attackRoll = await new Roll(
|
|
||||||
rollTerm,
|
|
||||||
{
|
|
||||||
die: die,
|
|
||||||
skill: skillValue,
|
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: rollFlavor
|
|
||||||
}
|
|
||||||
).evaluate();
|
|
||||||
}
|
|
||||||
|
|
||||||
damageRoll = await new Roll(
|
|
||||||
"@die",
|
|
||||||
{ die: weapon.system.schaden },
|
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") }
|
|
||||||
).evaluate();
|
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
|
||||||
const chatData = {
|
|
||||||
rolls: [attackRoll, damageRoll],
|
|
||||||
speaker: ChatMessage.getSpeaker(),
|
|
||||||
flags: {
|
|
||||||
"midgard6-lvd": {
|
|
||||||
title: rollFlavor,
|
|
||||||
eigenschaften: weapon.eigenschaften,
|
|
||||||
merkmale: weapon.system.merkmale,
|
|
||||||
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
||||||
weapon.system.beschreibung,
|
|
||||||
{
|
|
||||||
secrets: false,
|
|
||||||
rollData: this.actor.getRollData(),
|
|
||||||
relativeTo: this.actor
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
|
|
||||||
await ChatMessage.create(chatData);
|
await ChatMessage.create(chatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function rollDialog(rollDialogRequest) {
|
/* -------------------------------------------------- */
|
||||||
// Assamble dialog depending on roll type
|
/* Dialog-Fenster */
|
||||||
let label = rollDialogRequest.name;
|
/* -------------------------------------------------- */
|
||||||
let skillValue = rollDialogRequest.skill.value || rollDialogRequest.skill;
|
|
||||||
let bonuses = rollDialogRequest.skill.bonuses || [];
|
export async function rollDialog(rollDialogRequest) {
|
||||||
|
let skillValue = rollDialogRequest.skill?.value || rollDialogRequest.skill;
|
||||||
|
let bonuses = rollDialogRequest.skill?.bonuses || [];
|
||||||
let damageRoll = rollDialogRequest.damageRoll || "";
|
let damageRoll = rollDialogRequest.damageRoll || "";
|
||||||
let preSelectedSpez = rollDialogRequest.preSelectedSpez || "";
|
let preSelectedSpez = rollDialogRequest.preSelectedSpez || "";
|
||||||
let vorteil = 0;
|
let vorteil = rollDialogRequest.vorteil || 0;
|
||||||
let customRoll = "";
|
let customRoll = "";
|
||||||
let spezLevel;
|
let spezLevel;
|
||||||
let spezName = "";
|
let spezName = "";
|
||||||
// 1. Define the path to .hbs template
|
|
||||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||||
const templateData = {
|
const templateData = {
|
||||||
skillValue,
|
skillValue,
|
||||||
@@ -284,78 +152,81 @@ async function rollDialog(rollDialogRequest) {
|
|||||||
damageRoll,
|
damageRoll,
|
||||||
preSelectedSpez,
|
preSelectedSpez,
|
||||||
customRoll,
|
customRoll,
|
||||||
rollModes: CONFIG.ChatMessage.modes
|
rollModes: CONFIG.ChatMessage.modes,
|
||||||
};
|
};
|
||||||
// 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 new Promise((resolve, reject) => {
|
|
||||||
// const dialog = new foundry.applications.api.DialogV2({
|
|
||||||
return foundry.applications.api.DialogV2.wait({
|
return foundry.applications.api.DialogV2.wait({
|
||||||
window: { title: "Würfel Modifikatoren: " + label },
|
window: { title: "Würfel Modifikatoren: " + rollDialogRequest.name },
|
||||||
position: {
|
position: { width: 600 },
|
||||||
width: 600
|
|
||||||
},
|
|
||||||
classes: ["M6", "dialog"],
|
classes: ["M6", "dialog"],
|
||||||
content,
|
content,
|
||||||
actions: {},
|
|
||||||
render: (_event, dialog) => {
|
render: (_event, dialog) => {
|
||||||
const dialogHTML = dialog.element;
|
const dialogHTML = dialog.element;
|
||||||
|
|
||||||
const display = dialogHTML.querySelector("#rollDisplay");
|
const display = dialogHTML.querySelector("#rollDisplay");
|
||||||
|
let mainRoll = `1d20 + ${skillValue}`;
|
||||||
|
let spezText = "";
|
||||||
|
|
||||||
// Variable bei jeder Änderung aktualisieren
|
dialogHTML.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
|
||||||
document.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
|
|
||||||
radio.addEventListener("change", (e) => {
|
radio.addEventListener("change", (e) => {
|
||||||
vorteil = parseInt(e.target.value);
|
vorteil = parseInt(e.target.value);
|
||||||
switch (vorteil) {
|
switch (vorteil) {
|
||||||
case 1:
|
case 1:
|
||||||
display.placeholder = `2d20kh + ${skillValue} (Vorteil)`;
|
mainRoll = `2d20kh + ${skillValue} (Vorteil)`;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
display.placeholder = `2d20kl + ${skillValue} (Nachteil)`;
|
mainRoll = `2d20kl + ${skillValue} (Nachteil)`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
display.placeholder = `1d20 + ${skillValue}`;
|
mainRoll = `1d20 + ${skillValue}`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
display.placeholder = mainRoll + spezText;
|
||||||
});
|
});
|
||||||
|
//Wähle richtigen button aus, auch wenn vorteil wert größer oder kleiner +-1 ist
|
||||||
|
if (vorteil < 0 && radio.dataset.value == -1) radio.click();
|
||||||
|
else if (vorteil > 0 && radio.dataset.value == 1) radio.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
dialogHTML.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
||||||
radio.addEventListener("change", (e) => {
|
radio.addEventListener("click", (e) => {
|
||||||
|
if (spezName !== e.target.dataset.name) {
|
||||||
spezLevel = parseInt(e.target.value);
|
spezLevel = parseInt(e.target.value);
|
||||||
spezName = e.target.dataset.name;
|
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) {
|
if (radio.dataset.name === preSelectedSpez) {
|
||||||
radio.click();
|
radio.click();
|
||||||
|
display.placeholder = mainRoll + spezText;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{ action: "abort", label: "Midgard6.Dialog.abbrechen", callback: () => null },
|
||||||
action: "abort",
|
|
||||||
label: "Midgard6.Dialog.abbrechen",
|
|
||||||
callback: (event, button, dialog) => {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
action: "roll",
|
action: "roll",
|
||||||
label: "Midgard6.Dialog.würfeln",
|
label: "Midgard6.Dialog.würfeln",
|
||||||
default: true,
|
default: true,
|
||||||
callback: (event, button, dialog) => {
|
callback: (event, button) => {
|
||||||
const rollData = {
|
return {
|
||||||
customRoll: button.form.elements.customRoll.value,
|
customRoll: button.form.elements.customRoll.value,
|
||||||
customDamageRoll: button.form.elements.customDamageRoll?.value || "",
|
customDamageRoll: button.form.elements.customDamageRoll?.value || "",
|
||||||
vorteil,
|
vorteil,
|
||||||
spezLevel,
|
spezLevel,
|
||||||
spezName,
|
spezName,
|
||||||
rollMode:
|
rollMode:
|
||||||
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode")
|
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode"),
|
||||||
};
|
};
|
||||||
return rollData;
|
},
|
||||||
}
|
},
|
||||||
}
|
],
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,12 @@ export async function addSpezialisierung(event, target) {
|
|||||||
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);
|
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;
|
let level = 1;
|
||||||
|
|
||||||
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
|
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export class M6HintergrundSheet extends M6ItemSheet {
|
|||||||
return {
|
return {
|
||||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,34 +21,34 @@ export class M6HintergrundSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "effects",
|
id: "effects",
|
||||||
icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
initial: "beschreibung",
|
initial: "beschreibung",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/hintergrund/header.hbs")
|
template: systemPath("templates/hintergrund/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/hintergrund/description.hbs"),
|
template: systemPath("templates/hintergrund/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_addSpecifics(context) {
|
_addSpecifics(context) {
|
||||||
|
|||||||
+26
-26
@@ -10,24 +10,24 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true,
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
width: 650,
|
width: 650,
|
||||||
height: 450
|
height: 450,
|
||||||
},
|
},
|
||||||
classes: ["M6", "item", "standard-form"],
|
classes: ["M6", "item", "standard-form"],
|
||||||
actions: {
|
actions: {
|
||||||
viewDoc: this.#viewEffect,
|
viewDoc: this.#viewEffect,
|
||||||
createDoc: this.#createEffect,
|
createDoc: this.#createEffect,
|
||||||
deleteDoc: this.#deleteEffect,
|
deleteDoc: this.#deleteEffect,
|
||||||
toggleEffect: this.#toggleEffect
|
toggleEffect: this.#toggleEffect,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
submitOnChange: true
|
submitOnChange: true,
|
||||||
},
|
},
|
||||||
// Custom property that's merged into `this.options`
|
// Custom property that's merged into `this.options`
|
||||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }],
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -37,16 +37,16 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "effects",
|
id: "effects",
|
||||||
icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
initial: "beschreibung",
|
initial: "beschreibung",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -54,19 +54,19 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
_attachPartListeners(partId, html, bubble) {
|
_attachPartListeners(partId, html, bubble) {
|
||||||
@@ -88,8 +88,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const currentInput = event.currentTarget;
|
const currentInput = event.currentTarget;
|
||||||
const value = currentInput.value;
|
const value = currentInput.value;
|
||||||
console.log("Feld verlassen! Aktueller Wert:", value);
|
const location = currentInput.name || currentInput.id;
|
||||||
this.item.update({ [`${currentInput.name}`]: value.split(/[\s,]+/) });
|
this.item.update({ [`${location}`]: value.split(/[\s,]+/) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -117,7 +117,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
system: this.item.system,
|
system: this.item.system,
|
||||||
flags: this.item.flags,
|
flags: this.item.flags,
|
||||||
itemFields: this.item.schema.fields,
|
itemFields: this.item.schema.fields,
|
||||||
config: CONFIG
|
config: CONFIG,
|
||||||
});
|
});
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
@@ -144,8 +144,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Data to fill in for inline rolls
|
// Data to fill in for inline rolls
|
||||||
rollData: this.item.getRollData(),
|
rollData: this.item.getRollData(),
|
||||||
// Relative UUID resolution
|
// Relative UUID resolution
|
||||||
relativeTo: this.item
|
relativeTo: this.item,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
@@ -257,8 +257,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
const effectData = {
|
const effectData = {
|
||||||
name: aeCls.defaultName({
|
name: aeCls.defaultName({
|
||||||
type: target.dataset.type,
|
type: target.dataset.type,
|
||||||
parent: this.item
|
parent: this.item,
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
@@ -428,7 +428,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Perform the sort
|
// Perform the sort
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
target,
|
target,
|
||||||
siblings
|
siblings,
|
||||||
});
|
});
|
||||||
const updateData = sortUpdates.map((u) => {
|
const updateData = sortUpdates.map((u) => {
|
||||||
const update = u.update;
|
const update = u.update;
|
||||||
@@ -502,7 +502,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
// Perform the sort
|
// Perform the sort
|
||||||
const sortUpdates = foundry.utils.SortingHelpers.performIntegerSort(item, {
|
const sortUpdates = foundry.utils.SortingHelpers.performIntegerSort(item, {
|
||||||
target,
|
target,
|
||||||
siblings
|
siblings,
|
||||||
});
|
});
|
||||||
const updateData = sortUpdates.map((u) => {
|
const updateData = sortUpdates.map((u) => {
|
||||||
const update = u.update;
|
const update = u.update;
|
||||||
@@ -556,12 +556,12 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
return this.options.dragDrop.map((d) => {
|
return this.options.dragDrop.map((d) => {
|
||||||
d.permissions = {
|
d.permissions = {
|
||||||
dragstart: this._canDragStart.bind(this),
|
dragstart: this._canDragStart.bind(this),
|
||||||
drop: this._canDragDrop.bind(this)
|
drop: this._canDragDrop.bind(this),
|
||||||
};
|
};
|
||||||
d.callbacks = {
|
d.callbacks = {
|
||||||
dragstart: this._onDragStart.bind(this),
|
dragstart: this._onDragStart.bind(this),
|
||||||
dragover: this._onDragOver.bind(this),
|
dragover: this._onDragOver.bind(this),
|
||||||
drop: this._onDrop.bind(this)
|
drop: this._onDrop.bind(this),
|
||||||
};
|
};
|
||||||
return new foundry.applications.ux.DragDrop(d);
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,532 @@
|
|||||||
|
import { systemPath } from "../constants.mjs";
|
||||||
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
|
import { prepArmor, prepWeapons, prepSpells } from "./components/nsc-prep.mjs";
|
||||||
|
import { roll, rollDialog } from "./components/roll-actions.mjs";
|
||||||
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
|
||||||
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the M6ActorSheet.
|
||||||
|
*/
|
||||||
|
export class M6NSCSheet extends M6ActorSheet {
|
||||||
|
/** @inheritdoc */
|
||||||
|
static get DEFAULT_OPTIONS() {
|
||||||
|
return {
|
||||||
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Options aus M6ActorSheet
|
||||||
|
actions: {
|
||||||
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
|
cycleEquip: this.#cycleEquip,
|
||||||
|
rollKompetenz: this.#rollKompetenz,
|
||||||
|
rollSpell: roll,
|
||||||
|
addKompetenz: this.#addKompetenz,
|
||||||
|
deleteKompetenz: this.#deleteKompetenz,
|
||||||
|
editKompetenz: this.#editKompetenz,
|
||||||
|
editResistenz: this.#editResistenz,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [
|
||||||
|
{
|
||||||
|
id: "eigenschaften",
|
||||||
|
icon: "fa-shield-halved",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "items",
|
||||||
|
icon: "fa-suitcase",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "zauber",
|
||||||
|
icon: "fa-hand-sparkles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "biographie",
|
||||||
|
icon: "fa-feather-pointed",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: "effects",
|
||||||
|
// icon: "fa-bolt"
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
initial: "eigenschaften",
|
||||||
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static PARTS = {
|
||||||
|
tabs: {
|
||||||
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
template: systemPath("templates/nsc/header.hbs"),
|
||||||
|
},
|
||||||
|
eigenschaften: {
|
||||||
|
template: systemPath("templates/nsc/eigenschaften.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
zauber: {
|
||||||
|
template: systemPath("templates/actor/zauber.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
items: {
|
||||||
|
template: systemPath("templates/actor/items.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
biographie: {
|
||||||
|
template: systemPath("templates/actor/biographie.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
// effects: {
|
||||||
|
// template: systemPath("templates/shared/effects.hbs"),
|
||||||
|
// scrollable: [""]
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _prepareContext(options) {
|
||||||
|
const context = await super._prepareContext(options);
|
||||||
|
|
||||||
|
Object.assign(context, {
|
||||||
|
owner: this.document.isOwner,
|
||||||
|
limited: this.document.limited,
|
||||||
|
actor: this.actor,
|
||||||
|
system: this.actor.system,
|
||||||
|
flags: this.actor.flags,
|
||||||
|
config: CONFIG,
|
||||||
|
});
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
switch (partId) {
|
||||||
|
case "eigenschaften":
|
||||||
|
context.kompetenzWürfe = await this.calcKompetenzWürfe();
|
||||||
|
context.itemTypes = await super._getItems();
|
||||||
|
context.armor = await prepArmor(this.actor);
|
||||||
|
context.equippedWeapons = await prepWeapons(this.actor);
|
||||||
|
context.equippedSpells = await prepSpells(this.actor);
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "effects":
|
||||||
|
context.effects = prepareActiveEffectCategories(this.actor.allApplicableEffects());
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "items":
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "zauber":
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "biographie":
|
||||||
|
context.enrichedBeschreibung =
|
||||||
|
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
|
this.actor.system.biographie.beschreibung,
|
||||||
|
{
|
||||||
|
// Whether to show secret blocks in the finished html
|
||||||
|
secrets: this.document.isOwner,
|
||||||
|
// Data to fill in for inline rolls
|
||||||
|
rollData: this.actor.getRollData(),
|
||||||
|
// Relative UUID resolution
|
||||||
|
relativeTo: this.actor,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
async calcKompetenzWürfe() {
|
||||||
|
const kompetenz = this.actor.system.kompetenz;
|
||||||
|
const resistenzen = this.actor.system.resistenzen;
|
||||||
|
for (var key in resistenzen) {
|
||||||
|
let calc;
|
||||||
|
switch (resistenzen[key].kompetent) {
|
||||||
|
case -1:
|
||||||
|
calc = "d3";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
calc = kompetenz + 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
calc = Math.floor((kompetenz + 8) / 2);
|
||||||
|
}
|
||||||
|
resistenzen[key].value = calc;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.actor.system.fertigkeiten.forEach((fertigkeit) => {
|
||||||
|
let calc;
|
||||||
|
switch (fertigkeit.kompetenz) {
|
||||||
|
case -1:
|
||||||
|
calc = "d3";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
calc = kompetenz + 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
calc = Math.floor((kompetenz + 8) / 2);
|
||||||
|
}
|
||||||
|
fertigkeit.wurf = calc;
|
||||||
|
});
|
||||||
|
|
||||||
|
return { kompetent: kompetenz + 8, mittelmäßig: Math.floor((kompetenz + 8) / 2) };
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getResistenzen() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.resistenzen;
|
||||||
|
const fieldset = {
|
||||||
|
fieldset: true,
|
||||||
|
legend: `Midgard6.Attribute.${systemFields.label}`,
|
||||||
|
fields: [],
|
||||||
|
};
|
||||||
|
for (const field of Object.values(systemFields.fields ?? {})) {
|
||||||
|
const path = `system.resistenzen.${field.name}`;
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
localizationName: "Midgard6.Resistenzen." + field.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return fieldset;
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getResources() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.resources.fields;
|
||||||
|
const fieldSets = [];
|
||||||
|
// TODO: Find a clever way to handle enrichment
|
||||||
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
|
const path = `system.skills.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
const fieldset = {
|
||||||
|
fieldset: true,
|
||||||
|
legend: `Midgard6.resources.${field.label}`,
|
||||||
|
fields: [],
|
||||||
|
};
|
||||||
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
fieldSets.push(fieldset);
|
||||||
|
} else {
|
||||||
|
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #cycleEquip(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
item.update({
|
||||||
|
system: {
|
||||||
|
equipped: !item.system.equipped,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively add system model fields to the fieldset.
|
||||||
|
*/
|
||||||
|
async #addSystemFields(fieldset, schema, source, _path = "system") {
|
||||||
|
for (const field of Object.values(schema)) {
|
||||||
|
const path = `${_path}.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
} else if (field.constructor.hasFormSupport) {
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
_getZauber() {
|
||||||
|
return this.actor.items.filter((item) => item.type === "zauber");
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #addKompetenz(event, target) {
|
||||||
|
const templatePath = systemPath("templates/dialog/nsc-fertigkeit-hinzufügen-dialog.hbs");
|
||||||
|
let fertigkeit = {
|
||||||
|
name: "",
|
||||||
|
kompetenz: "",
|
||||||
|
wurf: "",
|
||||||
|
};
|
||||||
|
const templateData = {
|
||||||
|
fertigkeit,
|
||||||
|
};
|
||||||
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
templatePath,
|
||||||
|
templateData,
|
||||||
|
);
|
||||||
|
return foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.localize("Midgard6.Attribute.resistenzen"),
|
||||||
|
},
|
||||||
|
classes: ["M6", "dialog"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
content,
|
||||||
|
actions: {},
|
||||||
|
render: (_event, dialog) => {
|
||||||
|
const dialogHTML = dialog.element;
|
||||||
|
dialogHTML.querySelectorAll(`input[name="kompetenz-segment"]`).forEach((radio) => {
|
||||||
|
radio.addEventListener("change", (e) => {
|
||||||
|
fertigkeit.kompetenz = parseInt(e.target.value);
|
||||||
|
});
|
||||||
|
if (radio.value == 1) {
|
||||||
|
radio.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
action: "abort",
|
||||||
|
label: "Midgard6.Dialog.abbrechen",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: "safe",
|
||||||
|
label: "Midgard6.Dialog.speichern",
|
||||||
|
default: true,
|
||||||
|
callback: async (event, button, dialog) => {
|
||||||
|
const fertigkeiten = this.actor.system.fertigkeiten;
|
||||||
|
fertigkeit.name = button.form.elements.fertigkeitsName.value;
|
||||||
|
await this.actor.update({ ["system.fertigkeiten"]: [...fertigkeiten, fertigkeit] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #editKompetenz(event, target) {
|
||||||
|
const templatePath = systemPath("templates/dialog/nsc-fertigkeit-hinzufügen-dialog.hbs");
|
||||||
|
const OGName = target.dataset.name;
|
||||||
|
const kompetenz = target.dataset.kompetenz;
|
||||||
|
|
||||||
|
let fertigkeit = {
|
||||||
|
name: target.dataset.name,
|
||||||
|
kompetenz,
|
||||||
|
wurf: "",
|
||||||
|
};
|
||||||
|
const templateData = {
|
||||||
|
fertigkeit,
|
||||||
|
};
|
||||||
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
templatePath,
|
||||||
|
templateData,
|
||||||
|
);
|
||||||
|
return foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.localize("Midgard6.Attribute.resistenzen"),
|
||||||
|
},
|
||||||
|
classes: ["M6", "dialog"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
content,
|
||||||
|
actions: {},
|
||||||
|
render: (_event, dialog) => {
|
||||||
|
const dialogHTML = dialog.element;
|
||||||
|
dialogHTML.querySelectorAll(`input[name="kompetenz-segment"]`).forEach((radio) => {
|
||||||
|
radio.addEventListener("change", (e) => {
|
||||||
|
fertigkeit.kompetenz = parseInt(e.target.value);
|
||||||
|
});
|
||||||
|
if (radio.value == kompetenz) {
|
||||||
|
radio.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
action: "abort",
|
||||||
|
label: "Midgard6.Dialog.abbrechen",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: "safe",
|
||||||
|
label: "Midgard6.Dialog.speichern",
|
||||||
|
default: true,
|
||||||
|
callback: async (event, button, dialog) => {
|
||||||
|
fertigkeit.name = button.form.elements.fertigkeitsName.value;
|
||||||
|
const fertigkeiten = this.actor.system.fertigkeiten.map((x) =>
|
||||||
|
x.name === OGName ? fertigkeit : x,
|
||||||
|
);
|
||||||
|
await this.actor.update({ ["system.fertigkeiten"]: fertigkeiten });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #deleteKompetenz(event, target) {
|
||||||
|
const fertigkeiten = this.actor.system.fertigkeiten.filter(
|
||||||
|
(x) => x.name !== target.dataset.name,
|
||||||
|
);
|
||||||
|
await this.actor.update({ ["system.fertigkeiten"]: fertigkeiten });
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #editResistenz(event, target) {
|
||||||
|
const resistenzen = this.actor.system.resistenzen;
|
||||||
|
const templatePath = systemPath("templates/dialog/nsc-resistenz-dialog.hbs");
|
||||||
|
const templateData = {
|
||||||
|
resistenzen,
|
||||||
|
};
|
||||||
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
templatePath,
|
||||||
|
templateData,
|
||||||
|
);
|
||||||
|
return foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.localize("Midgard6.Attribute.resistenzen"),
|
||||||
|
},
|
||||||
|
classes: ["M6", "dialog"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
content,
|
||||||
|
actions: {},
|
||||||
|
render: (_event, dialog) => {
|
||||||
|
const dialogHTML = dialog.element;
|
||||||
|
for (const key in resistenzen) {
|
||||||
|
dialogHTML.querySelectorAll(`input[name="${key}-segment"]`).forEach((radio) => {
|
||||||
|
if (radio.value == resistenzen[key].kompetent) {
|
||||||
|
radio.click();
|
||||||
|
}
|
||||||
|
radio.addEventListener("change", (e) => {
|
||||||
|
resistenzen[key].kompetent = parseInt(e.target.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
action: "abort",
|
||||||
|
label: "Midgard6.Dialog.abbrechen",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: "safe",
|
||||||
|
label: "Midgard6.Dialog.speichern",
|
||||||
|
default: true,
|
||||||
|
callback: async (event, button, dialog) => {
|
||||||
|
await this.actor.update({ [`system.resistenzen`]: resistenzen });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #rollKompetenz(event, target) {
|
||||||
|
const dataset = target.dataset;
|
||||||
|
const kompetenz = dataset.kompetenz || "";
|
||||||
|
const kompetenzValue = dataset.kompetenzValue;
|
||||||
|
const schaden = dataset.schaden;
|
||||||
|
const item = this.actor.items.get(dataset.itemId);
|
||||||
|
|
||||||
|
const dialogResult = await rollDialog({
|
||||||
|
skill: kompetenzValue,
|
||||||
|
damageRoll: schaden,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Dialog Result", dialogResult);
|
||||||
|
if (dialogResult === "abort") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Construct the Roll instance
|
||||||
|
const skillValue = kompetenzValue;
|
||||||
|
let die = "";
|
||||||
|
switch (dialogResult.vorteil) {
|
||||||
|
case -1:
|
||||||
|
die = "2d20kl";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
die = "2d20kh";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
die = "1d20";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let rollFlavor = dataset.name ?? kompetenz;
|
||||||
|
let rolls;
|
||||||
|
if (dialogResult.customRoll) {
|
||||||
|
rolls = [await new Roll(dialogResult.customRoll, {}, { title: rollFlavor }).evaluate()];
|
||||||
|
} else {
|
||||||
|
rolls = [
|
||||||
|
await new Roll(
|
||||||
|
"@die + @skill",
|
||||||
|
{
|
||||||
|
die: die,
|
||||||
|
skill: skillValue,
|
||||||
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
|
},
|
||||||
|
{ title: rollFlavor },
|
||||||
|
).evaluate(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialogResult.customDamageRoll) {
|
||||||
|
rolls.push(
|
||||||
|
await new Roll(
|
||||||
|
"@die",
|
||||||
|
{ die: dialogResult.customDamageRoll },
|
||||||
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
|
).evaluate(),
|
||||||
|
);
|
||||||
|
} else if (schaden) {
|
||||||
|
rolls.push(
|
||||||
|
await new Roll(
|
||||||
|
"@die",
|
||||||
|
{ die: schaden },
|
||||||
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
|
).evaluate(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Roll:", rolls);
|
||||||
|
|
||||||
|
const chatData = {
|
||||||
|
rolls: rolls,
|
||||||
|
speaker: ChatMessage.getSpeaker(),
|
||||||
|
flags: {
|
||||||
|
"midgard6-lvd": {
|
||||||
|
title: rollFlavor,
|
||||||
|
eigenschaften: item?.system?.eigenschaften,
|
||||||
|
merkmale: item?.system?.merkmale,
|
||||||
|
isSpell: item?.type === "zauber",
|
||||||
|
beschreibung: await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
|
item?.system?.beschreibung,
|
||||||
|
{
|
||||||
|
secrets: false,
|
||||||
|
rollData: this.actor.getRollData(),
|
||||||
|
relativeTo: this.actor,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
|
|
||||||
|
await ChatMessage.create(chatData);
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-16
@@ -12,8 +12,8 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||||
actions: {
|
actions: {
|
||||||
...super.DEFAULT_OPTIONS.actions,
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
cycleEquip: this.#cycleEquip
|
cycleEquip: this.#cycleEquip,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,42 +22,42 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "beschreibung",
|
id: "beschreibung",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "effects",
|
id: "effects",
|
||||||
icon: "fa-bolt"
|
icon: "fa-bolt",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/item/header.hbs")
|
template: systemPath("templates/item/header.hbs"),
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/item/waffen/eigenschaften.hbs"),
|
template: systemPath("templates/item/waffen/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
beschreibung: {
|
beschreibung: {
|
||||||
template: systemPath("templates/item/description.hbs"),
|
template: systemPath("templates/item/description.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async _addSpecifics(context) {
|
async _addSpecifics(context) {
|
||||||
@@ -68,8 +68,8 @@ export class M6WeaponSheet extends M6ItemSheet {
|
|||||||
static #cycleEquip() {
|
static #cycleEquip() {
|
||||||
this.item.update({
|
this.item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !this.item.system.equipped
|
equipped: !this.item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-2
@@ -73,13 +73,17 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 0.5rem;
|
margin: 0 0.5rem;
|
||||||
}
|
}
|
||||||
&.text {
|
}
|
||||||
|
.text {
|
||||||
&.center {
|
&.center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
&.right {
|
&.right {
|
||||||
text-align: end;
|
text-align: end;
|
||||||
}
|
}
|
||||||
|
&.highlight {
|
||||||
|
color: var(--M6-text-brown);
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input:disabled {
|
input:disabled {
|
||||||
@@ -95,10 +99,17 @@
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
transition: none;
|
transition: none;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
option:hover {
|
border: none;
|
||||||
|
> :nth-child(odd) {
|
||||||
|
background-color: var(--M6-background-grey);
|
||||||
|
}
|
||||||
|
> :hover {
|
||||||
background-color: var(--M6-background-brown);
|
background-color: var(--M6-background-brown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
select:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
p {
|
p {
|
||||||
&.center {
|
&.center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
+6
-16
@@ -59,22 +59,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Container für die gesamte Reihe */
|
|
||||||
.segmented-button-row {
|
.segmented-button-row {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Einzelnes Segment */
|
|
||||||
.segmented-button {
|
.segmented-button {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Versteckt den echten Radio-Button, behält aber die Tastatur-Navigation */
|
|
||||||
.segmented-button input[type="radio"] {
|
.segmented-button input[type="radio"] {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -82,7 +82,6 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inhalt des Segments (Layout & Abstände) */
|
|
||||||
.segmented-button__content {
|
.segmented-button__content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -96,19 +95,11 @@
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- ZUSTÄNDE --- */
|
|
||||||
|
|
||||||
/* Selektiert (Selected State) */
|
|
||||||
.segmented-button input[type="radio"]:checked + .segmented-button__content {
|
.segmented-button input[type="radio"]:checked + .segmented-button__content {
|
||||||
// background-color: #e8def8; /* M3 Secondary Container Color */
|
background-color: var(--M6-background-brown);
|
||||||
text-shadow: 0 0 10px var(--M6-text-brown) !important;
|
color: #1d192b;
|
||||||
color: #1d192b; /* M3 On-Secondary Container Text */
|
|
||||||
.icon {
|
|
||||||
text-shadow: 0 0 10px var(--M6-text-brown) !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hover-Effekt */
|
|
||||||
.segmented-button:hover .segmented-button__content {
|
.segmented-button:hover .segmented-button__content {
|
||||||
background-color: rgba(73, 69, 79, 0.08);
|
background-color: rgba(73, 69, 79, 0.08);
|
||||||
}
|
}
|
||||||
@@ -116,7 +107,6 @@
|
|||||||
background-color: rgba(232, 222, 248, 0.85);
|
background-color: rgba(232, 222, 248, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tastatur-Fokus (Barrierefreiheit) */
|
|
||||||
.segmented-button input[type="radio"]:focus-visible + .segmented-button__content {
|
.segmented-button input[type="radio"]:focus-visible + .segmented-button__content {
|
||||||
outline: 2px solid #6750a4;
|
outline: 2px solid #6750a4;
|
||||||
outline-offset: -2px;
|
outline-offset: -2px;
|
||||||
|
|||||||
+30
-14
@@ -18,37 +18,53 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: 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 {
|
.progress-background {
|
||||||
width: 90%; /* Breite des Balkens auf dem Bildschirm */
|
width: 100%;
|
||||||
max-width: 800px; /* Maximale Breite auf großen Bildschirmen */
|
|
||||||
background-color: #e0e0e0;
|
background-color: #e0e0e0;
|
||||||
overflow: hidden; /* Schneidet den inneren Balken sauber ab */
|
overflow: hidden;
|
||||||
transform: skewX(-30deg);
|
transform: skewX(-30deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Der eigentliche, animierte Ladebalken */
|
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background-color: var(--M6-background-brown); /* Grün */
|
background-color: #808080;
|
||||||
text-align: center;
|
|
||||||
line-height: 20px;
|
|
||||||
color: white;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: bold;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
color: var(--M6-background-brown);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress::-moz-progress-bar {
|
progress::-moz-progress-bar {
|
||||||
background: var(--M6-background-brown);
|
background: var(--M6-background-brown);
|
||||||
}
|
}
|
||||||
progress::-webkit-progress-value {
|
progress::-webkit-progress-value {
|
||||||
background: var(--M6-background-brown);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+108
-27
@@ -4,93 +4,174 @@ import { loadPartials } from "./helpers/partials.mjs";
|
|||||||
import { loadSettings } from "./helpers/settings.mjs";
|
import { loadSettings } from "./helpers/settings.mjs";
|
||||||
|
|
||||||
import { CharacterData } from "./data/character-data.mjs";
|
import { CharacterData } from "./data/character-data.mjs";
|
||||||
|
import { NSCData } from "./data/nsc-data.mjs";
|
||||||
import { WeaponData } from "./data/weapon-data.mjs";
|
import { WeaponData } from "./data/weapon-data.mjs";
|
||||||
import { ItemData } from "./data/item-data.mjs";
|
import { ItemData } from "./data/item-data.mjs";
|
||||||
import { ArmorData } from "./data/armor-data.mjs";
|
import { ArmorData } from "./data/armor-data.mjs";
|
||||||
import { ZauberData } from "./data/zauber-data.mjs";
|
import { ZauberData } from "./data/zauber-data.mjs";
|
||||||
import { HintergrundData } from "./data/hintergrund-data.mjs";
|
import { HintergrundData } from "./data/hintergrund-data.mjs";
|
||||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
import { M6CharacterSheet } from "./sheets/character-sheet.mjs";
|
||||||
|
import { M6NSCSheet } from "./sheets/nsc-sheet.mjs";
|
||||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||||
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
||||||
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
||||||
import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs";
|
import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs";
|
||||||
import { M6HintergrundSheet } from "./sheets/hintergrund-sheet.mjs";
|
import { M6HintergrundSheet } from "./sheets/hintergrund-sheet.mjs";
|
||||||
|
import { M6ActiveEffect } from "./active-effects/m6-active-effects.mjs";
|
||||||
import { M6ChatMessage } from "./ui/chat-message.mjs";
|
import { M6ChatMessage } from "./ui/chat-message.mjs";
|
||||||
import "./styles/M6.scss";
|
import "./styles/M6.scss";
|
||||||
|
|
||||||
Hooks.once("init", () => {
|
Hooks.once("init", () => {
|
||||||
|
CONFIG.statusEffects = [
|
||||||
|
{
|
||||||
|
id: "verwundet",
|
||||||
|
name: "Verwundet",
|
||||||
|
img: "icons/svg/bones.svg",
|
||||||
|
changes: [
|
||||||
|
{ key: "@athletik.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{
|
||||||
|
key: "@beweglichkeit.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{ key: "@heimlichkeit.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{
|
||||||
|
key: "@fingerfertigkeit.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{ key: "@fernkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
{ key: "@nahkampf.nachteil", mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD, value: "1" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "erschöpft",
|
||||||
|
name: "Erschöpft",
|
||||||
|
img: "icons/svg/downgrade.svg",
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: "@reflexe.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "@willenskraft.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "@zähigkeit.nachteil",
|
||||||
|
mode: CONST.ACTIVE_EFFECT_CHANGE_TYPES.ADD,
|
||||||
|
value: "1",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ id: "dead", name: "Tot", img: "icons/svg/skull.svg" },
|
||||||
|
{ id: "invisible", name: "Unsichtbar", img: "icons/svg/invisible.svg" },
|
||||||
|
{ id: "blind", name: "Blind", img: "icons/svg/blind.svg" },
|
||||||
|
];
|
||||||
|
CONFIG.specialStatusEffects = {
|
||||||
|
VERWUNDET: "verwundet",
|
||||||
|
ERSCHÖPFT: "erschöpft",
|
||||||
|
DEFEATED: "dead",
|
||||||
|
INVISIBLE: "invisible",
|
||||||
|
BLIND: "blind",
|
||||||
|
};
|
||||||
|
|
||||||
CONFIG.ChatMessage.documentClass = M6ChatMessage;
|
CONFIG.ChatMessage.documentClass = M6ChatMessage;
|
||||||
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
||||||
|
|
||||||
CONFIG.Actor.dataModels.character = CharacterData;
|
CONFIG.ActiveEffect.documentClass = M6ActiveEffect;
|
||||||
|
CONFIG.Actor.dataModels = {
|
||||||
|
character: CharacterData,
|
||||||
|
nsc: NSCData,
|
||||||
|
};
|
||||||
|
CONFIG.Item.dataModels = {
|
||||||
|
item: ItemData,
|
||||||
|
geld: ItemData,
|
||||||
|
weapon: WeaponData,
|
||||||
|
armor: ArmorData,
|
||||||
|
zauber: ZauberData,
|
||||||
|
hintergrund: HintergrundData,
|
||||||
|
};
|
||||||
CONFIG.Actor.trackableAttributes = {
|
CONFIG.Actor.trackableAttributes = {
|
||||||
pc: {
|
pc: {
|
||||||
bar: ["resources.leben", "resources.ausdauer"],
|
bar: ["resources.leben", "resources.ausdauer"],
|
||||||
value: ["level"]
|
value: ["schicksalsmünzen"],
|
||||||
},
|
},
|
||||||
npc: {
|
npc: {
|
||||||
bar: ["resources.leben", "resources.ausdauer"],
|
bar: ["resources.leben", "resources.ausdauer"],
|
||||||
value: []
|
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, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
|
Actor,
|
||||||
|
"midgard6-lvd",
|
||||||
|
M6CharacterSheet,
|
||||||
|
{
|
||||||
types: ["character"],
|
types: ["character"],
|
||||||
makeDefault: true
|
makeDefault: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6NSCSheet, {
|
||||||
|
types: ["nsc"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
||||||
types: ["item"],
|
types: ["item"],
|
||||||
makeDefault: true
|
makeDefault: true,
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
||||||
types: ["geld"]
|
types: ["geld"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6WeaponSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6WeaponSheet, {
|
||||||
types: ["weapon"]
|
types: ["weapon"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
||||||
types: ["armor"]
|
types: ["armor"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ZauberSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ZauberSheet, {
|
||||||
types: ["zauber"]
|
types: ["zauber"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["gunst"]
|
types: ["gunst"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["makel"]
|
types: ["makel"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["schicksalsgabe"]
|
types: ["schicksalsgabe"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["legende"]
|
types: ["legende"],
|
||||||
}
|
},
|
||||||
|
);
|
||||||
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
|
Item,
|
||||||
|
"midgard6-lvd",
|
||||||
|
M6HintergrundSheet,
|
||||||
|
{
|
||||||
|
types: ["merkmal"],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -112,7 +193,7 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
|||||||
content.classList.toggle("active");
|
content.classList.toggle("active");
|
||||||
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
||||||
},
|
},
|
||||||
{ capture: true }
|
{ capture: true },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CharacterData } from "../data/character-data";
|
import { CharacterData } from "../data/character-data";
|
||||||
|
import { NSCData } from "../data/ncs-data";
|
||||||
import { ItemData } from "../data/item-data";
|
import { ItemData } from "../data/item-data";
|
||||||
import { WeaponData } from "../data/weapon-data";
|
import { WeaponData } from "../data/weapon-data";
|
||||||
import { ArmorData } from "../data/armor-data";
|
import { ArmorData } from "../data/armor-data";
|
||||||
@@ -7,7 +8,7 @@ import { HintergrundData } from "../data/hintergrund-data";
|
|||||||
|
|
||||||
declare module "fvtt-types/configuration" {
|
declare module "fvtt-types/configuration" {
|
||||||
interface DataModelConfig {
|
interface DataModelConfig {
|
||||||
Actor: { character: typeof CharacterData };
|
Actor: { character: typeof CharacterData, nsc: typeOf NSCData };
|
||||||
Item: {
|
Item: {
|
||||||
item: typeof ItemData,
|
item: typeof ItemData,
|
||||||
weapon: typeof WeaponData,
|
weapon: typeof WeaponData,
|
||||||
|
|||||||
+6
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "midgard6-lvd",
|
"id": "midgard6-lvd",
|
||||||
"version": "0.9.0",
|
"version": "1.1.0",
|
||||||
"title": "Midgard: Legenden von Damatu",
|
"title": "Midgard: Legenden von Damatu",
|
||||||
"url": "",
|
"url": "",
|
||||||
"description": "Eine Midgard: LvD implementation",
|
"description": "Eine Midgard: LvD implementation",
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
],
|
],
|
||||||
"documentTypes": {
|
"documentTypes": {
|
||||||
"Actor": {
|
"Actor": {
|
||||||
"character": {}
|
"character": {},
|
||||||
|
"nsc": {}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": {},
|
"item": {},
|
||||||
@@ -41,11 +42,12 @@
|
|||||||
"makel": {},
|
"makel": {},
|
||||||
"schicksalsgabe": {},
|
"schicksalsgabe": {},
|
||||||
"legende": {},
|
"legende": {},
|
||||||
"geld": {}
|
"geld": {},
|
||||||
|
"merkmal": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "14",
|
||||||
"verified": "14"
|
"verified": "14"
|
||||||
},
|
},
|
||||||
"manifest": "",
|
"manifest": "",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
||||||
<a
|
<a
|
||||||
class="col-8"
|
class="col-8"
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
}}</p>
|
}}</p>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<div class="d-flex justify-content-center align-items-center">
|
<div class="d-flex justify-content-center align-items-center">
|
||||||
<a
|
<a
|
||||||
class=""
|
class=""
|
||||||
data-action="rollSkill"
|
data-action="roll"
|
||||||
data-name="{{localize localizationName}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-path="{{field.fieldPath}}"
|
data-path="{{field.fieldPath}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -93,8 +93,8 @@
|
|||||||
<input
|
<input
|
||||||
class="resistenzenAttribut"
|
class="resistenzenAttribut"
|
||||||
type="number"
|
type="number"
|
||||||
name="{{field.fieldPath}}"
|
name="{{field.fields.value.fieldPath}}"
|
||||||
value="{{value}}"
|
value="{{value.value}}"
|
||||||
{{#if @root.system.locked}}disabled{{/if}}
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -202,7 +202,7 @@
|
|||||||
<a
|
<a
|
||||||
class="item-control"
|
class="item-control"
|
||||||
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||||
data-action="rollWeapon"
|
data-action="roll"
|
||||||
data-item-id="{{weapon.id}}"
|
data-item-id="{{weapon.id}}"
|
||||||
data-skillPath="{{weapon.path}}"
|
data-skillPath="{{weapon.path}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
@@ -261,7 +261,7 @@
|
|||||||
<a
|
<a
|
||||||
class="item-control"
|
class="item-control"
|
||||||
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||||
data-action="rollSpell"
|
data-action="roll"
|
||||||
data-item-id="{{weapon.id}}"
|
data-item-id="{{weapon.id}}"
|
||||||
data-skillPath="{{weapon.path}}"
|
data-skillPath="{{weapon.path}}"
|
||||||
{{#unless @root.editable}}disabled{{/unless}}
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
|||||||
@@ -81,6 +81,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
{{#with itemTypes.gunst}}
|
{{#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|}}
|
{{#each this.items as |gunst|}}
|
||||||
<div
|
<div
|
||||||
class="collapsible"
|
class="collapsible"
|
||||||
@@ -90,8 +106,15 @@
|
|||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
>{{gunst.name}}
|
>{{gunst.name}}
|
||||||
<div>
|
<div>
|
||||||
<i class="fas fa-expand"></i>
|
<i data-action="collapsible" class="fas fa-expand"></i>
|
||||||
{{#if @root.editable}}
|
{{#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
|
<a
|
||||||
class="item-control item-delete"
|
class="item-control item-delete"
|
||||||
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
||||||
@@ -112,6 +135,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
{{#with itemTypes.makel}}
|
{{#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|}}
|
{{#each this.items as |makel|}}
|
||||||
<div
|
<div
|
||||||
type="button"
|
type="button"
|
||||||
@@ -122,11 +161,18 @@
|
|||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
>{{makel.name}}
|
>{{makel.name}}
|
||||||
<div>
|
<div>
|
||||||
<i class="fas fa-expand"></i>
|
<i data-action="collapsible" class="fas fa-expand"></i>
|
||||||
{{#if @root.editable}}
|
{{#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
|
<a
|
||||||
class="item-control item-delete"
|
class="item-control item-delete"
|
||||||
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
title="{{localize 'DOCUMENT.Delete' type=makel.name}}"
|
||||||
style="z-index:9999"
|
style="z-index:9999"
|
||||||
data-action="deleteDoc"
|
data-action="deleteDoc"
|
||||||
>
|
>
|
||||||
@@ -147,26 +193,23 @@
|
|||||||
|
|
||||||
<div class="col-6" style="height: 100%">
|
<div class="col-6" style="height: 100%">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "Midgard6.Hintergrund.type.legende.plural"}}</legend>
|
<legend>{{localize "Midgard6.Hintergrund.type.legende.plural"}}
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
{{#with itemTypes.legende}}
|
|
||||||
<div class="itemHeader" style="margin-bottom: 8px">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless @root.system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="legende"
|
data-type="legende"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{#with itemTypes.legende}}
|
||||||
{{#each this.items as |legende|}}
|
{{#each this.items as |legende|}}
|
||||||
<div
|
<div
|
||||||
class="collapsible"
|
class="collapsible"
|
||||||
@@ -176,7 +219,9 @@
|
|||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
>{{legende.name}}
|
>{{legende.name}}
|
||||||
<div>
|
<div>
|
||||||
<i class="fas fa-expand"></i>
|
<i data-action="collapsible" class="fas fa-expand"></i>
|
||||||
|
|
||||||
|
{{#if @root.editable}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-edit"
|
class="item-control item-edit"
|
||||||
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
@@ -184,7 +229,6 @@
|
|||||||
>
|
>
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
</a>
|
</a>
|
||||||
{{#if @root.editable}}
|
|
||||||
<a
|
<a
|
||||||
class="item-control item-delete"
|
class="item-control item-delete"
|
||||||
title="{{localize 'DOCUMENT.Delete' type=legende.name}}"
|
title="{{localize 'DOCUMENT.Delete' type=legende.name}}"
|
||||||
@@ -209,26 +253,23 @@
|
|||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "Midgard6.Hintergrund.type.schicksalsgabe.plural"}}</legend>
|
<legend>{{localize "Midgard6.Hintergrund.type.schicksalsgabe.plural"}}
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
{{#with itemTypes.schicksalsgabe}}
|
|
||||||
<div class="itemHeader" style="margin-bottom: 8px">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless @root.system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="schicksalsgabe"
|
data-type="schicksalsgabe"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{#with itemTypes.schicksalsgabe}}
|
||||||
{{#each this.items as |schicksalsgabe|}}
|
{{#each this.items as |schicksalsgabe|}}
|
||||||
<div
|
<div
|
||||||
class="collapsible"
|
class="collapsible"
|
||||||
@@ -238,8 +279,15 @@
|
|||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
>{{schicksalsgabe.name}}
|
>{{schicksalsgabe.name}}
|
||||||
<div>
|
<div>
|
||||||
<i class="fas fa-expand"></i>
|
<i data-action="collapsible" class="fas fa-expand"></i>
|
||||||
{{#if @root.editable}}
|
{{#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
|
<a
|
||||||
class="item-control item-delete"
|
class="item-control item-delete"
|
||||||
title="{{localize 'DOCUMENT.Delete' type=schicksalsgabe.name}}"
|
title="{{localize 'DOCUMENT.Delete' type=schicksalsgabe.name}}"
|
||||||
@@ -253,7 +301,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{{gunst.system.beschreibung}}}
|
{{{schicksalsgabe.system.beschreibung}}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|||||||
+24
-46
@@ -4,25 +4,22 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<fieldset >
|
<fieldset >
|
||||||
<legend>{{localize "Midgard6.Item.type.münze.plural" }}</legend>
|
<legend>{{localize "Midgard6.Item.type.münze.plural" }}
|
||||||
<ul class="itemTypes">
|
|
||||||
{{#with itemTypes.geld}}
|
|
||||||
<li class="itemHeader">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="geld"
|
data-type="geld"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</li>
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.geld}}
|
||||||
<ul class="items">
|
<ul class="items">
|
||||||
{{#each this.items as |item|}}
|
{{#each this.items as |item|}}
|
||||||
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
@@ -68,25 +65,22 @@
|
|||||||
{{/with}}
|
{{/with}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset >
|
<fieldset >
|
||||||
<legend>{{localize "Midgard6.Item.type.item.plural" }}</legend>
|
<legend>{{localize "Midgard6.Item.type.item.plural" }}
|
||||||
<ul class="itemTypes">
|
|
||||||
{{#with itemTypes.item}}
|
|
||||||
<li class="itemHeader">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="item"
|
data-type="item"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</li>
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.item}}
|
||||||
<ul class="items">
|
<ul class="items">
|
||||||
{{#each this.items as |item|}}
|
{{#each this.items as |item|}}
|
||||||
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
@@ -120,25 +114,22 @@
|
|||||||
{{!-- Waffen --}}
|
{{!-- Waffen --}}
|
||||||
|
|
||||||
<fieldset class="highlight">
|
<fieldset class="highlight">
|
||||||
<legend>{{localize "Midgard6.Item.type.weapon.plural" }}</legend>
|
<legend>{{localize "Midgard6.Item.type.weapon.plural" }}
|
||||||
<ul class="itemTypes">
|
|
||||||
{{#with itemTypes.weapon}}
|
|
||||||
<li class="itemHeader">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="weapon"
|
data-type="weapon"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</li>
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.weapon}}
|
||||||
<ul class="items">
|
<ul class="items">
|
||||||
{{#each this.items as |item|}}
|
{{#each this.items as |item|}}
|
||||||
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
@@ -171,27 +162,23 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{!-- Rüstung --}}
|
{{!-- Rüstung --}}
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "Midgard6.Item.type.armor.plural" }}</legend>
|
<legend>{{localize "Midgard6.Item.type.armor.plural" }}
|
||||||
<ul class="itemTypes">
|
|
||||||
{{#with itemTypes.armor}}
|
|
||||||
<li class="itemHeader">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="armor"
|
data-type="armor"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type=this.label}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</li>
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.armor}}
|
||||||
<ul class="items">
|
<ul class="items">
|
||||||
{{#each this.items as |item|}}
|
{{#each this.items as |item|}}
|
||||||
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
@@ -225,13 +212,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="sticky-progress-container">
|
|
||||||
<div class="progress-background">
|
|
||||||
<progress
|
|
||||||
class="progress-bar"
|
|
||||||
value="{{gewicht.gewicht}}"
|
|
||||||
max="{{gewicht.traglast}}"
|
|
||||||
></progress>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
+12
-13
@@ -4,33 +4,31 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<fieldset >
|
<fieldset >
|
||||||
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}</legend>
|
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}
|
||||||
|
|
||||||
<ul class="itemTypes">
|
|
||||||
<li class="itemHeader">
|
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
<a
|
<a
|
||||||
class="item-control item-create"
|
class="item-control item-create"
|
||||||
title="{{localize 'DOCUMENT.Create' type="Zauber"}}"
|
|
||||||
data-action="createDoc"
|
data-action="createDoc"
|
||||||
data-document-class="Item"
|
data-document-class="Item"
|
||||||
data-type="zauber"
|
data-type="zauber"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.Create" type="Zauber"}}
|
|
||||||
</a>
|
</a>
|
||||||
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</legend>
|
||||||
</li>
|
|
||||||
|
<ul class="itemTypes">
|
||||||
<ul class="items">
|
<ul class="items">
|
||||||
{{#each zauber as |zauber|}}
|
{{#with itemTypes.zauber}}
|
||||||
<li class="item row align-content-center draggable" data-item-id="{{zauber._id}}" data-type="Zauber" data-document-class="Item">
|
{{#each this.items as |zauber|}}
|
||||||
|
<li class="item row align-content-center draggable" data-item-id="{{zauber.id}}" data-type="Item" data-document-class="Item">
|
||||||
<p class="col-3" style="padding-top: 8px">{{zauber.name}}</p>
|
<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-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
||||||
<p class="col-2 item-name">{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}</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>
|
<a class="align-self-center col-2 fa-solid fa-dice-d20" data-action="roll" {{#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">
|
<div class="col-1 d-flex document-controls" style="margin: 0.5rem 0; padding: 0">
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
<a
|
<a
|
||||||
@@ -51,6 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if merkmale}}
|
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
{{#each merkmale as |merkmal|}}
|
{{#each merkmale as |merkmal|}}
|
||||||
|
{{#if merkmal}}
|
||||||
<div class="tag">{{merkmal}}</div>
|
<div class="tag">{{merkmal}}</div>
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
{{#if isRoll}}
|
{{#if isRoll}}
|
||||||
{{#each message.content as |roll|}}
|
{{#each message.content as |roll|}}
|
||||||
<fieldset>
|
<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>
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<section class="standard-form" style="margin-bottom: 1rem">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.NSC.kompetenz.kompetenz"}}</legend>
|
||||||
|
<div class="">
|
||||||
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
style="margin-left: 8px; max-width:10rem"
|
||||||
|
name="fertigkeitsName"
|
||||||
|
id="fertigkeitsName"
|
||||||
|
placeholder="Fertigkeits Name"
|
||||||
|
value="{{fertigkeit.name}}"
|
||||||
|
/>
|
||||||
|
<div class="flexrow" style="padding-left: 8px">
|
||||||
|
<div class="segmented-button-row">
|
||||||
|
<!-- Option 1 -->
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.kompetenz"}}:</p>
|
||||||
|
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="kompetenz-segment" value="-1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.miserabel"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 2 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="kompetenz-segment" value="0" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.mittelmäßig"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 3 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="kompetenz-segment" value="1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.kompetent"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<section class="standard-form" style="margin-bottom: 1rem">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Attribute.resistenzen"}}
|
||||||
|
{{localize "Midgard6.NSC.kompetenz.kompetenz"}}</legend>
|
||||||
|
{{#each resistenzen}}
|
||||||
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
|
<div class="flexrow" style="padding-left: 8px">
|
||||||
|
<div class="segmented-button-row">
|
||||||
|
<!-- Option 1 -->
|
||||||
|
<p class="text highlight">{{localizeConcat "Midgard6.Resistenzen." @key}}</p>
|
||||||
|
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="-1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.miserabel"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 2 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="0" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.mittelmäßig"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 3 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.kompetent"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -3,50 +3,57 @@
|
|||||||
<legend>Modifikation</legend>
|
<legend>Modifikation</legend>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{! <div class="d-flex align-items-center"> }}
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="col-6">
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
style="margin-left: 8px;"
|
|
||||||
name="customRoll"
|
name="customRoll"
|
||||||
id="rollDisplay"
|
id="rollDisplay"
|
||||||
placeholder="1d20 + {{skillValue}}"
|
placeholder="1d20 + {{skillValue}}"
|
||||||
value="{{customRoll}}"
|
value="{{customRoll}}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex col-6" style="padding-left: 8px;">
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="segmented-button-row">
|
<div class="segmented-button-row">
|
||||||
<!-- Option 1 -->
|
<!-- Option 1 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="-1" />
|
<input type="radio" name="vorteil-segment" value="-1" data-value="-1" />
|
||||||
<span class="segmented-button__content">
|
<span class="segmented-button__content">
|
||||||
<i class="icon fa-solid fa-arrow-down" style="color:red"></i>
|
<i class="icon fa-solid fa-caret-down"></i>
|
||||||
<i class="icon fa-solid fa-dice-d20" style=""></i>
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- Option 2 -->
|
<!-- Option 2 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="0" checked />
|
<input type="radio" name="vorteil-segment" value="0" data-value="0" checked />
|
||||||
<span class="segmented-button__content">
|
<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>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- Option 3 -->
|
<!-- Option 3 -->
|
||||||
<label class="segmented-button">
|
<label class="segmented-button">
|
||||||
<input type="radio" name="vorteil-segment" value="1" />
|
<input type="radio" name="vorteil-segment" value="1" data-value="1"/>
|
||||||
<span class="segmented-button__content">
|
<span class="segmented-button__content">
|
||||||
<i class="icon fa-solid fa-dice-d20" style=""></i>
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
<i class="icon fa-solid fa-arrow-up" style="color:blue"></i>
|
<i class="icon fa-solid fa-caret-up"></i>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{! </div> }}
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="col-12 d-flex">
|
{{#if damageRoll}}
|
||||||
<div class="flexrow" style="padding-left: 8px">
|
<input
|
||||||
|
type="text"
|
||||||
|
name="customDamageRoll"
|
||||||
|
id="rollDamageDisplay"
|
||||||
|
placeholder="{{damageRoll}}"
|
||||||
|
value="{{customDamageRoll}}"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="col-6 d-flex" style="margin-bottom: 4px">
|
||||||
<div class="segmented-button-row">
|
<div class="segmented-button-row">
|
||||||
<!-- Option 1 -->
|
<!-- Option 1 -->
|
||||||
{{#each bonuses}}
|
{{#each bonuses}}
|
||||||
@@ -66,26 +73,12 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
{{#if damageRoll}}
|
<select name="rollMode" data-type="String">
|
||||||
<div class="col-6">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
style="margin-left: 8px;"
|
|
||||||
name="customRollDamage"
|
|
||||||
id="rollDamageDisplay"
|
|
||||||
placeholder="{{damageRoll}}"
|
|
||||||
value="{{customDamageRoll}}"
|
|
||||||
/>
|
|
||||||
</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}}
|
{{selectOptions rollModes selected=rollMode localize=true}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<input class="right" type="text" placeholder="{{localize "Midgard6.Hintergrund.gruppe"}}" name="system.gruppe" value="{{system.gruppe}}" />
|
<input class="right" type="text" placeholder="{{localize "Midgard6.Hintergrund.gruppe"}}" name="system.gruppe" value="{{system.gruppe}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
{{#ifeq item.type "legende"}}
|
||||||
<select
|
<select
|
||||||
class="text right"
|
class="text right"
|
||||||
style="text-align: right"
|
style="text-align: right"
|
||||||
@@ -32,13 +33,14 @@
|
|||||||
id="linkId"
|
id="linkId"
|
||||||
placeholder="{{system.linkId}}"
|
placeholder="{{system.linkId}}"
|
||||||
>
|
>
|
||||||
<option {{#unless system.linkId}}selected{{/unless}}value=""></option>
|
<option {{#unless system.linkId}}selected{{/unless}}value="">Keine Schicksalsgabe</option>
|
||||||
{{#each schicksalsgaben as |schicksalsgabe|}}
|
{{#each schicksalsgaben as |schicksalsgabe|}}
|
||||||
<option {{#ifeq schicksalsgabe.id ../system.linkId}}selected{{/ifeq}} value="{{schicksalsgabe.id}}">
|
<option {{#ifeq schicksalsgabe.id ../system.linkId}}selected{{/ifeq}} value="{{schicksalsgabe.id}}">
|
||||||
{{schicksalsgabe.name}}
|
{{schicksalsgabe.name}}
|
||||||
</option>
|
</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</select>
|
</select>
|
||||||
|
{{/ifeq}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.anzahl"}}" name="system.anzahl" value="{{item.system.anzahl}}" />
|
<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>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<input class="custom-input left text" type="number" placeholder="{{localize "Midgard6.Gegenstand.wert"}}" name="system.wert" value="{{item.system.wert}}" />
|
<input class="custom-input left text" type="number" placeholder="{{localize "Midgard6.Gegenstand.wert"}}" name="system.wert" value="{{item.system.wert}}" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>{{localize "Midgard6.Item.rüstwert"}}</p>
|
<p>{{localize "Midgard6.Item.rüstwert"}}</p>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>{{localize "Midgard6.Item.schaden"}}</p>
|
<p>{{localize "Midgard6.Item.schaden"}}</p>
|
||||||
<input
|
<input
|
||||||
@@ -21,8 +21,37 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6"></div>
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="col-6">
|
<div class="segmented-button-row">
|
||||||
|
<!-- Option 1 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="system.angriffMod" value="-1" data-value="-1" {{#ifeq system.angriffMod -1 }}checked{{/ifeq}}/>
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<i class="icon fa-solid fa-caret-down"></i>
|
||||||
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 2 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="system.angriffMod" value="0" data-value="0" {{#ifeq system.angriffMod 0 }}checked{{/ifeq}} />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<i class="icon fa-solid fa-dice-d20" ></i>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 3 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="system.angriffMod" value="1" data-value="1"{{#ifeq system.angriffMod 1 }}checked{{/ifeq}}/>
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<i class="icon fa-solid fa-dice-d20"></i>
|
||||||
|
<i class="icon fa-solid fa-caret-up"></i>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6" style="margin-bottom: 4px">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>{{localize "Midgard6.Item.fertigkeit"}}</p>
|
<p>{{localize "Midgard6.Item.fertigkeit"}}</p>
|
||||||
<select
|
<select
|
||||||
@@ -31,7 +60,7 @@
|
|||||||
name="system.fertigkeit"
|
name="system.fertigkeit"
|
||||||
id="fertigkeit"
|
id="fertigkeit"
|
||||||
placeholder="Nahkampf"
|
placeholder="Nahkampf"
|
||||||
/>
|
>
|
||||||
<option {{#ifeq system.fertigkeit "system.skills.kampf.fernkampf"}}selected{{/ifeq}} value="system.skills.kampf.fernkampf">{{localize
|
<option {{#ifeq system.fertigkeit "system.skills.kampf.fernkampf"}}selected{{/ifeq}} value="system.skills.kampf.fernkampf">{{localize
|
||||||
"Midgard6.Skills.fernkampf"
|
"Midgard6.Skills.fernkampf"
|
||||||
}}</option>
|
}}</option>
|
||||||
@@ -50,8 +79,8 @@
|
|||||||
name="system.spezialisierung"
|
name="system.spezialisierung"
|
||||||
id="system.spezialisierung"
|
id="system.spezialisierung"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
/>
|
>
|
||||||
<option {{#ifeq system.spezialisierung ""}}selected{{/ifeq}} value=""></option>
|
<option {{#ifeq system.spezialisierung ""}}selected{{/ifeq}} value="">Keine Spezialisierung</option>
|
||||||
{{#each bonuses as |bonus|}}
|
{{#each bonuses as |bonus|}}
|
||||||
<option {{#ifeq bonus.name ../system.spezialisierung}}selected{{/ifeq}} value="{{bonus.name}}">
|
<option {{#ifeq bonus.name ../system.spezialisierung}}selected{{/ifeq}} value="{{bonus.name}}">
|
||||||
{{bonus.name}}
|
{{bonus.name}}
|
||||||
@@ -63,7 +92,7 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>{{localize "Midgard6.Item.waffenmerkmale"}}</p>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{{! Beschreibung Allgemein Tab }}
|
||||||
|
<section
|
||||||
|
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||||
|
data-tab="{{tab.id}}"
|
||||||
|
data-group="{{tab.group}}"
|
||||||
|
>
|
||||||
|
<fieldset style="height:100%">
|
||||||
|
<legend>{{localize "Midgard6.Sheets.Tabs.biographie"}}</legend>
|
||||||
|
{{#if editable}}
|
||||||
|
<prose-mirror
|
||||||
|
style="height:100%"
|
||||||
|
name="system.biographie.beschreibung"
|
||||||
|
data-document-u-u-i-d="{{actor.uuid}}"
|
||||||
|
value="{{system.biographie.beschreibung}}"
|
||||||
|
collaborate="true"
|
||||||
|
toggled="true"
|
||||||
|
>
|
||||||
|
{{{enrichedBeschreibung}}}
|
||||||
|
</prose-mirror>
|
||||||
|
{{else}}
|
||||||
|
{{{enrichedBeschreibung}}}
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,367 @@
|
|||||||
|
<section
|
||||||
|
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||||
|
data-tab="{{tab.id}}"
|
||||||
|
data-group="{{tab.group}}"
|
||||||
|
>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.NSC.kompetenz.würfe"}}</legend>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div></div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="white-space: nowrap; position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.kompetent"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.kompetent"}}" data-kompetenz-value="{{kompetenzWürfe.kompetent}}">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ {{kompetenzWürfe.kompetent}}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.mittelmäßig"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.mittelmäßig"}}" data-kompetenz-value="{{kompetenzWürfe.mittelmäßig}}">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ {{kompetenzWürfe.mittelmäßig}}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.miserabel"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.miserabel"}}" data-kompetenz-value="d3">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ d3</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Sheets.Tabs.eigenschaften"}}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.hinzufügen"}}"
|
||||||
|
data-action="addKompetenz"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
{{#each system.fertigkeiten as |fertigkeit|}}
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-6 d-flex align-items-center" style="width: 100%; margin-left: 0">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless @root.system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.bearbeiten"}}"
|
||||||
|
data-action="editKompetenz"
|
||||||
|
data-name="{{fertigkeit.name}}"
|
||||||
|
data-kompetenz="{{fertigkeit.kompetenz}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.löschen"}}"
|
||||||
|
data-action="deleteKompetenz"
|
||||||
|
data-name="{{fertigkeit.name}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
<a
|
||||||
|
class=""
|
||||||
|
data-action="rollKompetenz"
|
||||||
|
data-kompetenz="{{fertigkeit.name}}"
|
||||||
|
data-kompetenz-value="{{fertigkeit.wurf}}"
|
||||||
|
>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
{{fertigkeit.name}} <i class="fa-solid fa-dice-d20" style="margin-left: 8px; margin-right: 0"></i>+{{fertigkeit.wurf}}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
{{localize "Midgard6.NSC.merkmal.plural"}}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type="Merkmal"}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="merkmal"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{#with itemTypes.merkmal}}
|
||||||
|
{{#each this.items as |merkmal|}}
|
||||||
|
<div
|
||||||
|
class="collapsible"
|
||||||
|
data-action="collapsible"
|
||||||
|
data-item-id="{{merkmal._id}}"
|
||||||
|
data-type="Item"
|
||||||
|
data-document-class="Item"
|
||||||
|
>{{merkmal.name}}
|
||||||
|
<div>
|
||||||
|
<a>
|
||||||
|
<i data-action="collapsible" class="fas fa-expand"></i>
|
||||||
|
</a>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless @root.system.locked}}
|
||||||
|
<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=merkmal.name}}"
|
||||||
|
style="z-index:9999"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{{merkmal.system.beschreibung}}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<fieldset class="">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.resistenzen"}}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.hinzufügen"}}"
|
||||||
|
data-action="editResistenz"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<div class="row">
|
||||||
|
{{#each system.resistenzen as |resistenz|}}
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
|
<p class="resistenzenHeader">{{localizeConcat "Midgard6.Resistenzen." @key}}</p>
|
||||||
|
<div class="d-flex justify-content-center align-items-center">
|
||||||
|
<a
|
||||||
|
class=""
|
||||||
|
data-action="rollKompetenz"
|
||||||
|
data-kompetenz="{{localizeConcat "Midgard6.Resistenzen." @key}}"
|
||||||
|
data-kompetenz-value="{{resistenz.value}}"
|
||||||
|
>
|
||||||
|
<i class="fa-solid fa-dice-d20" style=""></i>
|
||||||
|
</a>
|
||||||
|
<input
|
||||||
|
class="resistenzenAttribut"
|
||||||
|
type="text"
|
||||||
|
value="{{resistenz.value}}"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="d-flex">
|
||||||
|
<fieldset class="col highlight">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.lp"}}</legend>
|
||||||
|
<div class="d-flex align-items-end">
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.aktuell"}}</p>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="armor-box">
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
|
<span class="armor-value">{{system.rüstwert.mod}}</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.leben.value"
|
||||||
|
value="{{system.resources.leben.value}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="center">/</p>
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.maximal.short"}}</p>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.leben.max"
|
||||||
|
value="{{system.resources.leben.max}}"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="col highlight">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.ap"}}</legend>
|
||||||
|
<div class="d-flex align-items-end">
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.aktuell"}}</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.ausdauer.value"
|
||||||
|
value="{{system.resources.ausdauer.value}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p class="center">/</p>
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.maximal.short"}}</p>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.ausdauer.max"
|
||||||
|
value="{{system.resources.ausdauer.max}}"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>
|
||||||
|
{{localize "Midgard6.NSC.angriff.plural" }}
|
||||||
|
</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each equippedWeapons as |weapon|}}
|
||||||
|
<div class="item row align-items-center">
|
||||||
|
<div class="col-10">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<img class="" style="margin-right: 4px" src="{{weapon.img}}" alt="{{weapon.name}}" width="24" height="24" />
|
||||||
|
<p>{{weapon.name}}: </p>
|
||||||
|
<p>
|
||||||
|
<i class="fas fa-dice-d20" style="font-size:12px; margin:0 2px 0 4px"></i>
|
||||||
|
+ {{weapon.skillValue}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-2 document-controls">
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||||
|
data-action="rollKompetenz"
|
||||||
|
data-name="{{weapon.name}}"
|
||||||
|
data-kompetenz-value="{{weapon.skillValue}}"
|
||||||
|
data-schaden="{{weapon.schaden}}"
|
||||||
|
data-item-id="{{weapon.id}}"
|
||||||
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
>
|
||||||
|
<i class="fas fa-dice-d20"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.armor.plural" }}</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each armor.armors as |armor|}}
|
||||||
|
<div class="item row align-items-center">
|
||||||
|
<div class="col-10">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<img class="" style="margin-right: 4px" src="{{armor.img}}" alt="{{armor.name}}" width="24" height="24" />
|
||||||
|
<p>{{armor.name}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<div class="armor-box" style="position: relative; margin-left: 0px; top: 12px">
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
|
<span class="armor-value" style="position: relative; right:-8px; top: -22px">{{armor.rüstwert}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{#if armor.einschränkungen}}
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.Item.einschränkung"}}</p>
|
||||||
|
<p>{{splitArray armor.einschränkungen}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each equippedSpells as |spell|}}
|
||||||
|
<div class="item row align-items-center">
|
||||||
|
<div class="col-10">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<img class="" style="margin-right: 4px" src="{{spell.img}}" alt="{{spell.name}}" width="24" height="24" />
|
||||||
|
<p>{{spell.name}}: </p>
|
||||||
|
<p>
|
||||||
|
<i class="fas fa-dice-d20" style="font-size:12px; margin:0 2px 0 4px"></i>
|
||||||
|
+ {{spell.skillValue}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-2 document-controls">
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
title="{{localize 'Midgard6.Angriff'}} {{spell.name}}"
|
||||||
|
data-action="rollKompetenz"
|
||||||
|
data-kompetenz-value="{{spell.skillValue}}"
|
||||||
|
data-schaden="{{spell.schaden}}"
|
||||||
|
data-item-id="{{spell.id}}"
|
||||||
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
>
|
||||||
|
<i class="fas fa-dice-d20"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<header class="sheet-header">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{actor.name}}" />
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.Biographie.spezies"}}" name="system.biographie.spezies" value="{{system.biographie.spezies}}" />
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.Biographie.kultur"}}" name="system.biographie.kultur" value="{{system.biographie.kultur}}" />
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
class="profile-img"
|
||||||
|
style="z-index:1"
|
||||||
|
src="{{actor.img}}"
|
||||||
|
alt="{{actor.name}}"
|
||||||
|
{{#if editable}}
|
||||||
|
data-action="editImage"
|
||||||
|
data-edit="img"
|
||||||
|
{{/if}}
|
||||||
|
data-tooltip="{{actor.name}}"
|
||||||
|
height="100" width="100"
|
||||||
|
>
|
||||||
|
<div class="col-6">
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text right" type="number" placeholder="{{localize "Midgard6.NSC.kompetenz"}}" name="system.kompetenz" value="{{system.kompetenz}}" />
|
||||||
|
<select
|
||||||
|
type="text"
|
||||||
|
class="text right"
|
||||||
|
name="system.größe"
|
||||||
|
id="system.größe"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
>
|
||||||
|
<option {{#ifeq system.größe "winzig"}}selected{{/ifeq}} value="winzig">{{localize
|
||||||
|
"Midgard6.NSC.Größe.winzig"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "klein"}}selected{{/ifeq}} value="klein">{{localize
|
||||||
|
"Midgard6.NSC.Größe.klein"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "normal"}}selected{{/ifeq}} value="normal">{{localize
|
||||||
|
"Midgard6.NSC.Größe.normal"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "groß"}}selected{{/ifeq}} value="groß">{{localize
|
||||||
|
"Midgard6.NSC.Größe.groß"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "riesig"}}selected{{/ifeq}} value="riesig">{{localize
|
||||||
|
"Midgard6.NSC.Größe.riesig"
|
||||||
|
}}</option>
|
||||||
|
</select>
|
||||||
|
<div></div>
|
||||||
|
{{!-- <input {{#if @root.system.locked}}disabled{{/if}} class="text right" type="text" placeholder="{{localize "Midgard6.Biographie.mondgestalt"}}" name="system.biographie.mondgestalt" value="{{system.biographie.mondgestalt}}" /> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
{{! Items Tab }}
|
||||||
|
<section class="standard-form tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="items">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<fieldset >
|
||||||
|
<legend>{{localize "Midgard6.Item.type.münze.plural" }}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="geld"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.geld}}
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<div class="document-controls">
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
data-action="decreaseDoc"
|
||||||
|
data-item-id="{{item._id}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-minus"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
data-action="increaseDoc"
|
||||||
|
data-item-id="{{item._id}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="document-controls">
|
||||||
|
<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=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset >
|
||||||
|
<legend>{{localize "Midgard6.Item.type.item.plural" }}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="item"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.item}}
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#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=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
{{!-- Waffen --}}
|
||||||
|
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.weapon.plural" }}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="weapon"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.weapon}}
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<a class="sword" data-action="cycleEquip" data-item-id="{{item._id}}" style="{{#if item.system.equipped}}background-color: var(--M6-text-brown){{/if}}">
|
||||||
|
</a>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#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=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{!-- Rüstung --}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Item.type.armor.plural" }}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="armor"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.armor}}
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<a class="fa-solid fa-shield" data-action="cycleEquip" data-item-id="{{item._id}}" style="{{#if item.system.equipped}}color: var(--M6-text-brown){{/if}}"></a>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#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=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{{! Items Tab }}
|
||||||
|
<section class="standard-form tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="zauber">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset >
|
||||||
|
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="zauber"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
|
||||||
|
<ul class="itemTypes">
|
||||||
|
<ul class="items">
|
||||||
|
{{#with itemTypes.zauber}}
|
||||||
|
{{#each this.item as |zauber|}}
|
||||||
|
<li class="item row align-content-center draggable" data-item-id="{{zauber.id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<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 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}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=zauber.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=zauber.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</ul>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{{! Effects Tab }}
|
{{! Effects Tab }}
|
||||||
<section class="tab effects flexcol scrollable {{tab.cssClass}}" data-group="primary" data-tab="effects">
|
<section class="tab effects flexcol scrollable {{tab.cssClass}}" data-group="primary" data-tab="effects">
|
||||||
|
<fieldset>
|
||||||
<ul class="effects-list">
|
<ul class="effects-list">
|
||||||
{{#each effects as |section sid|}}
|
{{#each effects as |section sid|}}
|
||||||
<li class="effects-header flexrow draggable" data-effect-type="{{section.type}}">
|
<li class="effects-header flexrow draggable" data-effect-type="{{section.type}}">
|
||||||
@@ -21,7 +22,6 @@
|
|||||||
data-img="icons/svg/aura.svg"
|
data-img="icons/svg/aura.svg"
|
||||||
>
|
>
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
{{localize "DOCUMENT.New" type=(localize "UTS.Effect.Label")}}
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<div class="effect-duration">{{effect.duration.label}}</div>
|
<div class="effect-duration">{{effect.duration.label}}</div>
|
||||||
<div class="document-controls flexrow">
|
<div class="document-controls flexrow">
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
<a class="effect-control" data-action="toggleEffect" title="{{localize 'UTS.Effect.Toggle'}}">
|
<a class="effect-control" data-action="toggleEffect" title="{{#if effect.disabled}}{{localize 'Midgard6.Effect.ToggleOn'}}{{else}}{{localize 'Midgard6.Effect.ToggleOff'}}{{/if}}">
|
||||||
<i class="fas {{#if effect.disabled}}fa-check{{else}}fa-times{{/if}}"></i>
|
<i class="fas {{#if effect.disabled}}fa-check{{else}}fa-times{{/if}}"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@@ -54,6 +54,8 @@
|
|||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
<hr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
+9
-10
@@ -1,15 +1,14 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [],
|
||||||
define: {
|
define: {
|
||||||
"process.env.NODE_ENV": JSON.stringify("production")
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: { api: "modern-compiler" }
|
scss: { api: "modern-compiler" },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: "dist",
|
outDir: "dist",
|
||||||
@@ -17,13 +16,13 @@ export default defineConfig({
|
|||||||
lib: {
|
lib: {
|
||||||
entry: "src/system.mjs",
|
entry: "src/system.mjs",
|
||||||
formats: ["es"],
|
formats: ["es"],
|
||||||
fileName: () => "system.mjs"
|
fileName: () => "system.mjs",
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
// single-file bundle, no code-splitting: Foundry loads this one ESM file directly
|
// single-file bundle, no code-splitting: Foundry loads this one ESM file directly
|
||||||
inlineDynamicImports: true
|
inlineDynamicImports: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user