Squashed commit of the following:
commit2225a98e6bAuthor: Byroks <byroks@gmail.com> Date: Sat Oct 17 16:14:40 2026 +0200 A lot of stuff commitf7627e3e46Author: Byroks <byroks@gmail.com> Date: Fri Oct 16 22:04:36 2026 +0200 not sure what happend commit0d21ad3031Author: Byroks <byroks@gmail.com> Date: Fri Oct 16 18:10:38 2026 +0200 mark active tab commit19da492843Author: Byroks <byroks@gmail.com> Date: Fri Oct 16 18:05:58 2026 +0200 shit is visible
This commit is contained in:
1 parent
2fa131d2c5
commit
ba31eea229
21 files changed
+3069
-377
No files matched your search
@@ -36,13 +36,16 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "properties"
|
||||
id: "properties",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
id: "items"
|
||||
id: "items",
|
||||
icon: "fa-suitcase"
|
||||
},
|
||||
{
|
||||
id: "effects"
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "properties",
|
||||
@@ -54,15 +57,12 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
},
|
||||
header: {
|
||||
template: systemPath("templates/actor/header.hbs")
|
||||
},
|
||||
stats: {
|
||||
template: systemPath("templates/actor/stats.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: "templates/generic/tab-navigation.hbs"
|
||||
},
|
||||
properties: {
|
||||
template: systemPath("templates/shared/properties.hbs"),
|
||||
scrollable: [""]
|
||||
@@ -112,16 +112,17 @@ 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 "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":
|
||||
context.fields = await this._getSkills();
|
||||
context.skills = await this._getSkills();
|
||||
context.resistenzen = await this._getResistenzen();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "items":
|
||||
@@ -178,6 +179,27 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
console.warn(fieldset);
|
||||
return fieldset;
|
||||
}
|
||||
|
||||
async _getResources() {
|
||||
const doc = this.actor;
|
||||
const source = doc._source;
|
||||
@@ -198,7 +220,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||
}
|
||||
}
|
||||
console.warn(fieldSets);
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
@@ -343,10 +364,10 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
let die = "";
|
||||
console.warn(dialogResult);
|
||||
switch (dialogResult.vorteil) {
|
||||
case "-1":
|
||||
case -1:
|
||||
die = "2d20kl";
|
||||
break;
|
||||
case "1":
|
||||
case 1:
|
||||
die = "2d20kh";
|
||||
break;
|
||||
default:
|
||||
@@ -378,7 +399,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
// 1. Define the path to .hbs template
|
||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||
const templateData = {
|
||||
classes: ["roll"],
|
||||
classes: ["dialog"],
|
||||
skill,
|
||||
vorteil,
|
||||
customRoll
|
||||
@@ -400,22 +421,25 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
render: (_event, dialog) => {
|
||||
const dialogHTML = dialog.element;
|
||||
|
||||
const slider = dialogHTML.querySelector("#vorteilSlider");
|
||||
const display = dialogHTML.querySelector("#rollDisplay");
|
||||
|
||||
slider.addEventListener("input", (e) => {
|
||||
const vorteilWert = parseInt(e.target.value);
|
||||
switch (vorteilWert) {
|
||||
case 1:
|
||||
display.placeholder = `2d20kh + ${skill} (Vorteil)`;
|
||||
break;
|
||||
case -1:
|
||||
display.placeholder = `2d20kl + ${skill} (Nachteil)`;
|
||||
break;
|
||||
default:
|
||||
display.placeholder = `1d20 + ${skill}`;
|
||||
break;
|
||||
}
|
||||
// Variable bei jeder Änderung aktualisieren
|
||||
document.querySelectorAll('input[name="vorteil-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
vorteil = parseInt(e.target.value);
|
||||
console.log(vorteil);
|
||||
switch (vorteil) {
|
||||
case 1:
|
||||
display.placeholder = `2d20kh + ${skill} (Vorteil)`;
|
||||
break;
|
||||
case -1:
|
||||
display.placeholder = `2d20kl + ${skill} (Nachteil)`;
|
||||
break;
|
||||
default:
|
||||
display.placeholder = `1d20 + ${skill}`;
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
buttons: [
|
||||
@@ -433,7 +457,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
callback: (event, button, dialog) => {
|
||||
const rollData = {
|
||||
customRoll: button.form.elements.customRoll.value,
|
||||
vorteil: button.form.elements.vorteil.value
|
||||
vorteil
|
||||
};
|
||||
return rollData;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user