functioning spells & more
This commit is contained in:
1 parent
2291c5d1e6
commit
e4eecb7b8e
28 files changed
+681
-131
No files matched your search
@@ -4,13 +4,14 @@ function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const baseData = ItemData.defineSchema();
|
||||
const extendData = {
|
||||
rüstung: new fields.NumberField({
|
||||
rüstwert: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 1,
|
||||
min: 0
|
||||
}),
|
||||
zusätzlich: new fields.BooleanField({ inital: false }),
|
||||
equipped: new fields.BooleanField({ inital: false })
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ function defineSchema() {
|
||||
spezies: new fields.StringField({ initial: "" }),
|
||||
kultur: new fields.StringField({ initial: "" })
|
||||
}),
|
||||
rüstwert: new fields.NumberField({ initial: 0, min: 0 }),
|
||||
resources: new fields.SchemaField({
|
||||
leben: new fields.SchemaField({
|
||||
value: new fields.NumberField({
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
beschreibung: new fields.HTMLField({ initial: "" }),
|
||||
eigenschaften: new fields.SchemaField({
|
||||
stufe: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 1,
|
||||
min: 0,
|
||||
max: 3
|
||||
}),
|
||||
ursprung: new fields.StringField({ initial: "Kleiner Zauber" }),
|
||||
schaden: new fields.StringField({ initial: "" }),
|
||||
zauberdauer: new fields.StringField({ intial: "1 Aktion" }),
|
||||
wirkungsdauer: new fields.StringField({ intial: "" }),
|
||||
ziel: new fields.StringField({ intial: "selbst" }),
|
||||
reichweite: new fields.StringField({ intial: "" })
|
||||
}),
|
||||
equipped: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
||||
export class ZauberData extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
@@ -3,6 +3,10 @@ export const loadHelpers = async function () {
|
||||
return arg1 == arg2 ? options.fn(this) : options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("unlesseq", function (arg1, arg2, options) {
|
||||
return arg1 != arg2 ? options.fn(this) : options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("fetchPath", function (actor, arg1, arg2 = "") {
|
||||
let arg = arg1;
|
||||
if (typeof arg2 === "string") {
|
||||
@@ -15,4 +19,8 @@ export const loadHelpers = async function () {
|
||||
Handlebars.registerHelper("isdefined", function (value) {
|
||||
return value !== undefined;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("localizeConcat", function (arg1, arg2) {
|
||||
return game.i18n?.localize(arg1 + arg2);
|
||||
});
|
||||
};
|
||||
@@ -17,6 +17,49 @@ export class M6ArmorSheet extends M6ItemSheet {
|
||||
};
|
||||
}
|
||||
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "eigenschaften",
|
||||
icon: "fa-shield-halved"
|
||||
},
|
||||
{
|
||||
id: "beschreibung",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "eigenschaften",
|
||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
header: {
|
||||
template: systemPath("templates/item/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: systemPath("templates/shared/tabs.hbs")
|
||||
},
|
||||
eigenschaften: {
|
||||
template: systemPath("templates/item/rüstung/eigenschaften.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
beschreibung: {
|
||||
template: systemPath("templates/item/description.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
effects: {
|
||||
template: systemPath("templates/shared/effects.hbs"),
|
||||
scrollable: [""]
|
||||
}
|
||||
};
|
||||
|
||||
static #cycleEquip() {
|
||||
this.item.update({
|
||||
system: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
||||
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
||||
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
@@ -25,6 +26,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
toggleEffect: this.#toggleEffect,
|
||||
rollSkill: this.#rollSkill,
|
||||
rollWeapon: this.#rollWeapon,
|
||||
rollSpell: this.#rollSpell,
|
||||
cycleEquip: this.#cycleEquip,
|
||||
addSpezialisierung: addSpezialisierung,
|
||||
editSepzialisierung: editSepzialisierung
|
||||
@@ -41,23 +43,24 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "properties",
|
||||
id: "eigenschaften",
|
||||
icon: "fa-shield-halved"
|
||||
},
|
||||
|
||||
{
|
||||
id: "items",
|
||||
icon: "fa-suitcase"
|
||||
},
|
||||
{
|
||||
id: "biographie",
|
||||
icon: "fa-feather"
|
||||
id: "zauber",
|
||||
icon: "fa-hand-sparkles"
|
||||
},
|
||||
{
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "properties",
|
||||
initial: "eigenschaften",
|
||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
@@ -67,13 +70,17 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
template: systemPath("templates/shared/tabs.hbs")
|
||||
},
|
||||
header: {
|
||||
template: systemPath("templates/actor/header.hbs")
|
||||
},
|
||||
properties: {
|
||||
template: systemPath("templates/shared/properties.hbs"),
|
||||
eigenschaften: {
|
||||
template: systemPath("templates/actor/eigenschaften.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
zauber: {
|
||||
template: systemPath("templates/actor/zauber.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
items: {
|
||||
@@ -106,6 +113,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
/** @inheritdoc */
|
||||
async _prepareContext(options) {
|
||||
const context = await super._prepareContext(options);
|
||||
await prepArmor(this.actor);
|
||||
|
||||
Object.assign(context, {
|
||||
owner: this.document.isOwner,
|
||||
@@ -125,23 +133,24 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
/** @inheritdoc */
|
||||
async _preparePartContext(partId, context) {
|
||||
switch (partId) {
|
||||
// case "stats":
|
||||
// context.fields = await this._getResources();
|
||||
// context.tab = context.tabs[partId];
|
||||
// break;
|
||||
case "effects":
|
||||
context.effects = prepareActiveEffectCategories(this.actor.allApplicableEffects());
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "properties":
|
||||
case "eigenschaften":
|
||||
context.skills = await this._getSkills();
|
||||
context.resistenzen = await this._getResistenzen();
|
||||
context.equippedWeapons = await this._prepWeapons();
|
||||
context.equippedWeapons = await prepWeapons(this.actor);
|
||||
context.equippedSpells = await prepSpells(this.actor);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "items":
|
||||
context.itemTypes = await this._getItems();
|
||||
context.gewicht = this._clacWeight();
|
||||
context.gewicht = await prepWeight(this.actor);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "zauber":
|
||||
context.zauber = await this._getZauber();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
}
|
||||
@@ -257,28 +266,10 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
async _prepWeapons() {
|
||||
const weaponItems = this.actor.items.filter((x) => x.type === "weapon" && x.system.equipped);
|
||||
const weapons = [];
|
||||
weaponItems.forEach((weapon) => {
|
||||
const skill = foundry.utils.getProperty(this.actor, weapon.system.fertigkeit);
|
||||
const w = {
|
||||
name: weapon.name,
|
||||
skillValue: skill.value,
|
||||
bonusValue:
|
||||
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
||||
img: weapon.img,
|
||||
skillPath: weapon.system.fertigkeit,
|
||||
path: weapon.system.fertigkeit,
|
||||
id: weapon.id
|
||||
};
|
||||
weapons.push(w);
|
||||
});
|
||||
return weapons;
|
||||
}
|
||||
|
||||
static async #cycleEquip(event, target) {
|
||||
console.warn(target.dataset);
|
||||
const item = this.actor.items.get(target.dataset.itemId);
|
||||
console.warn(item);
|
||||
item.update({
|
||||
system: {
|
||||
equipped: !item.system.equipped
|
||||
@@ -329,15 +320,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return types;
|
||||
}
|
||||
|
||||
_clacWeight() {
|
||||
const items = this.actor.items.filter((x) => x.system.gewicht);
|
||||
let gewicht = items.reduce((accumulator, item) => accumulator + item.system.gewicht, 0);
|
||||
|
||||
let traglast = Math.max(this.actor.system.skills.körper.athletik.value, 10);
|
||||
return {
|
||||
traglast,
|
||||
gewicht
|
||||
};
|
||||
_getZauber() {
|
||||
return this.actor.items.filter((item) => item.type === "zauber");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
@@ -427,6 +411,65 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
effect.update({ disabled: !effect.disabled });
|
||||
}
|
||||
|
||||
static async #rollSpell(event, target) {
|
||||
const dataset = target.dataset;
|
||||
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 this.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:
|
||||
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);
|
||||
} else {
|
||||
roll = new Roll(
|
||||
rollTerm,
|
||||
{ die: die, skill: skillValue, spezBonus: dialogResult.spezLevel + 1 },
|
||||
{ flavor: rollFlavor }
|
||||
);
|
||||
}
|
||||
|
||||
// The parsed terms of the roll formula
|
||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
||||
|
||||
// Execute the roll
|
||||
await roll.evaluate();
|
||||
|
||||
roll.toMessage();
|
||||
}
|
||||
|
||||
static async #rollSkill(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const skill = foundry.utils.getProperty(this.actor, target.dataset.path.replace(".value", ""));
|
||||
@@ -437,7 +480,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
actor
|
||||
});
|
||||
console.log("Dialog Result", dialogResult);
|
||||
if (!dialogResult) {
|
||||
if (dialogResult === "abort") {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
@@ -496,7 +539,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
actor
|
||||
});
|
||||
console.log("Dialog Result", dialogResult);
|
||||
if (!dialogResult) {
|
||||
if (dialogResult === "abort") {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
export async function prepArmor(actor) {
|
||||
const actorData = actor.system;
|
||||
|
||||
// 1. Basis-Wert festlegen
|
||||
let baseRüstwert = actorData.rüstwert || 0;
|
||||
|
||||
// 2. Ausgerüstete Rüstung finden und addieren
|
||||
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;
|
||||
}
|
||||
|
||||
// 3. Finalen Standard-Wert berechnen
|
||||
actorData.rüstwert = baseRüstwert + armorBonus;
|
||||
}
|
||||
|
||||
export async function prepWeapons(actor) {
|
||||
const weaponItems = actor.items.filter((x) => x.type === "weapon" && x.system.equipped);
|
||||
const weapons = [];
|
||||
weaponItems.forEach((weapon) => {
|
||||
const skill = foundry.utils.getProperty(actor, weapon.system.fertigkeit);
|
||||
const w = {
|
||||
name: weapon.name,
|
||||
skillValue: skill.value,
|
||||
bonusValue:
|
||||
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
||||
img: weapon.img,
|
||||
skillPath: weapon.system.fertigkeit,
|
||||
path: weapon.system.fertigkeit,
|
||||
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 skill = foundry.utils.getProperty(actor, "system.skills.magie.zaubern");
|
||||
console.warn(skill, spellItems);
|
||||
spellItems.forEach((spell) => {
|
||||
const w = {
|
||||
name: spell.name,
|
||||
skillValue: skill.value,
|
||||
bonusValue:
|
||||
skill.bonuses.find((x) => x.name === spell.system.eigenschaften.ursprung)?.level + 1 || "",
|
||||
img: spell.img,
|
||||
skillPath: "system.skills.magie.zaubern",
|
||||
path: "Zaubern",
|
||||
id: spell.id
|
||||
};
|
||||
spells.push(w);
|
||||
});
|
||||
return spells;
|
||||
}
|
||||
|
||||
export async function prepWeight(actor) {
|
||||
const items = actor.items.filter((x) => x.system.gewicht);
|
||||
let gewicht = items.reduce((accumulator, item) => accumulator + item.system.gewicht, 0);
|
||||
|
||||
let traglast = Math.max(actor.system.skills.körper.athletik.value, 10);
|
||||
return {
|
||||
traglast,
|
||||
gewicht
|
||||
};
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
template: systemPath("templates/item/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
template: systemPath("templates/shared/tabs.hbs")
|
||||
},
|
||||
beschreibung: {
|
||||
template: systemPath("templates/item/description.hbs"),
|
||||
|
||||
@@ -44,10 +44,10 @@ export class M6WeaponSheet extends M6ItemSheet {
|
||||
template: systemPath("templates/item/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
template: systemPath("templates/shared/tabs.hbs")
|
||||
},
|
||||
eigenschaften: {
|
||||
template: systemPath("templates/item/eigenschaften.hbs"),
|
||||
template: systemPath("templates/item/waffen/eigenschaften.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
beschreibung: {
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { M6ItemSheet } from "./item-sheet.mjs";
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications.
|
||||
*/
|
||||
export class M6ZauberSheet extends M6ItemSheet {
|
||||
static get DEFAULT_OPTIONS() {
|
||||
return {
|
||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||
actions: {
|
||||
...super.DEFAULT_OPTIONS.actions,
|
||||
cycleEquip: this.#cycleEquip // Fügt NUR für dieses Sheet die neue Action hinzu
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "eigenschaften",
|
||||
icon: "fa-shield-halved"
|
||||
},
|
||||
{
|
||||
id: "beschreibung",
|
||||
icon: "fa-feather-pointed"
|
||||
}
|
||||
],
|
||||
initial: "eigenschaften",
|
||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
header: {
|
||||
template: systemPath("templates/zauber/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: systemPath("templates/shared/tabs.hbs")
|
||||
},
|
||||
eigenschaften: {
|
||||
template: systemPath("templates/zauber/eigenschaften.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
beschreibung: {
|
||||
template: systemPath("templates/zauber/description.hbs"),
|
||||
scrollable: [""]
|
||||
}
|
||||
};
|
||||
|
||||
async _addSpecifics(context) {
|
||||
context.zauberFields = await this._getFields();
|
||||
context.bonuses = foundry.utils.getProperty(this.actor, "system.skills.magie.zaubern").bonuses;
|
||||
console.warn(context);
|
||||
}
|
||||
|
||||
static #cycleEquip() {
|
||||
this.item.update({
|
||||
system: {
|
||||
equipped: !this.item.system.equipped
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handles the system fields for the form-fields generic.
|
||||
*/
|
||||
async _getFields() {
|
||||
const doc = this.item;
|
||||
const source = doc._source;
|
||||
const systemFields = CONFIG.Item.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[field.name] = fieldset;
|
||||
} else {
|
||||
fieldSets[field.name] = { 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[field.name] = { field, value: foundry.utils.getProperty(source, path) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -96,6 +96,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
.armor-box {
|
||||
position: absolute;
|
||||
margin-left: -8px;
|
||||
i {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.armor-value {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
font-size: 16px;
|
||||
color: var(--M6-background-white);
|
||||
}
|
||||
|
||||
.sheet-header {
|
||||
img {
|
||||
border-radius: 0 0 50% 50%;
|
||||
@@ -109,7 +124,7 @@
|
||||
height: 100%;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.tab[data-tab="items"] {
|
||||
.tab {
|
||||
ul {
|
||||
list-style: none;
|
||||
padding-left: 5px;
|
||||
|
||||
@@ -8,3 +8,14 @@
|
||||
/* Standardfarbe (wird durch die Maske in die Form des SVGs gepresst) */
|
||||
background-color: var(--M6-text-grey);
|
||||
}
|
||||
|
||||
.helmet {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
/* Das SVG wird als Maske geladen */
|
||||
mask: url("../assets/helmet.svg") no-repeat center / contain;
|
||||
-webkit-mask: url("../assets/helmet.svg") no-repeat center / contain;
|
||||
|
||||
/* Standardfarbe (wird durch die Maske in die Form des SVGs gepresst) */
|
||||
background-color: var(--M6-text-grey);
|
||||
}
|
||||
@@ -2,10 +2,12 @@ import { CharacterData } from "./data/character-data.mjs";
|
||||
import { WeaponData } from "./data/weapon-data.mjs";
|
||||
import { ItemData } from "./data/item-data.mjs";
|
||||
import { ArmorData } from "./data/armor-data.mjs";
|
||||
import { ZauberData } from "./data/zauber-data.mjs";
|
||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
||||
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
||||
import { M6ZauberSheet } from "./sheets/zauber-sheet.mjs";
|
||||
import { loadHelpers } from "./helpers/handlebar-helpers.mjs";
|
||||
import "./styles/M6.scss";
|
||||
|
||||
@@ -24,6 +26,7 @@ Hooks.once("init", () => {
|
||||
CONFIG.Item.dataModels.item = ItemData;
|
||||
CONFIG.Item.dataModels.weapon = WeaponData;
|
||||
CONFIG.Item.dataModels.armor = ArmorData;
|
||||
CONFIG.Item.dataModels.zauber = ZauberData;
|
||||
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
||||
types: ["character"],
|
||||
@@ -39,6 +42,9 @@ Hooks.once("init", () => {
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
||||
types: ["armor"]
|
||||
});
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ZauberSheet, {
|
||||
types: ["zauber"]
|
||||
});
|
||||
|
||||
loadHelpers();
|
||||
});
|
||||
@@ -1,40 +0,0 @@
|
||||
<div className={{styles.sheet}}>
|
||||
<h1>{{actor.name}}</h1>
|
||||
<div className={{styles.skills}}>
|
||||
{{(["anführen", "fernkampf", "nahkampf"] as const).map((key) => (
|
||||
<label className={{styles.attributeLabel}} key={{key}}>
|
||||
{{localize(`Midgard6.skills.${key}`)}}
|
||||
<input
|
||||
type="number"
|
||||
value={{attrs[key]}}
|
||||
onChange="{{(e) => updateAttribute(key, Number(e.target.value))}}"/>
|
||||
<span className={{styles.modifier}}>{{fmtMod(modifier(attrs[key]))}}</span>
|
||||
</label>
|
||||
))}}
|
||||
</div>
|
||||
<div className={{styles.totals}}>
|
||||
<span>
|
||||
{{localize("Midgard6.Sheet.Total")}}: {{total}}
|
||||
</span>
|
||||
<span>
|
||||
{{localize("Midgard6.Sheet.TotalMod")}}: {{fmtMod(totalMod)}}
|
||||
</span>
|
||||
</div>
|
||||
<label className={{styles.attributeLabel}}>
|
||||
{{localize("Midgard6.Sheet.Biography")}}
|
||||
<textarea defaultValue={{system.biography}} onBlur="{{(e) => updateBiography(e.target.value)}}" />
|
||||
</label>
|
||||
|
||||
<div className={{styles.chatRow}}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={{localize("Midgard6.Sheet.ChatPlaceholder")}}
|
||||
value={{chatMessage}}
|
||||
onChange="{{(e) => setChatMessage(e.target.value)}}"
|
||||
onKeyDown="{{(e) => e.key === "Enter" && sendChatMessage()}}"
|
||||
/>
|
||||
<button type="button" onClick={{sendChatMessage}}>
|
||||
{{localize("Midgard6.Sheet.SendToChat")}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<section
|
||||
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||
data-group="primary"
|
||||
data-tab="properties"
|
||||
data-tab="eigenschaften"
|
||||
>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@@ -11,26 +11,25 @@
|
||||
<fieldset>
|
||||
<legend>{{localize legend}}</legend>
|
||||
{{#each fields}}
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="flex-grow-1 flexrow" style="max-width: 16rem;">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
||||
<a
|
||||
class="col-6"
|
||||
class="col-8"
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-path="{{field.fieldPath}}"
|
||||
>
|
||||
<p class="flex1" style="margin-left: 4px; max-width:7rem">{{localize
|
||||
<p>{{localize
|
||||
localizationName
|
||||
}}</p>
|
||||
</a>
|
||||
<a
|
||||
class="flex-grow-0"
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-path="{{field.fieldPath}}"
|
||||
>
|
||||
<i
|
||||
class="flex-grow-0 fa-solid fa-dice-d20"
|
||||
class="fa-solid fa-dice-d20"
|
||||
style="padding:2px 0; margin-right: -14px"
|
||||
></i>
|
||||
</a>
|
||||
@@ -46,12 +45,13 @@
|
||||
data-path="{{field.fieldPath}}"
|
||||
>+</a>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="col d-flex flex-wrap" style="gap: 4px 8px; width: 100%">
|
||||
{{#each bonuses}}
|
||||
<a data-action="editSepzialisierung"
|
||||
data-name="{{name}}"
|
||||
data-level="{{level}}"
|
||||
data-path="{{path}}"
|
||||
style="white-space: nowrap;"
|
||||
{{#unless @last}}style="margin-right: 4px"{{/unless}}>{{name}}: {{level}}{{#unless @last}},{{/unless}}</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
@@ -96,13 +96,18 @@
|
||||
<div class="d-flex align-items-end">
|
||||
<div>
|
||||
<p class="resistenzenHeader">{{localize "Midgard6.aktuell"}}</p>
|
||||
|
||||
<input
|
||||
class="attribut"
|
||||
type="number"
|
||||
name="system.resources.leben.value"
|
||||
value="{{system.resources.leben.value}}"
|
||||
/>
|
||||
<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}}</span>
|
||||
</div>
|
||||
<input
|
||||
class="attribut"
|
||||
type="number"
|
||||
name="system.resources.leben.value"
|
||||
value="{{system.resources.leben.value}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<p class="center">/</p>
|
||||
<div>
|
||||
@@ -173,6 +178,37 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div>
|
||||
<fieldset class="highlight">
|
||||
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}</legend>
|
||||
<div class="container">
|
||||
{{#each equippedSpells 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}} {{#if weapon.bonusValue}}+ {{weapon.bonusValue}}{{/if}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 document-controls">
|
||||
<a
|
||||
class="item-control"
|
||||
title="{{localize 'Midgard6.Angriff'}} {{weapon.name}}"
|
||||
data-action="rollSpell"
|
||||
data-item-id="{{weapon.id}}"
|
||||
data-skillPath="{{weapon.path}}"
|
||||
>
|
||||
<i class="fas fa-dice-d20"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,6 +133,7 @@
|
||||
<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="helmet" data-action="cycleEquip" data-item-id="{{item._id}}" style="{{#if item.system.equipped}}background-color: var(--M6-text-brown){{/if}}">
|
||||
<div class="document-controls">
|
||||
<a
|
||||
class="item-control item-edit"
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
{{! 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" }}</legend>
|
||||
|
||||
<ul class="itemTypes">
|
||||
{{!-- {{#with itemTypes.zauber}} --}}
|
||||
<li class="itemHeader">
|
||||
<div class="document-controls">
|
||||
{{#if @root.editable}}
|
||||
<a
|
||||
class="item-control item-create"
|
||||
title="{{localize 'DOCUMENT.Create' type="Zauber"}}"
|
||||
data-action="createDoc"
|
||||
data-document-class="Item"
|
||||
data-type="zauber"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
{{localize "DOCUMENT.Create" type="Zauber"}}
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</li>
|
||||
<ul class="items">
|
||||
{{#each zauber as |zauber|}}
|
||||
<li class="item row align-content-center draggable" data-item-id="{{zauber._id}}" data-type="Zauber" data-document-class="Item">
|
||||
<p class="col-3 item-name">{{zauber.name}}</p>
|
||||
<p class="col-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
||||
<p class="col-1 item-name">{{zauber.system.eigenschaften.stufe}}</p>
|
||||
<a class="col-2 fa-solid {{#if zauber.system.equipped}}fa-book-open{{else}}fa-book{{/if}}" data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}} margin: 0.5rem 0;"></a>
|
||||
<a class="col-1 fa-solid fa-dice-d20" data-action="rollSpell" data-item-id="{{zauber._id}}" style="margin: 0.5rem 0;"></a>
|
||||
<div class="col-2 d-flex document-controls" style="margin: 0.5rem 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}}
|
||||
</ul>
|
||||
{{!-- {{/with}} --}}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -1,12 +1,22 @@
|
||||
<header class="sheet-header" style="margin: 1px;">
|
||||
<header class="sheet-header">
|
||||
<div class="container">
|
||||
<div class="row align-items-end" style="height: 108px" >
|
||||
<div class="col-6" style="height:32px">
|
||||
{{#if (isdefined system.equipped)}}
|
||||
<div class="d-flex justify-content-center justify-items-center">
|
||||
<a class="sword {{#if system.equipped}}icon-checked{{/if}}" data-action="cycleEquip" data-item-id="{{item._id}}"></a>
|
||||
</div>
|
||||
<img
|
||||
class="profile-img"
|
||||
style="z-index:1"
|
||||
src="{{item.img}}"
|
||||
alt="{{item.name}}"
|
||||
{{#if editable}}
|
||||
data-action="editImage"
|
||||
data-edit="img"
|
||||
{{/if}}
|
||||
data-tooltip="{{item.name}}"
|
||||
height="100" width="100"
|
||||
>
|
||||
<div class="col-12">
|
||||
<input class="text" type="text" style="color: var(--M6-text-brown); font-weight: bold; font-size:24px; background-color: var(--Midgard6-background-grey)" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{item.name}}" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.anzahl"}}" name="system.anzahl" value="{{item.system.anzahl}}" />
|
||||
@@ -20,21 +30,6 @@
|
||||
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.gewicht"}}" name="system.gewicht" value="{{item.system.gewicht}}" />
|
||||
<i class="fa-solid fa-weight-hanging input-icon right"></i>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<input class="text" type="text" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{item.name}}" />
|
||||
</div>
|
||||
<img
|
||||
class="profile-img"
|
||||
style="z-index:1"
|
||||
src="{{item.img}}"
|
||||
alt="{{item.name}}"
|
||||
{{#if editable}}
|
||||
data-action="editImage"
|
||||
data-edit="img"
|
||||
{{/if}}
|
||||
data-tooltip="{{item.name}}"
|
||||
height="100" width="100"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,29 @@
|
||||
<section
|
||||
class="standard-form tab {{tab.cssClass}}"
|
||||
data-tab="{{tab.id}}"
|
||||
data-group="{{tab.group}}"
|
||||
style="overflow: hidden"
|
||||
>
|
||||
<fieldset style="height:100%">
|
||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>Rüstung</p>
|
||||
<input
|
||||
type="text"
|
||||
style=" max-width:10rem"
|
||||
name="system.rüstwert"
|
||||
id="rollDisplay"
|
||||
placeholder="0"
|
||||
value="{{system.rüstwert}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,26 @@
|
||||
{{! Beschreibung Allgemein Tab }}
|
||||
<section
|
||||
class="standard-form tab {{tab.cssClass}}"
|
||||
data-tab="{{tab.id}}"
|
||||
data-group="{{tab.group}}"
|
||||
style="overflow: hidden"
|
||||
>
|
||||
{{! Editors must receive enriched text data from getData to properly handle rolls, UUID links, etc. }}
|
||||
<fieldset style="height:100%">
|
||||
<legend>{{localize "Midgard6.Item.Description"}}</legend>
|
||||
{{#if editable}}
|
||||
<prose-mirror
|
||||
style="height:100%"
|
||||
name="system.beschreibung"
|
||||
data-document-u-u-i-d="{{actor.uuid}}"
|
||||
value="{{system.beschreibung}}"
|
||||
collaborate="true"
|
||||
toggled="true"
|
||||
>
|
||||
{{{enrichedBeschreibung}}}
|
||||
</prose-mirror>
|
||||
{{else}}
|
||||
{{{enrichedBeschreibung}}}
|
||||
{{/if}}
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -0,0 +1,32 @@
|
||||
<section
|
||||
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||
data-tab="{{tab.id}}"
|
||||
data-group="{{tab.group}}"
|
||||
>
|
||||
<fieldset style="height:100%">
|
||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{{#each zauberFields.eigenschaften.fields}}
|
||||
{{#unlesseq field.name "ursprung"}}
|
||||
{{#unlesseq field.name "stufe"}}
|
||||
<div class="col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>{{localizeConcat "Midgard6.Zauber." field.name}}</p>
|
||||
<input
|
||||
type="text"
|
||||
style="margin-bottom: 4px; max-width:10rem"
|
||||
name="{{field.fieldPath}}"
|
||||
id="rollDisplay"
|
||||
placeholder="{{localizeConcat 'Midgard6.Zauber.' field.name}}"
|
||||
value="{{value}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{{/unlesseq}}
|
||||
{{/unlesseq}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -0,0 +1,45 @@
|
||||
<header class="sheet-header">
|
||||
<div class="container">
|
||||
<div class="row align-items-end" style="height: 108px" >
|
||||
<div class="col-12">
|
||||
<input class="text" type="text" style="color: var(--M6-text-brown); font-weight: bold; font-size:24px; background-color: var(--Midgard6-background-grey)" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{item.name}}" />
|
||||
</div>
|
||||
<div class="col-6" style="height:32px">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input class="custom-input text" type="text" placeholder="{{localize "Midgard6.Zauber.stufe"}}" name="system.eigenschaften.stufe" value="{{item.system.eigenschaften.stufe}}" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<select
|
||||
class="text right"
|
||||
style="text-align: right"
|
||||
name="system.eigenschaften.ursprung"
|
||||
id="ursprung"
|
||||
placeholder="Kleiner Zauber/ Zaubersalz"
|
||||
/>
|
||||
{{#each bonuses as |bonus|}}
|
||||
<option {{#ifeq bonus.name system.eigenschaften.ursprung}}selected{{/ifeq}} value="{{bonus.name}}">
|
||||
{{bonus.name}}
|
||||
</option>
|
||||
{{/each}}
|
||||
<option {{#ifeq system.eigenschaften.ursprung "Kleiner Zauber"}}selected{{/ifeq}} value="Kleiner Zauber">Kleiner Zauber</option>
|
||||
<option {{#ifeq system.eigenschaften.ursprung "Zaubersalz"}}selected{{/ifeq}} value="Zaubersalz">Zaubersalz</option>
|
||||
</select>
|
||||
</div>
|
||||
<img
|
||||
class="profile-img"
|
||||
style="z-index:1"
|
||||
src="{{item.img}}"
|
||||
alt="{{item.name}}"
|
||||
{{#if editable}}
|
||||
data-action="editImage"
|
||||
data-edit="img"
|
||||
{{/if}}
|
||||
data-tooltip="{{item.name}}"
|
||||
height="100" width="100"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -2,10 +2,11 @@ import { CharacterData } from "../data/character-data";
|
||||
import { ItemData } from "../data/item-data";
|
||||
import { WeaponData } from "../data/weapon-data";
|
||||
import { ArmorData } from "../data/armor-data";
|
||||
import {ZauberrData } from "../data/zauber-data";
|
||||
|
||||
declare module "fvtt-types/configuration" {
|
||||
interface DataModelConfig {
|
||||
Actor: { character: typeof CharacterData };
|
||||
Item: { item: typeof ItemData, weapon: typeof WeaponData, armor: typeof ArmorData };
|
||||
Item: { item: typeof ItemData, weapon: typeof WeaponData, armor: typeof ArmorData, zauber: typeof ZauberData };
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user