add Spezialisierungen
This commit is contained in:
1 parent
9b36127621
commit
4351e5bd1f
13 files changed
+546
-668
No files matched your search
+3
-1
@@ -10,7 +10,9 @@
|
||||
},
|
||||
"Dialog": {
|
||||
"abbrechen": "Abbrechen",
|
||||
"würfeln": "Würfeln"
|
||||
"würfeln": "Würfeln",
|
||||
"speichern": "Speichern",
|
||||
"löschen": "Löschen"
|
||||
},
|
||||
"Skills": {
|
||||
"gruppen": {
|
||||
|
||||
+230
-138
@@ -58,186 +58,278 @@ function defineSchema() {
|
||||
skills: new fields.SchemaField({
|
||||
kampf: new fields.SchemaField(
|
||||
{
|
||||
anführen: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
anführen: new fields.SchemaField({
|
||||
value: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5,
|
||||
label: "anführen"
|
||||
}),
|
||||
bonuses: new fields.ArrayField(new fields.ObjectField())
|
||||
}),
|
||||
fernkampf: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
ü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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
ü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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
max: 15,
|
||||
min: 5,
|
||||
initial: 5
|
||||
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" }
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
description: new fields.HTMLField({ initial: "" }),
|
||||
level: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 1,
|
||||
min: 0
|
||||
}),
|
||||
linkedSkill: new fields.StringField({ initial: "" })
|
||||
};
|
||||
}
|
||||
|
||||
export class SpezialisierungData extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
||||
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
@@ -23,7 +24,9 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
createDoc: this.#createDoc,
|
||||
deleteDoc: this.#deleteDoc,
|
||||
toggleEffect: this.#toggleEffect,
|
||||
rollSkill: this.#rollSkill
|
||||
rollSkill: this.#rollSkill,
|
||||
addSpezialisierung: addSpezialisierung,
|
||||
editSepzialisierung: editSepzialisierung
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true
|
||||
@@ -156,6 +159,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
async _getSkills() {
|
||||
const doc = this.actor;
|
||||
const source = doc._source;
|
||||
@@ -170,7 +175,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
legend: `Midgard6.Skills.gruppen.${field.label}`,
|
||||
fields: []
|
||||
};
|
||||
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||
await this.#addSkillFields(fieldset, field.fields, source, path);
|
||||
fieldSets.push(fieldset);
|
||||
} else {
|
||||
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||
@@ -179,6 +184,24 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
async #addSkillFields(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.#addSkillFields(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,
|
||||
bonuses: foundry.utils.getProperty(source, _path).bonuses
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
async _getResistenzen() {
|
||||
const doc = this.actor;
|
||||
const source = doc._source;
|
||||
@@ -196,7 +219,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
localizationName: "Midgard6.Resistenzen." + field.name
|
||||
});
|
||||
}
|
||||
console.warn(fieldset);
|
||||
return fieldset;
|
||||
}
|
||||
|
||||
@@ -237,7 +259,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
fieldset.fields.push({
|
||||
field,
|
||||
value: foundry.utils.getProperty(source, path),
|
||||
localizationName: "Midgard6.Skills." + field.name
|
||||
localizationName: "Midgard6.Skills." + field.label
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -351,16 +373,19 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
|
||||
static async #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 this.rollDialog({
|
||||
dataset,
|
||||
name: dataset.name,
|
||||
skill,
|
||||
actor
|
||||
});
|
||||
console.warn(dialogResult);
|
||||
if (dialogResult.noRoll) {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
const skillValue = dataset.value;
|
||||
const skillValue = skill.value;
|
||||
let die = "";
|
||||
switch (dialogResult.vorteil) {
|
||||
case -1:
|
||||
@@ -374,7 +399,24 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
break;
|
||||
}
|
||||
|
||||
let roll = new Roll("@die + @skill", { die: die, skill: skillValue }, { flavor: dataset.name });
|
||||
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]
|
||||
@@ -385,21 +427,23 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
roll.toMessage();
|
||||
|
||||
roll.toAnchor();
|
||||
// let message = new Message(roll);
|
||||
// console.warn(message);
|
||||
}
|
||||
|
||||
async rollDialog(rollDialogRequest) {
|
||||
// Assamble dialog depending on roll type
|
||||
let label = rollDialogRequest.dataset.name;
|
||||
let skill = rollDialogRequest.dataset.value;
|
||||
let label = rollDialogRequest.name;
|
||||
let skillValue = rollDialogRequest.skill.value || rollDialogRequest.skill;
|
||||
let bonuses = rollDialogRequest.skill.bonuses || [];
|
||||
let vorteil = 0;
|
||||
let customRoll = "";
|
||||
let spezLevel;
|
||||
let spezName = "";
|
||||
// 1. Define the path to .hbs template
|
||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||
const templateData = {
|
||||
classes: ["M6", "dialog"],
|
||||
skill,
|
||||
skillValue,
|
||||
bonuses,
|
||||
vorteil,
|
||||
customRoll
|
||||
};
|
||||
@@ -429,17 +473,24 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
console.log(vorteil);
|
||||
switch (vorteil) {
|
||||
case 1:
|
||||
display.placeholder = `2d20kh + ${skill} (Vorteil)`;
|
||||
display.placeholder = `2d20kh + ${skillValue} (Vorteil)`;
|
||||
break;
|
||||
case -1:
|
||||
display.placeholder = `2d20kl + ${skill} (Nachteil)`;
|
||||
display.placeholder = `2d20kl + ${skillValue} (Nachteil)`;
|
||||
break;
|
||||
default:
|
||||
display.placeholder = `1d20 + ${skill}`;
|
||||
display.placeholder = `1d20 + ${skillValue}`;
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
spezLevel = parseInt(e.target.value);
|
||||
spezName = e.target.dataset.name;
|
||||
});
|
||||
});
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
@@ -456,19 +507,14 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
callback: (event, button, dialog) => {
|
||||
const rollData = {
|
||||
customRoll: button.form.elements.customRoll.value,
|
||||
vorteil
|
||||
vorteil,
|
||||
spezLevel,
|
||||
spezName
|
||||
};
|
||||
return rollData;
|
||||
}
|
||||
}
|
||||
]
|
||||
// submit: (rollData) => {
|
||||
// if (noRoll) {
|
||||
// resolve({ noRoll: true });
|
||||
// } else {
|
||||
// resolve(rollData);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
import { systemPath } from "../../constants.mjs";
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
export async function addSpezialisierung(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const path = dataset.path.replace(".value", "");
|
||||
const name = dataset.name;
|
||||
let level = 1;
|
||||
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
|
||||
const templateData = {
|
||||
classes: ["M6", "dialog"],
|
||||
level
|
||||
};
|
||||
const skill = foundry.utils.getProperty(this.actor, path);
|
||||
console.warn(skill);
|
||||
// 2. Render the Handlebars template into an HTML string
|
||||
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
||||
return foundry.applications.api.DialogV2.wait({
|
||||
window: {
|
||||
title: "Würfel Modifikatoren: " + game.i18n.localize(`Midgard6.Skills.${name}`)
|
||||
},
|
||||
position: {
|
||||
width: 600
|
||||
},
|
||||
content,
|
||||
actions: {},
|
||||
render: (_event, dialog) => {
|
||||
const dialogHTML = dialog.element;
|
||||
const display = dialogHTML.querySelector("#rollDisplay");
|
||||
// Variable bei jeder Änderung aktualisieren
|
||||
document.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
level = parseInt(e.target.value);
|
||||
});
|
||||
});
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
action: "abort",
|
||||
label: "Midgard6.Dialog.abbrechen"
|
||||
},
|
||||
{
|
||||
action: "safe",
|
||||
label: "Midgard6.Dialog.speichern",
|
||||
default: true,
|
||||
callback: async (event, button, dialog) => {
|
||||
const spez = {
|
||||
name: button.form.elements.spezName.value,
|
||||
level,
|
||||
path
|
||||
};
|
||||
skill.bonuses.push(spez);
|
||||
await this.actor.update({ [`${path}.bonuses`]: skill.bonuses });
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
export async function editSepzialisierung(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const path = dataset.path;
|
||||
const name = dataset.name;
|
||||
let level = 1;
|
||||
let spezName = dataset.name;
|
||||
const templatePath = systemPath("templates/dialog/spezialisierung-dialog.hbs");
|
||||
const templateData = {
|
||||
classes: ["M6", "dialog"],
|
||||
spezName,
|
||||
level
|
||||
};
|
||||
console.warn(path.replace(/^.*\.(?=[^.]+$)/g, ""));
|
||||
const skill = foundry.utils.getProperty(this.actor, path);
|
||||
// 2. Render the Handlebars template into an HTML string
|
||||
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
||||
return foundry.applications.api.DialogV2.wait({
|
||||
window: {
|
||||
title:
|
||||
game.i18n.localize("Midgard6.Sheets.spezialisierung") +
|
||||
" " +
|
||||
game.i18n.localize(path.replace(/^.*\.(?=[^.]+$)/g, "Midgard6.Skills."))
|
||||
},
|
||||
position: {
|
||||
width: 600
|
||||
},
|
||||
content,
|
||||
actions: {},
|
||||
render: (_event, dialog) => {
|
||||
const dialogHTML = dialog.element;
|
||||
const display = dialogHTML.querySelector("#rollDisplay");
|
||||
// Variable bei jeder Änderung aktualisieren
|
||||
document.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
level = parseInt(e.target.value);
|
||||
});
|
||||
});
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
action: "abort",
|
||||
label: "Midgard6.Dialog.abbrechen"
|
||||
},
|
||||
{
|
||||
action: "delete",
|
||||
label: "Midgard6.Dialog.löschen",
|
||||
callback: async (event, button, dialog) => {
|
||||
// const bonuses = this.actor[path].bonuses || [];
|
||||
const bonuses = skill.bonuses.filter((x) => x.name !== name);
|
||||
await this.actor.update({ [`${path}.bonuses`]: bonuses });
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "safe",
|
||||
label: "Midgard6.Dialog.speichern",
|
||||
default: true,
|
||||
callback: async (event, button, dialog) => {
|
||||
const spez = {
|
||||
name: button.form.elements.spezName.value,
|
||||
level,
|
||||
path
|
||||
};
|
||||
const index = skill.bonuses.findIndex((x) => x.name === name);
|
||||
skill.bonuses.splice(index, 1, spez);
|
||||
await this.actor.update({ [`${path}.bonuses`]: skill.bonuses });
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -1,448 +0,0 @@
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { CharacterData } from "../data/character-data.mjs";
|
||||
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications.
|
||||
*/
|
||||
export class M6SpezialisierungSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
|
||||
/** @inheritdoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
position: {
|
||||
width: 600
|
||||
},
|
||||
classes: ["M6", "spezialisierung", "standard-form"],
|
||||
actions: {
|
||||
viewDoc: this.#viewEffect,
|
||||
createDoc: this.#createEffect,
|
||||
deleteDoc: this.#deleteEffect,
|
||||
toggleEffect: this.#toggleEffect
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true
|
||||
},
|
||||
// Custom property that's merged into `this.options`
|
||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
||||
};
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
body: {
|
||||
template: systemPath("templates/spezialisierung/spezialisierung.hbs")
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/** @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,
|
||||
item: this.item,
|
||||
actor: this.actor,
|
||||
system: this.item.system,
|
||||
flags: this.item.flags,
|
||||
itemFields: this.item.schema.fields,
|
||||
config: CONFIG
|
||||
});
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/** @inheritdoc */
|
||||
async _preparePartContext(partId, context) {
|
||||
// TODO: Come up with clever way to automatically handle enriching HTML fields
|
||||
context.skills = await this._getSkills();
|
||||
console.warn(context);
|
||||
return context;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handles the system fields for the form-fields generic.
|
||||
*/
|
||||
|
||||
async _getSkills() {
|
||||
const doc = this.item;
|
||||
const actorData = this.actor;
|
||||
return actorData?.system.skills;
|
||||
}
|
||||
|
||||
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.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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
_onRender(context, options) {
|
||||
this.#dragDrop.forEach((d) => d.bind(this.element));
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
/* Event handlers */
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Renders an embedded document's sheet.
|
||||
*
|
||||
* @this UTSItemSheet
|
||||
* @param {PointerEvent} event The originating click event.
|
||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||
* @protected
|
||||
*/
|
||||
static async #viewEffect(event, target) {
|
||||
const effect = this._getEffect(target);
|
||||
effect.sheet.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handles item deletion.
|
||||
*
|
||||
* @this UTSItemSheet
|
||||
* @param {PointerEvent} event The originating click event.
|
||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||
* @protected
|
||||
*/
|
||||
static async #deleteEffect(event, target) {
|
||||
const effect = this._getEffect(target);
|
||||
effect.delete();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
||||
*
|
||||
* @this UTSItemSheet
|
||||
* @param {PointerEvent} event The originating click event.
|
||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||
* @private
|
||||
*/
|
||||
static async #createEffect(event, target) {
|
||||
const aeCls = getDocumentClass("ActiveEffect");
|
||||
const effectData = {
|
||||
name: aeCls.defaultName({
|
||||
type: target.dataset.type,
|
||||
parent: this.item
|
||||
})
|
||||
};
|
||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||
foundry.utils.setProperty(effectData, dataKey, value);
|
||||
}
|
||||
|
||||
aeCls.create(effectData, { parent: this.item });
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Determines effect parent to pass to helper.
|
||||
*
|
||||
* @this UTSItemSheet
|
||||
* @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._getEffect(target);
|
||||
effect.update({ disabled: !effect.disabled });
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
/* Helper functions */
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Fetches the row with the data for the rendered embedded document.
|
||||
*
|
||||
* @param {HTMLElement} target The element with the action.
|
||||
* @returns {HTMLLIElement} The document's row.
|
||||
*/
|
||||
_getEffect(target) {
|
||||
const li = target.closest(".effect");
|
||||
return this.item.effects.get(li?.dataset?.effectId);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
/* 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;
|
||||
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();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* 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.item.isOwner) return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,8 @@ import { CharacterData } from "./data/character-data.mjs";
|
||||
import { ItemData } from "./data/item-data.mjs";
|
||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||
import { M6SpezialisierungSheet } from "./sheets/spezialisierung-sheet.mjs";
|
||||
import { loadHelpers } from "./helpers/handlebar-helpers.mjs";
|
||||
import "./styles/M6.scss";
|
||||
import { SpezialisierungData } from "./data/spezialisierung-data.mjs";
|
||||
|
||||
Hooks.once("init", () => {
|
||||
CONFIG.Actor.dataModels.character = CharacterData;
|
||||
@@ -20,20 +18,11 @@ Hooks.once("init", () => {
|
||||
}
|
||||
};
|
||||
CONFIG.Item.dataModels.item = ItemData;
|
||||
CONFIG.Item.dataModels.spezialisierung = SpezialisierungData;
|
||||
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
||||
types: ["character"],
|
||||
makeDefault: true
|
||||
});
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||
Item,
|
||||
"midgard6-lvd",
|
||||
M6SpezialisierungSheet,
|
||||
{
|
||||
types: ["spezialisierung"]
|
||||
}
|
||||
);
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
||||
types: ["item"],
|
||||
makeDefault: true
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
style="margin-left: 8px; max-width:10rem"
|
||||
name="customRoll"
|
||||
id="rollDisplay"
|
||||
placeholder="1d20 + {{skill}}"
|
||||
placeholder="1d20 + {{skillValue}}"
|
||||
value="{{customRoll}}"
|
||||
/>
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
@@ -43,6 +43,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
{{#each bonuses}}
|
||||
<label class="segmented-button">
|
||||
<input
|
||||
type="radio"
|
||||
name="spezialisierung-segment"
|
||||
value="{{level}}"
|
||||
data-name="{{name}}"
|
||||
/>
|
||||
<span class="segmented-button__content">
|
||||
{{name}}:
|
||||
{{level}}
|
||||
</span>
|
||||
</label>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -0,0 +1,46 @@
|
||||
<section class="standard-form" style="margin-bottom: 1rem">
|
||||
<fieldset>
|
||||
<legend>{{localize "Midgard6.Sheets.spezialisierung"}}</legend>
|
||||
<div class="">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px; max-width:10rem"
|
||||
name="spezName"
|
||||
id="spezName"
|
||||
placeholder="Spezialisierungs Name"
|
||||
value="{{spezName}}"
|
||||
/>
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
<p>Stufe:</p>
|
||||
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="level-segment" value="1" checked />
|
||||
<span class="segmented-button__content">
|
||||
<p>1</p>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<!-- Option 2 -->
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="level-segment" value="2" />
|
||||
<span class="segmented-button__content">
|
||||
<p>2</p>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<!-- Option 3 -->
|
||||
<label class="segmented-button">
|
||||
<input type="radio" name="level-segment" value="3" />
|
||||
<span class="segmented-button__content">
|
||||
<p>3</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -11,29 +11,50 @@
|
||||
<fieldset>
|
||||
<legend>{{localize legend}}</legend>
|
||||
{{#each fields}}
|
||||
<div class="flexrow" style="max-width: 16rem;">
|
||||
<a
|
||||
class="flexrow"
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-value="{{value}}"
|
||||
>
|
||||
<p class="flex1" style="margin-left: 4px; max-width:7rem">{{localize
|
||||
localizationName
|
||||
}}</p>
|
||||
</a>
|
||||
<input class="skill" type="number" name="{{field.fieldPath}}" value="{{value}}" />
|
||||
<a
|
||||
class=""
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-value="{{value}}"
|
||||
>
|
||||
<i
|
||||
class="flex0 fa-solid fa-dice-d20"
|
||||
style="padding:2px 0; border-radius:40%; background-color:var(--M6-background-grey); margin-left:-7px; font-size:18px"
|
||||
></i>
|
||||
</a>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="flex-grow-1 flexrow" style="max-width: 16rem;">
|
||||
<a
|
||||
class="col-6"
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-path="{{field.fieldPath}}"
|
||||
>
|
||||
<p class="flex1" style="margin-left: 4px; max-width:7rem">{{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"
|
||||
style="padding:2px 0; margin-right: -14px"
|
||||
></i>
|
||||
</a>
|
||||
<input
|
||||
class="skill"
|
||||
type="number"
|
||||
name="{{field.fieldPath}}"
|
||||
value="{{value}}"
|
||||
/>
|
||||
<a
|
||||
data-action="addSpezialisierung"
|
||||
data-name="{{field.label}}"
|
||||
data-path="{{field.fieldPath}}"
|
||||
>+</a>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
{{#each bonuses}}
|
||||
<a data-action="editSepzialisierung"
|
||||
data-name="{{name}}"
|
||||
data-level="{{level}}"
|
||||
data-path="{{path}}"
|
||||
{{#unless @last}}style="margin-right: 4px"{{/unless}}>{{name}}: {{level}}{{#unless @last}},{{/unless}}</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{/each}}
|
||||
@@ -54,7 +75,7 @@
|
||||
class=""
|
||||
data-action="rollSkill"
|
||||
data-name="{{localize localizationName}}"
|
||||
data-value="{{value}}"
|
||||
data-path="{{field.fieldPath}}"
|
||||
>
|
||||
<i class="fa-solid fa-dice-d20" style=""></i>
|
||||
</a>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
</datalist>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<p>Stufe:</p>
|
||||
<input type="number" list="levels" name="system.level" value="{{system.level}}" />
|
||||
<datalist id="levels">
|
||||
<option value="1">1</option>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { CharacterData } from "../data/character-data";
|
||||
import { ItemData } from "../data/item-data";
|
||||
import { SpezialisierungData } from "../data/spezialisierung-data";
|
||||
|
||||
declare module "fvtt-types/configuration" {
|
||||
interface DataModelConfig {
|
||||
Actor: { character: typeof CharacterData };
|
||||
Item: { item: typeof ItemData };
|
||||
Spezialisierung: { spezialisierung: typeof SpezialisierungData };
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -33,8 +33,7 @@
|
||||
"character": {}
|
||||
},
|
||||
"Item": {
|
||||
"item": {},
|
||||
"spezialisierung": {}
|
||||
"item": {}
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
|
||||
Reference in new issue
Block a user