Gegenstände
This commit is contained in:
1 parent
4351e5bd1f
commit
14e70d422c
13 files changed
+234
-57
No files matched your search
@@ -12,7 +12,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["M6", "actor"],
|
||||
window: {
|
||||
icon: "fa-solid fa-dice-d10",
|
||||
resizable: true
|
||||
},
|
||||
position: {
|
||||
@@ -130,6 +129,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
break;
|
||||
case "items":
|
||||
context.itemTypes = this._getItems();
|
||||
context.gewicht = this._clacWeight();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
}
|
||||
@@ -284,6 +284,20 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return types;
|
||||
}
|
||||
|
||||
_clacWeight() {
|
||||
const items = this._getItems();
|
||||
let gewicht = items.item.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
|
||||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
@@ -425,8 +439,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
await roll.evaluate();
|
||||
|
||||
roll.toMessage();
|
||||
|
||||
roll.toAnchor();
|
||||
}
|
||||
|
||||
async rollDialog(rollDialogRequest) {
|
||||
|
||||
@@ -5,19 +5,22 @@ export async function addSpezialisierung(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const path = dataset.path.replace(".value", "");
|
||||
const name = dataset.name;
|
||||
const skill = foundry.utils.getProperty(this.actor, path);
|
||||
|
||||
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}`)
|
||||
title:
|
||||
game.i18n.localize("Midgard6.Sheets.spezialisierung") +
|
||||
" " +
|
||||
game.i18n.localize(`Midgard6.Skills.${name}`)
|
||||
},
|
||||
position: {
|
||||
width: 600
|
||||
@@ -26,9 +29,8 @@ export async function addSpezialisierung(event, target) {
|
||||
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) => {
|
||||
dialogHTML.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
level = parseInt(e.target.value);
|
||||
});
|
||||
@@ -61,16 +63,17 @@ export async function editSepzialisierung(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const path = dataset.path;
|
||||
const name = dataset.name;
|
||||
const skill = foundry.utils.getProperty(this.actor, path);
|
||||
|
||||
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({
|
||||
@@ -87,9 +90,8 @@ export async function editSepzialisierung(event, target) {
|
||||
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) => {
|
||||
|
||||
dialogHTML.querySelectorAll('input[name="level-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
level = parseInt(e.target.value);
|
||||
});
|
||||
|
||||
@@ -8,8 +8,12 @@ const { api, sheets } = foundry.applications;
|
||||
export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
|
||||
/** @inheritdoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
window: {
|
||||
resizable: true
|
||||
},
|
||||
position: {
|
||||
width: 600
|
||||
width: 600,
|
||||
height: 400
|
||||
},
|
||||
classes: ["M6", "item", "standard-form"],
|
||||
actions: {
|
||||
@@ -31,13 +35,15 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "properties"
|
||||
id: "description",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
id: "effects"
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "properties",
|
||||
initial: "description",
|
||||
labelPrefix: "M6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
@@ -50,11 +56,10 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
template: systemPath("templates/item/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
// Foundry-provided generic template
|
||||
template: "templates/generic/tab-navigation.hbs"
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
},
|
||||
properties: {
|
||||
template: systemPath("templates/shared/properties.hbs"),
|
||||
description: {
|
||||
template: systemPath("templates/item/description.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
effects: {
|
||||
@@ -104,8 +109,20 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
context.effects = prepareActiveEffectCategories(this.item.effects);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "properties":
|
||||
case "description":
|
||||
context.fields = await this._getFields();
|
||||
context.enrichedBeschreibung =
|
||||
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
this.item.system.beschreibung,
|
||||
{
|
||||
// Whether to show secret blocks in the finished html
|
||||
secrets: this.document.isOwner,
|
||||
// Data to fill in for inline rolls
|
||||
rollData: this.item.getRollData(),
|
||||
// Relative UUID resolution
|
||||
relativeTo: this.item
|
||||
}
|
||||
);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user