NSC Bogen & würfe
This commit is contained in:
1 parent
84daa12b7b
commit
fcb5d232b5
17 files changed
+2303
-639
No files matched your search
+19
-1
@@ -161,6 +161,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"NSC": {
|
||||||
|
"Größe": {
|
||||||
|
"winzig": "Winzig",
|
||||||
|
"klein": "Klein",
|
||||||
|
"normal": "Normal",
|
||||||
|
"groß": "Groß",
|
||||||
|
"riesig": "Riesig"
|
||||||
|
},
|
||||||
|
"kompetenz": {
|
||||||
|
"miserabel": "Miserabel",
|
||||||
|
"mittelmäßig": "Mittelmäßig",
|
||||||
|
"kompetent": "Sehr Gut",
|
||||||
|
"würfe": "Kompetenz Würfe",
|
||||||
|
"hinzufügen": "Kompetenz hinzufügen",
|
||||||
|
"kompetenz": "Kompetenz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"RollList": {
|
"RollList": {
|
||||||
"RollMode": "Wurf-Modus"
|
"RollMode": "Wurf-Modus"
|
||||||
},
|
},
|
||||||
@@ -184,7 +201,8 @@
|
|||||||
},
|
},
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
"Actor": {
|
"Actor": {
|
||||||
"character": "Charakter"
|
"character": "Charakter",
|
||||||
|
"nsc": "Nebenfigur"
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": "Gegenstand",
|
"item": "Gegenstand",
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
function defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
locked: new fields.BooleanField({ initial: false }),
|
||||||
|
biographie: new fields.SchemaField({
|
||||||
|
spezies: new fields.StringField({ initial: "" }),
|
||||||
|
kultur: new fields.StringField({ initial: "" }),
|
||||||
|
beschreibung: new fields.HTMLField({ initial: "" }),
|
||||||
|
}),
|
||||||
|
größe: new fields.StringField({ initial: "normal" }),
|
||||||
|
kompetenz: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
integer: true,
|
||||||
|
initial: 1,
|
||||||
|
max: 10,
|
||||||
|
min: 0,
|
||||||
|
}),
|
||||||
|
resources: new fields.SchemaField({
|
||||||
|
leben: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
max: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 8,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
ausdauer: new fields.SchemaField({
|
||||||
|
value: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 4,
|
||||||
|
}),
|
||||||
|
max: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 44,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
resistenzen: new fields.SchemaField(
|
||||||
|
{
|
||||||
|
reflexe: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: -1,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
willenskraft: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
zähigkeit: new fields.SchemaField({
|
||||||
|
value: new fields.StringField({}),
|
||||||
|
kompetent: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
max: 1,
|
||||||
|
min: -1,
|
||||||
|
initial: 1,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ label: "resistenzen" },
|
||||||
|
),
|
||||||
|
rüstwert: new fields.SchemaField({
|
||||||
|
base: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
mod: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
initial: 0,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
merkmale: new fields.ArrayField(new fields.StringField({}), { initial: [] }),
|
||||||
|
angriffe: new fields.ArrayField(new fields.ObjectField({}), { initial: [] }),
|
||||||
|
fertigkeiten: new fields.ArrayField(new fields.StringField({}), { initial: [] }),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NSCData extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema = defineSchema;
|
||||||
|
}
|
||||||
@@ -0,0 +1,609 @@
|
|||||||
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the basic ActorSheet with some very simple modifications.
|
||||||
|
*/
|
||||||
|
export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) {
|
||||||
|
/** @inheritdoc */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["M6", "actor"],
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
width: 800,
|
||||||
|
height: 800,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
viewDoc: this.#viewDoc,
|
||||||
|
createDoc: this.#createDoc,
|
||||||
|
deleteDoc: this.#deleteDoc,
|
||||||
|
toggleEffect: this.#toggleEffect,
|
||||||
|
increaseDoc: this.#increaseDoc,
|
||||||
|
decreaseDoc: this.#decreaseDoc,
|
||||||
|
cycleLock: this.#cycleLock,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [],
|
||||||
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static PARTS = {};
|
||||||
|
|
||||||
|
_attachPartListeners(partId, html, bubble) {
|
||||||
|
super._attachPartListeners(partId, html, bubble);
|
||||||
|
|
||||||
|
const collapsible = html.querySelectorAll("div[data-action=collapsible]");
|
||||||
|
if (collapsible) {
|
||||||
|
collapsible.forEach((node) => {
|
||||||
|
node.addEventListener(
|
||||||
|
"click",
|
||||||
|
function (e) {
|
||||||
|
e = window.event || e;
|
||||||
|
if (this === e.target) {
|
||||||
|
node.classList.toggle("active");
|
||||||
|
var content = node.nextElementSibling;
|
||||||
|
content.classList.toggle("active");
|
||||||
|
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ capture: true },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
_initializeApplicationOptions(options) {
|
||||||
|
const initialized = super._initializeApplicationOptions(options);
|
||||||
|
|
||||||
|
initialized.classes.push(initialized.document.type);
|
||||||
|
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _prepareContext(options) {
|
||||||
|
const context = await super._prepareContext(options);
|
||||||
|
|
||||||
|
Object.assign(context, {
|
||||||
|
owner: this.document.isOwner,
|
||||||
|
limited: this.document.limited,
|
||||||
|
actor: this.actor,
|
||||||
|
system: this.actor.system,
|
||||||
|
flags: this.actor.flags,
|
||||||
|
config: CONFIG,
|
||||||
|
});
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the system fields for the form-fields generic.
|
||||||
|
* @returns {object[]}
|
||||||
|
*/
|
||||||
|
async _getFields() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields;
|
||||||
|
const fieldSets = [];
|
||||||
|
// TODO: Find a clever way to handle enrichment
|
||||||
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
|
const path = `system.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
const fieldset = { fieldset: true, legend: field.label, fields: [] };
|
||||||
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
fieldSets.push(fieldset);
|
||||||
|
} else {
|
||||||
|
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively add system model fields to the fieldset.
|
||||||
|
*/
|
||||||
|
async #addSystemFields(fieldset, schema, source, _path = "system") {
|
||||||
|
for (const field of Object.values(schema)) {
|
||||||
|
const path = `${_path}.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
} else if (field.constructor.hasFormSupport) {
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from Actor#itemTypes.
|
||||||
|
*/
|
||||||
|
_getItems() {
|
||||||
|
const types = Object.fromEntries(
|
||||||
|
game.documentTypes.Item.map((t) => {
|
||||||
|
return [t, { label: game.i18n.localize(CONFIG.Item.typeLabels[t]), items: [] }];
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
for (const item of this.actor.items) {
|
||||||
|
types[item.type].items.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of this.actor.items) {
|
||||||
|
types[item.type].items.sort((a, b) => a.sort - b.sort);
|
||||||
|
}
|
||||||
|
// Only show Base if it's actually being used
|
||||||
|
if (types.base.items.length === 0) delete types.base;
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static async #cycleLock(event) {
|
||||||
|
const actor = this.actor;
|
||||||
|
|
||||||
|
// Update the locked state
|
||||||
|
actor.update({ "system.locked": !actor.system.locked });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions performed after any render of the Application.
|
||||||
|
* Post-render steps are not awaited by the render process.
|
||||||
|
* @param {ApplicationRenderContext} context Prepared context data.
|
||||||
|
* @param {RenderOptions} options Provided render options.
|
||||||
|
* @protected
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async _onRender(context, options) {
|
||||||
|
await super._onRender(context, options);
|
||||||
|
this.#disableOverrides();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Event handlers */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static async #increaseDoc(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
if (event.shiftKey || event.ctrlKey) {
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl += 10) });
|
||||||
|
}
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl += 1) });
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #decreaseDoc(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
if (event.shiftKey || event.ctrlKey) {
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 10) });
|
||||||
|
}
|
||||||
|
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 1) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders an embedded document's sheet.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #viewDoc(event, target) {
|
||||||
|
const doc = this._getEmbeddedDocument(target);
|
||||||
|
doc.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles item deletion.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #deleteDoc(event, target) {
|
||||||
|
const doc = this._getEmbeddedDocument(target);
|
||||||
|
doc.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #createDoc(event, target) {
|
||||||
|
const docCls = getDocumentClass(target.dataset.documentClass);
|
||||||
|
const docData = {
|
||||||
|
name: docCls.defaultName({
|
||||||
|
type: target.dataset.type,
|
||||||
|
parent: this.actor,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
|
foundry.utils.setProperty(docData, dataKey, value);
|
||||||
|
}
|
||||||
|
const doc = await docCls.create(docData, { parent: this.actor });
|
||||||
|
doc.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines effect parent to pass to helper.
|
||||||
|
*
|
||||||
|
* @this M6ActorSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #toggleEffect(event, target) {
|
||||||
|
const effect = this._getEmbeddedDocument(target);
|
||||||
|
effect.update({ disabled: !effect.disabled });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Helper functions */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the embedded document representing the containing HTML element.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} target The element subject to search.
|
||||||
|
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
||||||
|
*/
|
||||||
|
_getEmbeddedDocument(target) {
|
||||||
|
const docRow = target.closest("[data-document-class]");
|
||||||
|
if (docRow.dataset.documentClass === "Item") {
|
||||||
|
return this.actor.items.get(docRow.dataset.itemId);
|
||||||
|
} else if (docRow.dataset.documentClass === "ActiveEffect") {
|
||||||
|
const parent =
|
||||||
|
docRow.dataset.parentId === this.actor.id
|
||||||
|
? this.actor
|
||||||
|
: this.actor.items.get(docRow?.dataset.parentId);
|
||||||
|
return parent.effects.get(docRow.dataset.effectId);
|
||||||
|
} else {
|
||||||
|
console.warn("Could not find document class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Actor override handling */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a document update based on the processed form data.
|
||||||
|
* @param {SubmitEvent} event The originating form submission event.
|
||||||
|
* @param {HTMLFormElement} form The form element that was submitted.
|
||||||
|
* @param {object} submitData Processed and validated form data to be used for a document update.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async _processSubmitData(event, form, submitData) {
|
||||||
|
const overrides = foundry.utils.flattenObject(this.actor.overrides);
|
||||||
|
for (const k of Object.keys(overrides)) delete submitData[k];
|
||||||
|
this.document.update(submitData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables inputs subject to active effects.
|
||||||
|
*/
|
||||||
|
#disableOverrides() {
|
||||||
|
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
||||||
|
for (const override of Object.keys(flatOverrides)) {
|
||||||
|
const input = this.element.querySelector(`[name="${override}"]`);
|
||||||
|
if (input) input.disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Drag and drop */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for dragging.
|
||||||
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragStart(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for the drop target.
|
||||||
|
* @returns {boolean} Can the current user drop on this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragDrop(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const li = event.currentTarget;
|
||||||
|
const dataset = event.target.dataset;
|
||||||
|
|
||||||
|
if ("link" in event.target.dataset) return;
|
||||||
|
|
||||||
|
let dragData = null;
|
||||||
|
|
||||||
|
if (li.dataset.effectId) {
|
||||||
|
const effect = this.item.effects.get(li.dataset.effectId);
|
||||||
|
dragData = effect.toDragData();
|
||||||
|
}
|
||||||
|
|
||||||
|
dragData = {
|
||||||
|
type: dataset.type,
|
||||||
|
itemId: dataset.itemId,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!dragData) return;
|
||||||
|
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
|
const item = this.item;
|
||||||
|
|
||||||
|
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||||
|
if (allowed === false) return;
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "ActiveEffect":
|
||||||
|
return this._onDropActiveEffect(event, data);
|
||||||
|
case "Actor":
|
||||||
|
return this._onDropActor(event, data);
|
||||||
|
case "Item":
|
||||||
|
return this._onDropItem(event, data);
|
||||||
|
case "Folder":
|
||||||
|
return this._onDropFolder(event, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActiveEffect(event, data) {
|
||||||
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
|
const effect = await aeCls.fromDropData(data);
|
||||||
|
if (!this.item.isOwner || !effect) return false;
|
||||||
|
|
||||||
|
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
||||||
|
aeCls.create(effect, { parent: this.item });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts an Active Effect based on its surrounding attributes.
|
||||||
|
*
|
||||||
|
* @param {DragEvent} event
|
||||||
|
* @param {ActiveEffect} effect
|
||||||
|
*/
|
||||||
|
_onEffectSort(event, effect) {
|
||||||
|
const effects = this.item.effects;
|
||||||
|
const dropTarget = event.target.closest("[data-effect-id]");
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = effects.get(dropTarget.dataset.effectId);
|
||||||
|
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (effect.id === target.id) return;
|
||||||
|
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.effectId;
|
||||||
|
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
|
target,
|
||||||
|
siblings,
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target._id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an Actor data onto another Actor sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
||||||
|
* not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActor(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
async _onDropItemCreate(actor, itemData) {
|
||||||
|
itemData = itemData instanceof Array ? itemData : [itemData];
|
||||||
|
return actor.createEmbeddedDocuments("Item", itemData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropItem(event, data) {
|
||||||
|
if (!this.actor.isOwner) return false;
|
||||||
|
|
||||||
|
if (this.actor.items.get(data.itemId)) return this._onSortItem(event, data);
|
||||||
|
|
||||||
|
const item = await Item.implementation.fromDropData(data);
|
||||||
|
const itemData = item.toObject();
|
||||||
|
|
||||||
|
return this._onDropItemCreate(this.actor, itemData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a drop event for an existing embedded Item to sort that Item relative to its siblings
|
||||||
|
* @param {Event} event
|
||||||
|
* @param {Item} item
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_onSortItem(event, item) {
|
||||||
|
// Get the drag source and drop target
|
||||||
|
const items = this.actor.items;
|
||||||
|
const dropTarget = event.target.closest("[data-item-id]");
|
||||||
|
const source = items.get(item.itemId);
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = items.get(dropTarget.dataset.itemId);
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (source.id === target.id) return;
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.itemId;
|
||||||
|
if (siblingId && siblingId !== source.id) siblings.push(items.get(siblingId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(source, {
|
||||||
|
target,
|
||||||
|
siblings,
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target.id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
return this.actor.updateEmbeddedDocuments("Item", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of a Folder on an Actor Sheet.
|
||||||
|
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropFolder(event, data) {
|
||||||
|
if (!this.item.isOwner) return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* The following pieces set up drag */
|
||||||
|
/* handling and are unlikely to need modification */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
// This is marked as private because there's no real need
|
||||||
|
// for subclasses or external hooks to mess with it directly
|
||||||
|
#dragDrop = this.#createDragDropHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of DragDrop instances.
|
||||||
|
* @type {DragDrop[]}
|
||||||
|
*/
|
||||||
|
get dragDrop() {
|
||||||
|
return this.#dragDrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application.
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this),
|
||||||
|
};
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this),
|
||||||
|
};
|
||||||
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+38
-579
@@ -3,43 +3,30 @@ import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
|||||||
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
import { addSpezialisierung, editSepzialisierung } from "./components/spezialisierung-actions.mjs";
|
||||||
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
import { prepArmor, prepWeapons, prepWeight, prepSpells } from "./components/character-prep.mjs";
|
||||||
import { rollSpell, rollWeapon, rollSkill } from "./components/roll-actions.mjs";
|
import { rollSpell, rollWeapon, rollSkill } from "./components/roll-actions.mjs";
|
||||||
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
|
||||||
const { api, sheets } = foundry.applications;
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the basic ActorSheet with some very simple modifications.
|
* Extend the M6ActorSheet.
|
||||||
*/
|
*/
|
||||||
export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) {
|
export class M6CharacterSheet extends M6ActorSheet {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static get DEFAULT_OPTIONS() {
|
||||||
classes: ["M6", "actor"],
|
return {
|
||||||
window: {
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Options aus M6ActorSheet
|
||||||
resizable: true
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
width: 800,
|
|
||||||
height: 800
|
|
||||||
},
|
|
||||||
actions: {
|
actions: {
|
||||||
viewDoc: this.#viewDoc,
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
createDoc: this.#createDoc,
|
cycleEquip: this.#cycleEquip,
|
||||||
deleteDoc: this.#deleteDoc,
|
|
||||||
toggleEffect: this.#toggleEffect,
|
|
||||||
rollSkill: rollSkill,
|
rollSkill: rollSkill,
|
||||||
rollWeapon: rollWeapon,
|
rollWeapon: rollWeapon,
|
||||||
rollSpell: rollSpell,
|
rollSpell: rollSpell,
|
||||||
cycleEquip: this.#cycleEquip,
|
cycleEquip: this.#cycleEquip,
|
||||||
cycleLock: this.#cycleLock,
|
|
||||||
addSpezialisierung: addSpezialisierung,
|
addSpezialisierung: addSpezialisierung,
|
||||||
editSepzialisierung: editSepzialisierung,
|
editSepzialisierung: editSepzialisierung,
|
||||||
increaseDoc: this.#increaseDoc,
|
|
||||||
decreaseDoc: this.#decreaseDoc
|
|
||||||
},
|
},
|
||||||
form: {
|
|
||||||
submitOnChange: true
|
|
||||||
},
|
|
||||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
@@ -48,33 +35,32 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "eigenschaften",
|
id: "eigenschaften",
|
||||||
icon: "fa-shield-halved"
|
icon: "fa-shield-halved",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "items",
|
id: "items",
|
||||||
icon: "fa-suitcase"
|
icon: "fa-suitcase",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "zauber",
|
id: "zauber",
|
||||||
icon: "fa-hand-sparkles"
|
icon: "fa-hand-sparkles",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "hintergrund",
|
id: "hintergrund",
|
||||||
icon: "fa-list"
|
icon: "fa-list",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "biographie",
|
id: "biographie",
|
||||||
icon: "fa-feather-pointed"
|
icon: "fa-feather-pointed",
|
||||||
}
|
},
|
||||||
// {
|
// {
|
||||||
// id: "effects",
|
// id: "effects",
|
||||||
// icon: "fa-bolt"
|
// icon: "fa-bolt"
|
||||||
// }
|
// }
|
||||||
],
|
],
|
||||||
initial: "eigenschaften",
|
initial: "eigenschaften",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -82,75 +68,37 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: {
|
tabs: {
|
||||||
template: systemPath("templates/shared/tabs.hbs")
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/actor/header.hbs")
|
template: systemPath("templates/actor/header.hbs"),
|
||||||
},
|
},
|
||||||
eigenschaften: {
|
eigenschaften: {
|
||||||
template: systemPath("templates/actor/eigenschaften.hbs"),
|
template: systemPath("templates/actor/eigenschaften.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
zauber: {
|
zauber: {
|
||||||
template: systemPath("templates/actor/zauber.hbs"),
|
template: systemPath("templates/actor/zauber.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
items: {
|
items: {
|
||||||
template: systemPath("templates/actor/items.hbs"),
|
template: systemPath("templates/actor/items.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
hintergrund: {
|
hintergrund: {
|
||||||
template: systemPath("templates/actor/hintergrund.hbs"),
|
template: systemPath("templates/actor/hintergrund.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
},
|
},
|
||||||
biographie: {
|
biographie: {
|
||||||
template: systemPath("templates/actor/biographie.hbs"),
|
template: systemPath("templates/actor/biographie.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""],
|
||||||
}
|
},
|
||||||
// effects: {
|
// effects: {
|
||||||
// template: systemPath("templates/shared/effects.hbs"),
|
// template: systemPath("templates/shared/effects.hbs"),
|
||||||
// scrollable: [""]
|
// scrollable: [""]
|
||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
_attachPartListeners(partId, html, bubble) {
|
|
||||||
super._attachPartListeners(partId, html, bubble);
|
|
||||||
|
|
||||||
switch (partId) {
|
|
||||||
case "hintergrund":
|
|
||||||
const collapsible = html.querySelectorAll("div[data-action=collapsible]");
|
|
||||||
if (collapsible) {
|
|
||||||
collapsible.forEach((node) => {
|
|
||||||
node.addEventListener(
|
|
||||||
"click",
|
|
||||||
function (e) {
|
|
||||||
e = window.event || e;
|
|
||||||
if (this === e.target) {
|
|
||||||
node.classList.toggle("active");
|
|
||||||
var content = node.nextElementSibling;
|
|
||||||
content.classList.toggle("active");
|
|
||||||
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ capture: true }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/** @inheritdoc */
|
|
||||||
_initializeApplicationOptions(options) {
|
|
||||||
const initialized = super._initializeApplicationOptions(options);
|
|
||||||
|
|
||||||
initialized.classes.push(initialized.document.type);
|
|
||||||
|
|
||||||
return initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
@@ -164,7 +112,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
system: this.actor.system,
|
system: this.actor.system,
|
||||||
skills: this.actor.system.skills,
|
skills: this.actor.system.skills,
|
||||||
flags: this.actor.flags,
|
flags: this.actor.flags,
|
||||||
config: CONFIG
|
config: CONFIG,
|
||||||
});
|
});
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
@@ -187,7 +135,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "items":
|
case "items":
|
||||||
context.itemTypes = await this._getItems();
|
context.itemTypes = await super._getItems();
|
||||||
context.gewicht = await prepWeight(this.actor);
|
context.gewicht = await prepWeight(this.actor);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
@@ -196,7 +144,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "hintergrund":
|
case "hintergrund":
|
||||||
context.fields = await this._getFields();
|
context.fields = await super._getFields();
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "biographie":
|
case "biographie":
|
||||||
@@ -209,8 +157,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
// Data to fill in for inline rolls
|
// Data to fill in for inline rolls
|
||||||
rollData: this.actor.getRollData(),
|
rollData: this.actor.getRollData(),
|
||||||
// Relative UUID resolution
|
// Relative UUID resolution
|
||||||
relativeTo: this.actor
|
relativeTo: this.actor,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
@@ -220,29 +168,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the system fields for the form-fields generic.
|
|
||||||
* @returns {object[]}
|
|
||||||
*/
|
|
||||||
async _getFields() {
|
|
||||||
const doc = this.actor;
|
|
||||||
const source = doc._source;
|
|
||||||
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields;
|
|
||||||
const fieldSets = [];
|
|
||||||
// TODO: Find a clever way to handle enrichment
|
|
||||||
for (const field of Object.values(systemFields ?? {})) {
|
|
||||||
const path = `system.${field.name}`;
|
|
||||||
if (field instanceof foundry.data.fields.SchemaField) {
|
|
||||||
const fieldset = { fieldset: true, legend: field.label, fields: [] };
|
|
||||||
await this.#addSystemFields(fieldset, field.fields, source, path);
|
|
||||||
fieldSets.push(fieldset);
|
|
||||||
} else {
|
|
||||||
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fieldSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
async _getSkills() {
|
async _getSkills() {
|
||||||
@@ -257,7 +182,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.Skills.gruppen.${field.label}`,
|
legend: `Midgard6.Skills.gruppen.${field.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
await this.#addSkillFields(fieldset, field.fields, source, path);
|
await this.#addSkillFields(fieldset, field.fields, source, path);
|
||||||
fieldSets.push(fieldset);
|
fieldSets.push(fieldset);
|
||||||
@@ -278,7 +203,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Skills." + field.label,
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
bonuses: foundry.utils.getProperty(source, _path).bonuses
|
bonuses: foundry.utils.getProperty(source, _path).bonuses,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,14 +218,14 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.Attribute.${systemFields.label}`,
|
legend: `Midgard6.Attribute.${systemFields.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
for (const field of Object.values(systemFields.fields ?? {})) {
|
for (const field of Object.values(systemFields.fields ?? {})) {
|
||||||
const path = `system.resistenzen.${field.name}`;
|
const path = `system.resistenzen.${field.name}`;
|
||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Resistenzen." + field.name
|
localizationName: "Midgard6.Resistenzen." + field.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return fieldset;
|
return fieldset;
|
||||||
@@ -318,7 +243,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const fieldset = {
|
const fieldset = {
|
||||||
fieldset: true,
|
fieldset: true,
|
||||||
legend: `Midgard6.resources.${field.label}`,
|
legend: `Midgard6.resources.${field.label}`,
|
||||||
fields: []
|
fields: [],
|
||||||
};
|
};
|
||||||
await this.#addSystemFields(fieldset, field.fields, source, path);
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
fieldSets.push(fieldset);
|
fieldSets.push(fieldset);
|
||||||
@@ -333,18 +258,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
const item = this.actor.items.get(target.dataset.itemId);
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
item.update({
|
item.update({
|
||||||
system: {
|
system: {
|
||||||
equipped: !item.system.equipped
|
equipped: !item.system.equipped,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #cycleLock(event) {
|
|
||||||
const actor = this.actor;
|
|
||||||
|
|
||||||
// Update the locked state
|
|
||||||
actor.update({ "system.locked": !actor.system.locked });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,7 +277,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
fieldset.fields.push({
|
fieldset.fields.push({
|
||||||
field,
|
field,
|
||||||
value: foundry.utils.getProperty(source, path),
|
value: foundry.utils.getProperty(source, path),
|
||||||
localizationName: "Midgard6.Skills." + field.label
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,466 +285,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapted from Actor#itemTypes.
|
|
||||||
*/
|
|
||||||
_getItems() {
|
|
||||||
const types = Object.fromEntries(
|
|
||||||
game.documentTypes.Item.map((t) => {
|
|
||||||
return [t, { label: game.i18n.localize(CONFIG.Item.typeLabels[t]), items: [] }];
|
|
||||||
})
|
|
||||||
);
|
|
||||||
for (const item of this.actor.items) {
|
|
||||||
types[item.type].items.push(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const item of this.actor.items) {
|
|
||||||
types[item.type].items.sort((a, b) => a.sort - b.sort);
|
|
||||||
}
|
|
||||||
// Only show Base if it's actually being used
|
|
||||||
if (types.base.items.length === 0) delete types.base;
|
|
||||||
return types;
|
|
||||||
}
|
|
||||||
|
|
||||||
_getZauber() {
|
_getZauber() {
|
||||||
return this.actor.items.filter((item) => item.type === "zauber");
|
return this.actor.items.filter((item) => item.type === "zauber");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Actions performed after any render of the Application.
|
|
||||||
* Post-render steps are not awaited by the render process.
|
|
||||||
* @param {ApplicationRenderContext} context Prepared context data.
|
|
||||||
* @param {RenderOptions} options Provided render options.
|
|
||||||
* @protected
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
async _onRender(context, options) {
|
|
||||||
await super._onRender(context, options);
|
|
||||||
this.#disableOverrides();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Event handlers */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
static async #increaseDoc(event, target) {
|
|
||||||
const item = this.actor.items.get(target.dataset.itemId);
|
|
||||||
if (event.shiftKey || event.ctrlKey) {
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl += 10) });
|
|
||||||
}
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl += 1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
static async #decreaseDoc(event, target) {
|
|
||||||
const item = this.actor.items.get(target.dataset.itemId);
|
|
||||||
if (event.shiftKey || event.ctrlKey) {
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 10) });
|
|
||||||
}
|
|
||||||
return item.update({ ["system.anzahl"]: (item.system.anzahl -= 1) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders an embedded document's sheet.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
static async #viewDoc(event, target) {
|
|
||||||
const doc = this._getEmbeddedDocument(target);
|
|
||||||
doc.sheet.render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles item deletion.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
static async #deleteDoc(event, target) {
|
|
||||||
const doc = this._getEmbeddedDocument(target);
|
|
||||||
doc.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
static async #createDoc(event, target) {
|
|
||||||
const docCls = getDocumentClass(target.dataset.documentClass);
|
|
||||||
const docData = {
|
|
||||||
name: docCls.defaultName({
|
|
||||||
type: target.dataset.type,
|
|
||||||
parent: this.actor
|
|
||||||
})
|
|
||||||
};
|
|
||||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
|
||||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
|
||||||
foundry.utils.setProperty(docData, dataKey, value);
|
|
||||||
}
|
|
||||||
const doc = await docCls.create(docData, { parent: this.actor });
|
|
||||||
doc.sheet.render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines effect parent to pass to helper.
|
|
||||||
*
|
|
||||||
* @this M6ActorSheet
|
|
||||||
* @param {PointerEvent} event The originating click event.
|
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
static async #toggleEffect(event, target) {
|
|
||||||
const effect = this._getEmbeddedDocument(target);
|
|
||||||
effect.update({ disabled: !effect.disabled });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Helper functions */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the embedded document representing the containing HTML element.
|
|
||||||
*
|
|
||||||
* @param {HTMLElement} target The element subject to search.
|
|
||||||
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
|
||||||
*/
|
|
||||||
_getEmbeddedDocument(target) {
|
|
||||||
const docRow = target.closest("[data-document-class]");
|
|
||||||
if (docRow.dataset.documentClass === "Item") {
|
|
||||||
return this.actor.items.get(docRow.dataset.itemId);
|
|
||||||
} else if (docRow.dataset.documentClass === "ActiveEffect") {
|
|
||||||
const parent =
|
|
||||||
docRow.dataset.parentId === this.actor.id
|
|
||||||
? this.actor
|
|
||||||
: this.actor.items.get(docRow?.dataset.parentId);
|
|
||||||
return parent.effects.get(docRow.dataset.effectId);
|
|
||||||
} else {
|
|
||||||
console.warn("Could not find document class");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Actor override handling */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit a document update based on the processed form data.
|
|
||||||
* @param {SubmitEvent} event The originating form submission event.
|
|
||||||
* @param {HTMLFormElement} form The form element that was submitted.
|
|
||||||
* @param {object} submitData Processed and validated form data to be used for a document update.
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
* @protected
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
async _processSubmitData(event, form, submitData) {
|
|
||||||
const overrides = foundry.utils.flattenObject(this.actor.overrides);
|
|
||||||
for (const k of Object.keys(overrides)) delete submitData[k];
|
|
||||||
this.document.update(submitData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables inputs subject to active effects.
|
|
||||||
*/
|
|
||||||
#disableOverrides() {
|
|
||||||
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
|
||||||
for (const override of Object.keys(flatOverrides)) {
|
|
||||||
const input = this.element.querySelector(`[name="${override}"]`);
|
|
||||||
if (input) input.disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* Drag and drop */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
|
||||||
* @param {string} selector The candidate HTML selector for dragging.
|
|
||||||
* @returns {boolean} Can the current user drag this selector?
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_canDragStart(selector) {
|
|
||||||
return this.isEditable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector.
|
|
||||||
* @param {string} selector The candidate HTML selector for the drop target.
|
|
||||||
* @returns {boolean} Can the current user drop on this selector?
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_canDragDrop(selector) {
|
|
||||||
return this.isEditable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur at the beginning of a drag start workflow.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_onDragStart(event) {
|
|
||||||
const li = event.currentTarget;
|
|
||||||
const dataset = event.target.dataset;
|
|
||||||
|
|
||||||
if ("link" in event.target.dataset) return;
|
|
||||||
|
|
||||||
let dragData = null;
|
|
||||||
|
|
||||||
if (li.dataset.effectId) {
|
|
||||||
const effect = this.item.effects.get(li.dataset.effectId);
|
|
||||||
dragData = effect.toDragData();
|
|
||||||
}
|
|
||||||
|
|
||||||
dragData = {
|
|
||||||
type: dataset.type,
|
|
||||||
itemId: dataset.itemId
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!dragData) return;
|
|
||||||
|
|
||||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur when a dragged element is over a drop target.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
_onDragOver(event) {}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback actions which occur when a dragged element is dropped on a target.
|
|
||||||
* @param {DragEvent} event The originating DragEvent.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDrop(event) {
|
|
||||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
|
||||||
const item = this.item;
|
|
||||||
|
|
||||||
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
|
||||||
if (allowed === false) return;
|
|
||||||
// Handle different data types
|
|
||||||
switch (data.type) {
|
|
||||||
case "ActiveEffect":
|
|
||||||
return this._onDropActiveEffect(event, data);
|
|
||||||
case "Actor":
|
|
||||||
return this._onDropActor(event, data);
|
|
||||||
case "Item":
|
|
||||||
return this._onDropItem(event, data);
|
|
||||||
case "Folder":
|
|
||||||
return this._onDropFolder(event, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropActiveEffect(event, data) {
|
|
||||||
const aeCls = getDocumentClass("ActiveEffect");
|
|
||||||
const effect = await aeCls.fromDropData(data);
|
|
||||||
if (!this.item.isOwner || !effect) return false;
|
|
||||||
|
|
||||||
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
|
||||||
aeCls.create(effect, { parent: this.item });
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sorts an Active Effect based on its surrounding attributes.
|
|
||||||
*
|
|
||||||
* @param {DragEvent} event
|
|
||||||
* @param {ActiveEffect} effect
|
|
||||||
*/
|
|
||||||
_onEffectSort(event, effect) {
|
|
||||||
const effects = this.item.effects;
|
|
||||||
const dropTarget = event.target.closest("[data-effect-id]");
|
|
||||||
if (!dropTarget) return;
|
|
||||||
const target = effects.get(dropTarget.dataset.effectId);
|
|
||||||
|
|
||||||
// Don't sort on yourself
|
|
||||||
if (effect.id === target.id) return;
|
|
||||||
|
|
||||||
// Identify sibling items based on adjacent HTML elements
|
|
||||||
const siblings = [];
|
|
||||||
for (let el of dropTarget.parentElement.children) {
|
|
||||||
const siblingId = el.dataset.effectId;
|
|
||||||
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the sort
|
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
|
||||||
target,
|
|
||||||
siblings
|
|
||||||
});
|
|
||||||
const updateData = sortUpdates.map((u) => {
|
|
||||||
const update = u.update;
|
|
||||||
update._id = u.target._id;
|
|
||||||
return update;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Perform the update
|
|
||||||
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of an Actor data onto another Actor sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
|
||||||
* not permitted.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropActor(event, data) {
|
|
||||||
if (!this.item.isOwner) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
async _onDropItemCreate(actor, itemData) {
|
|
||||||
itemData = itemData instanceof Array ? itemData : [itemData];
|
|
||||||
return actor.createEmbeddedDocuments("Item", itemData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropItem(event, data) {
|
|
||||||
if (!this.actor.isOwner) return false;
|
|
||||||
|
|
||||||
if (this.actor.items.get(data.itemId)) return this._onSortItem(event, data);
|
|
||||||
|
|
||||||
const item = await Item.implementation.fromDropData(data);
|
|
||||||
const itemData = item.toObject();
|
|
||||||
|
|
||||||
return this._onDropItemCreate(this.actor, itemData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a drop event for an existing embedded Item to sort that Item relative to its siblings
|
|
||||||
* @param {Event} event
|
|
||||||
* @param {Item} item
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_onSortItem(event, item) {
|
|
||||||
// Get the drag source and drop target
|
|
||||||
const items = this.actor.items;
|
|
||||||
const dropTarget = event.target.closest("[data-item-id]");
|
|
||||||
const source = items.get(item.itemId);
|
|
||||||
if (!dropTarget) return;
|
|
||||||
const target = items.get(dropTarget.dataset.itemId);
|
|
||||||
// Don't sort on yourself
|
|
||||||
if (source.id === target.id) return;
|
|
||||||
// Identify sibling items based on adjacent HTML elements
|
|
||||||
const siblings = [];
|
|
||||||
for (let el of dropTarget.parentElement.children) {
|
|
||||||
const siblingId = el.dataset.itemId;
|
|
||||||
if (siblingId && siblingId !== source.id) siblings.push(items.get(siblingId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the sort
|
|
||||||
const sortUpdates = foundry.utils.performIntegerSort(source, {
|
|
||||||
target,
|
|
||||||
siblings
|
|
||||||
});
|
|
||||||
const updateData = sortUpdates.map((u) => {
|
|
||||||
const update = u.update;
|
|
||||||
update._id = u.target.id;
|
|
||||||
return update;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Perform the update
|
|
||||||
return this.actor.updateEmbeddedDocuments("Item", updateData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle dropping of a Folder on an Actor Sheet.
|
|
||||||
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
|
||||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
|
||||||
* @param {object} data The data transfer extracted from the event.
|
|
||||||
* @returns {Promise<Item[]>}
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
async _onDropFolder(event, data) {
|
|
||||||
if (!this.item.isOwner) return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
/* The following pieces set up drag */
|
|
||||||
/* handling and are unlikely to need modification */
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
// This is marked as private because there's no real need
|
|
||||||
// for subclasses or external hooks to mess with it directly
|
|
||||||
#dragDrop = this.#createDragDropHandlers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of DragDrop instances.
|
|
||||||
* @type {DragDrop[]}
|
|
||||||
*/
|
|
||||||
get dragDrop() {
|
|
||||||
return this.#dragDrop;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create drag-and-drop workflow handlers for this Application.
|
|
||||||
* @returns {DragDrop[]} An array of DragDrop handlers.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
#createDragDropHandlers() {
|
|
||||||
return this.options.dragDrop.map((d) => {
|
|
||||||
d.permissions = {
|
|
||||||
dragstart: this._canDragStart.bind(this),
|
|
||||||
drop: this._canDragDrop.bind(this)
|
|
||||||
};
|
|
||||||
d.callbacks = {
|
|
||||||
dragstart: this._onDragStart.bind(this),
|
|
||||||
dragover: this._onDragOver.bind(this),
|
|
||||||
drop: this._onDrop.bind(this)
|
|
||||||
};
|
|
||||||
return new foundry.applications.ux.DragDrop(d);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ export async function rollSpell(event, target) {
|
|||||||
skill,
|
skill,
|
||||||
damageRoll: item.system.eigenschaften.schaden,
|
damageRoll: item.system.eigenschaften.schaden,
|
||||||
preSelectedSpez: item.system.eigenschaften.ursprung,
|
preSelectedSpez: item.system.eigenschaften.ursprung,
|
||||||
actor
|
actor,
|
||||||
});
|
});
|
||||||
console.log("Dialog Result", dialogResult);
|
console.log("Dialog Result", dialogResult);
|
||||||
if (dialogResult === "abort") {
|
if (dialogResult === "abort") {
|
||||||
@@ -48,9 +48,9 @@ export async function rollSpell(event, target) {
|
|||||||
{
|
{
|
||||||
die: die,
|
die: die,
|
||||||
skill: skillValue,
|
skill: skillValue,
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
},
|
},
|
||||||
{ title: rollFlavor }
|
{ title: rollFlavor },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +61,8 @@ export async function rollSpell(event, target) {
|
|||||||
await new Roll(
|
await new Roll(
|
||||||
"@die",
|
"@die",
|
||||||
{ die: item.system.eigenschaften.schaden },
|
{ die: item.system.eigenschaften.schaden },
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") }
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
).evaluate()
|
).evaluate(),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// Execute the roll
|
// Execute the roll
|
||||||
@@ -88,11 +88,11 @@ export async function rollSpell(event, target) {
|
|||||||
// Data to fill in for inline rolls
|
// Data to fill in for inline rolls
|
||||||
rollData: this.actor.getRollData(),
|
rollData: this.actor.getRollData(),
|
||||||
// Relative UUID resolution
|
// Relative UUID resolution
|
||||||
relativeTo: this.actor
|
relativeTo: this.actor,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
@@ -107,7 +107,7 @@ export async function rollSkill(event, target) {
|
|||||||
const dialogResult = await rollDialog({
|
const dialogResult = await rollDialog({
|
||||||
name: dataset.name,
|
name: dataset.name,
|
||||||
skill,
|
skill,
|
||||||
actor
|
actor,
|
||||||
});
|
});
|
||||||
console.log("Dialog Result", dialogResult);
|
console.log("Dialog Result", dialogResult);
|
||||||
if (dialogResult === "abort") {
|
if (dialogResult === "abort") {
|
||||||
@@ -145,9 +145,9 @@ export async function rollSkill(event, target) {
|
|||||||
{
|
{
|
||||||
die: die,
|
die: die,
|
||||||
skill: skillValue,
|
skill: skillValue,
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
},
|
},
|
||||||
{ title: rollFlavor }
|
{ title: rollFlavor },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ export async function rollSkill(event, target) {
|
|||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
flags: {
|
flags: {
|
||||||
"midgard6-lvd": {
|
"midgard6-lvd": {
|
||||||
title: rollFlavor
|
title: rollFlavor,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Nutze applyRollMode, um Sichtbarkeiten (Whisper, Blind) korrekt zu setzen
|
// Nutze applyRollMode, um Sichtbarkeiten (Whisper, Blind) korrekt zu setzen
|
||||||
@@ -184,7 +184,7 @@ export async function rollWeapon(event, target) {
|
|||||||
skill,
|
skill,
|
||||||
damageRoll: weapon.system.schaden,
|
damageRoll: weapon.system.schaden,
|
||||||
preSelectedSpez: weapon.system.spezialisierung,
|
preSelectedSpez: weapon.system.spezialisierung,
|
||||||
actor
|
actor,
|
||||||
});
|
});
|
||||||
console.log("Dialog Result", dialogResult);
|
console.log("Dialog Result", dialogResult);
|
||||||
if (dialogResult === "abort") {
|
if (dialogResult === "abort") {
|
||||||
@@ -224,18 +224,18 @@ export async function rollWeapon(event, target) {
|
|||||||
{
|
{
|
||||||
die: die,
|
die: die,
|
||||||
skill: skillValue,
|
skill: skillValue,
|
||||||
spezBonus: dialogResult.spezLevel + 1
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: rollFlavor
|
title: rollFlavor,
|
||||||
}
|
},
|
||||||
).evaluate();
|
).evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
damageRoll = await new Roll(
|
damageRoll = await new Roll(
|
||||||
"@die",
|
"@die",
|
||||||
{ die: weapon.system.schaden },
|
{ die: weapon.system.schaden },
|
||||||
{ title: game.i18n.localize("Midgard6.Schaden") }
|
{ title: game.i18n.localize("Midgard6.Schaden") },
|
||||||
).evaluate();
|
).evaluate();
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
// The parsed terms of the roll formula
|
||||||
@@ -252,11 +252,11 @@ export async function rollWeapon(event, target) {
|
|||||||
{
|
{
|
||||||
secrets: false,
|
secrets: false,
|
||||||
rollData: this.actor.getRollData(),
|
rollData: this.actor.getRollData(),
|
||||||
relativeTo: this.actor
|
relativeTo: this.actor,
|
||||||
}
|
},
|
||||||
)
|
),
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
@@ -264,7 +264,7 @@ export async function rollWeapon(event, target) {
|
|||||||
await ChatMessage.create(chatData);
|
await ChatMessage.create(chatData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function rollDialog(rollDialogRequest) {
|
export async function rollDialog(rollDialogRequest) {
|
||||||
// Assamble dialog depending on roll type
|
// Assamble dialog depending on roll type
|
||||||
let label = rollDialogRequest.name;
|
let label = rollDialogRequest.name;
|
||||||
let skillValue = rollDialogRequest.skill.value || rollDialogRequest.skill;
|
let skillValue = rollDialogRequest.skill.value || rollDialogRequest.skill;
|
||||||
@@ -284,7 +284,7 @@ async function rollDialog(rollDialogRequest) {
|
|||||||
damageRoll,
|
damageRoll,
|
||||||
preSelectedSpez,
|
preSelectedSpez,
|
||||||
customRoll,
|
customRoll,
|
||||||
rollModes: CONFIG.ChatMessage.modes
|
rollModes: CONFIG.ChatMessage.modes,
|
||||||
};
|
};
|
||||||
// 2. Render the Handlebars template into an HTML string
|
// 2. Render the Handlebars template into an HTML string
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
const content = await foundry.applications.handlebars.renderTemplate(templatePath, templateData);
|
||||||
@@ -293,7 +293,7 @@ async function rollDialog(rollDialogRequest) {
|
|||||||
return foundry.applications.api.DialogV2.wait({
|
return foundry.applications.api.DialogV2.wait({
|
||||||
window: { title: "Würfel Modifikatoren: " + label },
|
window: { title: "Würfel Modifikatoren: " + label },
|
||||||
position: {
|
position: {
|
||||||
width: 600
|
width: 600,
|
||||||
},
|
},
|
||||||
classes: ["M6", "dialog"],
|
classes: ["M6", "dialog"],
|
||||||
content,
|
content,
|
||||||
@@ -349,7 +349,7 @@ async function rollDialog(rollDialogRequest) {
|
|||||||
label: "Midgard6.Dialog.abbrechen",
|
label: "Midgard6.Dialog.abbrechen",
|
||||||
callback: (event, button, dialog) => {
|
callback: (event, button, dialog) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: "roll",
|
action: "roll",
|
||||||
@@ -363,11 +363,11 @@ async function rollDialog(rollDialogRequest) {
|
|||||||
spezLevel,
|
spezLevel,
|
||||||
spezName,
|
spezName,
|
||||||
rollMode:
|
rollMode:
|
||||||
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode")
|
button.form.elements.rollMode?.value || game.settings.get("core", "messageMode"),
|
||||||
};
|
};
|
||||||
return rollData;
|
return rollData;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,454 @@
|
|||||||
|
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";
|
||||||
|
import { rollSpell, rollWeapon, rollSkill, rollDialog } from "./components/roll-actions.mjs";
|
||||||
|
import { M6ActorSheet } from "./actor-sheet.mjs";
|
||||||
|
|
||||||
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the M6ActorSheet.
|
||||||
|
*/
|
||||||
|
export class M6NSCSheet extends M6ActorSheet {
|
||||||
|
/** @inheritdoc */
|
||||||
|
static get DEFAULT_OPTIONS() {
|
||||||
|
return {
|
||||||
|
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Options aus M6ActorSheet
|
||||||
|
actions: {
|
||||||
|
...super.DEFAULT_OPTIONS.actions, // Kopiert alle bestehenden Actions aus M6ActorSheet
|
||||||
|
cycleEquip: this.#cycleEquip,
|
||||||
|
rollKompetenz: this.#rollKompetenz,
|
||||||
|
rollResistenz: this.#rollResistenz,
|
||||||
|
rollSpell: rollSpell,
|
||||||
|
cycleEquip: this.#cycleEquip,
|
||||||
|
addKompetenz: this.#addKompetenz,
|
||||||
|
editResistenz: this.#editResistenz,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [
|
||||||
|
{
|
||||||
|
id: "eigenschaften",
|
||||||
|
icon: "fa-shield-halved",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "items",
|
||||||
|
icon: "fa-suitcase",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "zauber",
|
||||||
|
icon: "fa-hand-sparkles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "biographie",
|
||||||
|
icon: "fa-feather-pointed",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: "effects",
|
||||||
|
// icon: "fa-bolt"
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
initial: "eigenschaften",
|
||||||
|
labelPrefix: "Midgard6.Sheets.Tabs",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static PARTS = {
|
||||||
|
tabs: {
|
||||||
|
template: systemPath("templates/shared/tabs.hbs"),
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
template: systemPath("templates/nsc/header.hbs"),
|
||||||
|
},
|
||||||
|
eigenschaften: {
|
||||||
|
template: systemPath("templates/nsc/eigenschaften.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
zauber: {
|
||||||
|
template: systemPath("templates/nsc/zauber.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
items: {
|
||||||
|
template: systemPath("templates/nsc/items.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
biographie: {
|
||||||
|
template: systemPath("templates/nsc/biographie.hbs"),
|
||||||
|
scrollable: [""],
|
||||||
|
},
|
||||||
|
// effects: {
|
||||||
|
// template: systemPath("templates/shared/effects.hbs"),
|
||||||
|
// scrollable: [""]
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _prepareContext(options) {
|
||||||
|
const context = await super._prepareContext(options);
|
||||||
|
|
||||||
|
Object.assign(context, {
|
||||||
|
owner: this.document.isOwner,
|
||||||
|
limited: this.document.limited,
|
||||||
|
actor: this.actor,
|
||||||
|
system: this.actor.system,
|
||||||
|
flags: this.actor.flags,
|
||||||
|
config: CONFIG,
|
||||||
|
});
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
switch (partId) {
|
||||||
|
case "eigenschaften":
|
||||||
|
// context.armor = await prepArmor(this.actor);
|
||||||
|
// context.skills = await this._getSkills();
|
||||||
|
// context.resistenzen = await this._getResistenzen();
|
||||||
|
// context.equippedWeapons = await prepWeapons(this.actor);
|
||||||
|
// context.equippedSpells = await prepSpells(this.actor);
|
||||||
|
context.kompetenzWürfe = await this.calcKompetenzWürfe();
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "effects":
|
||||||
|
context.effects = prepareActiveEffectCategories(this.actor.allApplicableEffects());
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "items":
|
||||||
|
context.itemTypes = await super._getItems();
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "zauber":
|
||||||
|
context.zauber = await this._getZauber();
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
case "biographie":
|
||||||
|
context.enrichedBeschreibung =
|
||||||
|
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
|
this.actor.system.biographie.beschreibung,
|
||||||
|
{
|
||||||
|
// Whether to show secret blocks in the finished html
|
||||||
|
secrets: this.document.isOwner,
|
||||||
|
// Data to fill in for inline rolls
|
||||||
|
rollData: this.actor.getRollData(),
|
||||||
|
// Relative UUID resolution
|
||||||
|
relativeTo: this.actor,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
context.tab = context.tabs[partId];
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
async calcKompetenzWürfe() {
|
||||||
|
const kompetenz = this.actor.system.kompetenz;
|
||||||
|
const resistenzen = this.actor.system.resistenzen;
|
||||||
|
for (var key in resistenzen) {
|
||||||
|
let calc;
|
||||||
|
switch (resistenzen[key].kompetent) {
|
||||||
|
case -1:
|
||||||
|
calc = "d3";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
calc = kompetenz + 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
calc = Math.floor((kompetenz + 8) / 2);
|
||||||
|
}
|
||||||
|
resistenzen[key].value = calc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { kompetent: kompetenz + 8, mittelmäßig: Math.floor((kompetenz + 8) / 2) };
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getResistenzen() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.resistenzen;
|
||||||
|
const fieldset = {
|
||||||
|
fieldset: true,
|
||||||
|
legend: `Midgard6.Attribute.${systemFields.label}`,
|
||||||
|
fields: [],
|
||||||
|
};
|
||||||
|
for (const field of Object.values(systemFields.fields ?? {})) {
|
||||||
|
const path = `system.resistenzen.${field.name}`;
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
localizationName: "Midgard6.Resistenzen." + field.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return fieldset;
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getResources() {
|
||||||
|
const doc = this.actor;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.resources.fields;
|
||||||
|
const fieldSets = [];
|
||||||
|
// TODO: Find a clever way to handle enrichment
|
||||||
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
|
const path = `system.skills.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
const fieldset = {
|
||||||
|
fieldset: true,
|
||||||
|
legend: `Midgard6.resources.${field.label}`,
|
||||||
|
fields: [],
|
||||||
|
};
|
||||||
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
fieldSets.push(fieldset);
|
||||||
|
} else {
|
||||||
|
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #cycleEquip(event, target) {
|
||||||
|
const item = this.actor.items.get(target.dataset.itemId);
|
||||||
|
item.update({
|
||||||
|
system: {
|
||||||
|
equipped: !item.system.equipped,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively add system model fields to the fieldset.
|
||||||
|
*/
|
||||||
|
async #addSystemFields(fieldset, schema, source, _path = "system") {
|
||||||
|
for (const field of Object.values(schema)) {
|
||||||
|
const path = `${_path}.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
} else if (field.constructor.hasFormSupport) {
|
||||||
|
fieldset.fields.push({
|
||||||
|
field,
|
||||||
|
value: foundry.utils.getProperty(source, path),
|
||||||
|
localizationName: "Midgard6.Skills." + field.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
_getZauber() {
|
||||||
|
return this.actor.items.filter((item) => item.type === "zauber");
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #addKompetenz(event, target) {}
|
||||||
|
|
||||||
|
static async #editResistenz(event, target) {
|
||||||
|
const resistenzen = this.actor.system.resistenzen;
|
||||||
|
const templatePath = systemPath("templates/dialog/nsc-resistenz-dialog.hbs");
|
||||||
|
const templateData = {
|
||||||
|
resistenzen,
|
||||||
|
};
|
||||||
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
templatePath,
|
||||||
|
templateData,
|
||||||
|
);
|
||||||
|
return foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.localize("Midgard6.Attribute.resistenzen"),
|
||||||
|
},
|
||||||
|
classes: ["M6", "dialog"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
content,
|
||||||
|
actions: {},
|
||||||
|
render: (_event, dialog) => {
|
||||||
|
const dialogHTML = dialog.element;
|
||||||
|
// Variable bei jeder Änderung aktualisieren
|
||||||
|
for (const key in resistenzen) {
|
||||||
|
dialogHTML.querySelectorAll(`input[name="${key}-segment"]`).forEach((radio) => {
|
||||||
|
if (radio.value == resistenzen[key].kompetent) {
|
||||||
|
radio.click();
|
||||||
|
}
|
||||||
|
radio.addEventListener("change", (e) => {
|
||||||
|
resistenzen[key].kompetent = parseInt(e.target.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
action: "abort",
|
||||||
|
label: "Midgard6.Dialog.abbrechen",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: "safe",
|
||||||
|
label: "Midgard6.Dialog.speichern",
|
||||||
|
default: true,
|
||||||
|
callback: async (event, button, dialog) => {
|
||||||
|
console.warn(resistenzen);
|
||||||
|
await this.actor.update({ [`system.resistenzen`]: resistenzen });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #rollKompetenz(event, target) {
|
||||||
|
const dataset = target.dataset;
|
||||||
|
const kompetenz = dataset.kompetenz;
|
||||||
|
const kompetenzValue = dataset.kompetenzValue;
|
||||||
|
|
||||||
|
const dialogResult = await rollDialog({
|
||||||
|
skill: kompetenzValue,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Dialog Result", dialogResult);
|
||||||
|
if (dialogResult === "abort") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Construct the Roll instance
|
||||||
|
const skillValue = kompetenzValue;
|
||||||
|
let die = "";
|
||||||
|
switch (dialogResult.vorteil) {
|
||||||
|
case -1:
|
||||||
|
die = "2d20kl";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
die = "2d20kh";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
die = "1d20";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let rollTerm = "@die + @skill";
|
||||||
|
let rollFlavor = kompetenz;
|
||||||
|
let roll;
|
||||||
|
|
||||||
|
if (dialogResult.spezLevel) {
|
||||||
|
rollTerm += " + @spezBonus";
|
||||||
|
rollFlavor += ": " + dialogResult.spezName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialogResult.customRoll) {
|
||||||
|
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
||||||
|
} else {
|
||||||
|
roll = new Roll(
|
||||||
|
rollTerm,
|
||||||
|
{
|
||||||
|
die: die,
|
||||||
|
skill: skillValue,
|
||||||
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
|
},
|
||||||
|
{ title: rollFlavor },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The parsed terms of the roll formula
|
||||||
|
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
||||||
|
|
||||||
|
// Execute the roll
|
||||||
|
await roll.evaluate();
|
||||||
|
|
||||||
|
const chatData = {
|
||||||
|
rolls: roll,
|
||||||
|
speaker: ChatMessage.getSpeaker(),
|
||||||
|
flags: {
|
||||||
|
"midgard6-lvd": {
|
||||||
|
title: rollFlavor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
|
|
||||||
|
await ChatMessage.create(chatData);
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #rollResistenz(event, target) {
|
||||||
|
const dataset = target.dataset;
|
||||||
|
const name = target.dataset.name;
|
||||||
|
const skill = foundry.utils.getProperty(this.actor, "system.resistenzen." + name);
|
||||||
|
const dialogResult = await rollDialog({
|
||||||
|
name: game.i18n.localize("Midgard6.Resistenzen." + name),
|
||||||
|
skill,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Dialog Result", dialogResult);
|
||||||
|
if (dialogResult === "abort") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Construct the Roll instance
|
||||||
|
const skillValue = skill.value || skill;
|
||||||
|
let die = "";
|
||||||
|
switch (dialogResult.vorteil) {
|
||||||
|
case -1:
|
||||||
|
die = "2d20kl";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
die = "2d20kh";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
die = "1d20";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let rollTerm = "@die + @skill";
|
||||||
|
let rollFlavor = game.i18n.localize("Midgard6.Resistenzen." + name);
|
||||||
|
let roll;
|
||||||
|
|
||||||
|
if (dialogResult.spezLevel) {
|
||||||
|
rollTerm += " + @spezBonus";
|
||||||
|
rollFlavor += ": " + dialogResult.spezName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialogResult.customRoll) {
|
||||||
|
roll = new Roll(dialogResult.customRoll, {}, { title: rollFlavor });
|
||||||
|
} else {
|
||||||
|
roll = new Roll(
|
||||||
|
rollTerm,
|
||||||
|
{
|
||||||
|
die: die,
|
||||||
|
skill: skillValue,
|
||||||
|
spezBonus: dialogResult.spezLevel + 1,
|
||||||
|
},
|
||||||
|
{ title: rollFlavor },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The parsed terms of the roll formula
|
||||||
|
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
||||||
|
|
||||||
|
// Execute the roll
|
||||||
|
await roll.evaluate();
|
||||||
|
|
||||||
|
const chatData = {
|
||||||
|
rolls: roll,
|
||||||
|
speaker: ChatMessage.getSpeaker(),
|
||||||
|
flags: {
|
||||||
|
"midgard6-lvd": {
|
||||||
|
title: rollFlavor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
ChatMessage.applyMode(chatData, dialogResult.rollMode);
|
||||||
|
|
||||||
|
await ChatMessage.create(chatData);
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-1
@@ -73,13 +73,17 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 0.5rem;
|
margin: 0 0.5rem;
|
||||||
}
|
}
|
||||||
&.text {
|
}
|
||||||
|
.text {
|
||||||
&.center {
|
&.center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
&.right {
|
&.right {
|
||||||
text-align: end;
|
text-align: end;
|
||||||
}
|
}
|
||||||
|
&.highlight {
|
||||||
|
color: var(--M6-text-brown);
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input:disabled {
|
input:disabled {
|
||||||
|
|||||||
+33
-22
@@ -4,12 +4,14 @@ import { loadPartials } from "./helpers/partials.mjs";
|
|||||||
import { loadSettings } from "./helpers/settings.mjs";
|
import { loadSettings } from "./helpers/settings.mjs";
|
||||||
|
|
||||||
import { CharacterData } from "./data/character-data.mjs";
|
import { CharacterData } from "./data/character-data.mjs";
|
||||||
|
import { NSCData } from "./data/nsc-data.mjs";
|
||||||
import { WeaponData } from "./data/weapon-data.mjs";
|
import { WeaponData } from "./data/weapon-data.mjs";
|
||||||
import { ItemData } from "./data/item-data.mjs";
|
import { ItemData } from "./data/item-data.mjs";
|
||||||
import { ArmorData } from "./data/armor-data.mjs";
|
import { ArmorData } from "./data/armor-data.mjs";
|
||||||
import { ZauberData } from "./data/zauber-data.mjs";
|
import { ZauberData } from "./data/zauber-data.mjs";
|
||||||
import { HintergrundData } from "./data/hintergrund-data.mjs";
|
import { HintergrundData } from "./data/hintergrund-data.mjs";
|
||||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
import { M6CharacterSheet } from "./sheets/character-sheet.mjs";
|
||||||
|
import { M6NSCSheet } from "./sheets/nsc-sheet.mjs";
|
||||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||||
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
||||||
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
||||||
@@ -24,7 +26,8 @@ Hooks.once("init", () => {
|
|||||||
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
CONFIG.ChatMessage.template = systemPath("templates/chat/message-default.hbs");
|
||||||
|
|
||||||
CONFIG.Actor.dataModels = {
|
CONFIG.Actor.dataModels = {
|
||||||
character: CharacterData
|
character: CharacterData,
|
||||||
|
nsc: NSCData,
|
||||||
};
|
};
|
||||||
CONFIG.Item.dataModels = {
|
CONFIG.Item.dataModels = {
|
||||||
item: ItemData,
|
item: ItemData,
|
||||||
@@ -32,70 +35,78 @@ Hooks.once("init", () => {
|
|||||||
weapon: WeaponData,
|
weapon: WeaponData,
|
||||||
armor: ArmorData,
|
armor: ArmorData,
|
||||||
zauber: ZauberData,
|
zauber: ZauberData,
|
||||||
hintergrund: HintergrundData
|
hintergrund: HintergrundData,
|
||||||
};
|
};
|
||||||
CONFIG.Actor.trackableAttributes = {
|
CONFIG.Actor.trackableAttributes = {
|
||||||
pc: {
|
pc: {
|
||||||
bar: ["resources.leben", "resources.ausdauer"],
|
bar: ["resources.leben", "resources.ausdauer"],
|
||||||
value: ["schicksalsmünzen"]
|
value: ["schicksalsmünzen"],
|
||||||
},
|
},
|
||||||
npc: {
|
npc: {
|
||||||
bar: ["resources.leben", "resources.ausdauer"],
|
bar: ["resources.leben", "resources.ausdauer"],
|
||||||
value: []
|
value: [],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
|
Actor,
|
||||||
|
"midgard6-lvd",
|
||||||
|
M6CharacterSheet,
|
||||||
|
{
|
||||||
types: ["character"],
|
types: ["character"],
|
||||||
makeDefault: true
|
makeDefault: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6NSCSheet, {
|
||||||
|
types: ["nsc"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
||||||
types: ["item"],
|
types: ["item"],
|
||||||
makeDefault: true
|
makeDefault: true,
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ItemSheet, {
|
||||||
types: ["geld"]
|
types: ["geld"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6WeaponSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6WeaponSheet, {
|
||||||
types: ["weapon"]
|
types: ["weapon"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
||||||
types: ["armor"]
|
types: ["armor"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ZauberSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ZauberSheet, {
|
||||||
types: ["zauber"]
|
types: ["zauber"],
|
||||||
});
|
});
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["gunst"]
|
types: ["gunst"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["makel"]
|
types: ["makel"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["schicksalsgabe"]
|
types: ["schicksalsgabe"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
Item,
|
Item,
|
||||||
"midgard6-lvd",
|
"midgard6-lvd",
|
||||||
M6HintergrundSheet,
|
M6HintergrundSheet,
|
||||||
{
|
{
|
||||||
types: ["legende"]
|
types: ["legende"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -117,7 +128,7 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
|||||||
content.classList.toggle("active");
|
content.classList.toggle("active");
|
||||||
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
||||||
},
|
},
|
||||||
{ capture: true }
|
{ capture: true },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CharacterData } from "../data/character-data";
|
import { CharacterData } from "../data/character-data";
|
||||||
|
import { NSCData } from "../data/ncs-data";
|
||||||
import { ItemData } from "../data/item-data";
|
import { ItemData } from "../data/item-data";
|
||||||
import { WeaponData } from "../data/weapon-data";
|
import { WeaponData } from "../data/weapon-data";
|
||||||
import { ArmorData } from "../data/armor-data";
|
import { ArmorData } from "../data/armor-data";
|
||||||
@@ -7,7 +8,7 @@ import { HintergrundData } from "../data/hintergrund-data";
|
|||||||
|
|
||||||
declare module "fvtt-types/configuration" {
|
declare module "fvtt-types/configuration" {
|
||||||
interface DataModelConfig {
|
interface DataModelConfig {
|
||||||
Actor: { character: typeof CharacterData };
|
Actor: { character: typeof CharacterData, nsc: typeOf NSCData };
|
||||||
Item: {
|
Item: {
|
||||||
item: typeof ItemData,
|
item: typeof ItemData,
|
||||||
weapon: typeof WeaponData,
|
weapon: typeof WeaponData,
|
||||||
|
|||||||
+2
-1
@@ -30,7 +30,8 @@
|
|||||||
],
|
],
|
||||||
"documentTypes": {
|
"documentTypes": {
|
||||||
"Actor": {
|
"Actor": {
|
||||||
"character": {}
|
"character": {},
|
||||||
|
"nsc": {}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": {},
|
"item": {},
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<section class="standard-form" style="margin-bottom: 1rem">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Attribute.resistenzen"}}
|
||||||
|
{{localize "Midgard6.NSC.kompetenz.kompetenz"}}</legend>
|
||||||
|
{{#each resistenzen}}
|
||||||
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
|
<div class="flexrow" style="padding-left: 8px">
|
||||||
|
<div class="segmented-button-row">
|
||||||
|
<!-- Option 1 -->
|
||||||
|
<p class="text highlight">{{localizeConcat "Midgard6.Resistenzen." @key}}</p>
|
||||||
|
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="-1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.miserabel"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 2 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="0" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.mittelmäßig"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<!-- Option 3 -->
|
||||||
|
<label class="segmented-button">
|
||||||
|
<input type="radio" name="{{@key}}-segment" value="1" />
|
||||||
|
<span class="segmented-button__content">
|
||||||
|
<p>{{localize "Midgard6.NSC.kompetenz.kompetent"}}</p>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{{! Beschreibung Allgemein Tab }}
|
||||||
|
<section
|
||||||
|
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||||
|
data-tab="{{tab.id}}"
|
||||||
|
data-group="{{tab.group}}"
|
||||||
|
>
|
||||||
|
<fieldset style="height:100%">
|
||||||
|
<legend>{{localize "Midgard6.Sheets.Tabs.biographie"}}</legend>
|
||||||
|
{{#if editable}}
|
||||||
|
<prose-mirror
|
||||||
|
style="height:100%"
|
||||||
|
name="system.biographie.beschreibung"
|
||||||
|
data-document-u-u-i-d="{{actor.uuid}}"
|
||||||
|
value="{{system.biographie.beschreibung}}"
|
||||||
|
collaborate="true"
|
||||||
|
toggled="true"
|
||||||
|
>
|
||||||
|
{{{enrichedBeschreibung}}}
|
||||||
|
</prose-mirror>
|
||||||
|
{{else}}
|
||||||
|
{{{enrichedBeschreibung}}}
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
<section
|
||||||
|
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||||
|
data-tab="{{tab.id}}"
|
||||||
|
data-group="{{tab.group}}"
|
||||||
|
>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.NSC.kompetenz.würfe"}}</legend>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div></div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="white-space: nowrap; position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.kompetent"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.kompetent"}}" data-kompetenz-value="{{kompetenzWürfe.kompetent}}">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ {{kompetenzWürfe.kompetent}}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.mittelmäßig"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.mittelmäßig"}}" data-kompetenz-value="{{kompetenzWürfe.mittelmäßig}}">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ {{kompetenzWürfe.mittelmäßig}}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-weight: bold; color: var(--M6-text-brown)">{{localize
|
||||||
|
"Midgard6.NSC.kompetenz.miserabel"
|
||||||
|
}}</label>
|
||||||
|
<a class="d-flex align-items-center" data-action="rollKompetenz" data-kompetenz="{{localize "Midgard6.NSC.kompetenz.miserabel"}}" data-kompetenz-value="d3">
|
||||||
|
<i class="fa-solid fa-dice-d20" style="margin-right: 0"></i>
|
||||||
|
<p>+ d3</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-7">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Sheets.Tabs.eigenschaften"}}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.hinzufügen"}}"
|
||||||
|
data-action="addKompetenz"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
{{#each fertigkeiten as |fertigkeit|}}
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-6 row align-items-center" style="width: 100%; margin-left: 0">
|
||||||
|
<a
|
||||||
|
class="col-8"
|
||||||
|
data-action="rollSkill"
|
||||||
|
data-name="{{fertigkeit}}"
|
||||||
|
>
|
||||||
|
<p>{{fertigkeit}}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<fieldset class="">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.resistenzen"}}
|
||||||
|
{{#if @root.editable}}
|
||||||
|
{{#unless system.locked}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize "Midgard6.NSC.kompetenz.hinzufügen"}}"
|
||||||
|
data-action="editResistenz"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
</legend>
|
||||||
|
<div class="row">
|
||||||
|
{{#each system.resistenzen as |resistenz|}}
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
|
<p class="resistenzenHeader">{{localizeConcat "Midgard6.Resistenzen." @key}}</p>
|
||||||
|
<div class="d-flex justify-content-center align-items-center">
|
||||||
|
<a
|
||||||
|
class=""
|
||||||
|
data-action="rollResistenz"
|
||||||
|
data-name="{{@key}}"
|
||||||
|
>
|
||||||
|
<i class="fa-solid fa-dice-d20" style=""></i>
|
||||||
|
</a>
|
||||||
|
<input
|
||||||
|
class="resistenzenAttribut"
|
||||||
|
type="text"
|
||||||
|
value="{{resistenz.value}}"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="d-flex">
|
||||||
|
<fieldset class="col highlight">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.lp"}}</legend>
|
||||||
|
<div class="d-flex align-items-end">
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.aktuell"}}</p>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="armor-box">
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
|
<span class="armor-value">{{system.rüstwert.mod}}</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.leben.value"
|
||||||
|
value="{{system.resources.leben.value}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="center">/</p>
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.maximal.short"}}</p>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.leben.max"
|
||||||
|
value="{{system.resources.leben.max}}"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="col highlight">
|
||||||
|
<legend>{{localize "Midgard6.Attribute.ap"}}</legend>
|
||||||
|
<div class="d-flex align-items-end">
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.aktuell"}}</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.ausdauer.value"
|
||||||
|
value="{{system.resources.ausdauer.value}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p class="center">/</p>
|
||||||
|
<div>
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.maximal.short"}}</p>
|
||||||
|
<input
|
||||||
|
class="attribut"
|
||||||
|
type="number"
|
||||||
|
name="system.resources.ausdauer.max"
|
||||||
|
value="{{system.resources.ausdauer.max}}"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
{{!-- <div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.weapon.plural" }}</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each equippedWeapons as |weapon|}}
|
||||||
|
<div class="item row align-items-center">
|
||||||
|
<div class="col-10">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<img class="" style="margin-right: 4px" src="{{weapon.img}}" alt="{{weapon.name}}" width="24" height="24" />
|
||||||
|
<p>{{weapon.name}}: </p>
|
||||||
|
<p>
|
||||||
|
<i class="fas fa-dice-d20" style="font-size:12px; margin:0 2px 0 4px"></i>
|
||||||
|
+ {{weapon.skillValue}} {{#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="rollWeapon"
|
||||||
|
data-item-id="{{weapon.id}}"
|
||||||
|
data-skillPath="{{weapon.path}}"
|
||||||
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
>
|
||||||
|
<i class="fas fa-dice-d20"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.armor.plural" }}</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each armor.armors as |armor|}}
|
||||||
|
<div class="item row align-items-center">
|
||||||
|
<div class="col-10">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<img class="" style="margin-right: 4px" src="{{armor.img}}" alt="{{armor.name}}" width="24" height="24" />
|
||||||
|
<p>{{armor.name}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<div class="armor-box" style="position: relative; margin-left: 0px; top: 12px">
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
|
<span class="armor-value" style="position: relative; right:-8px; top: -22px">{{armor.rüstwert}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{#if armor.einschränkungen}}
|
||||||
|
<p class="resistenzenHeader">{{localize "Midgard6.Item.einschränkung"}}</p>
|
||||||
|
<p>{{splitArray armor.einschränkungen}}</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.zauber.plural" }}</legend>
|
||||||
|
<div class="container">
|
||||||
|
{{#each equippedSpells as |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}}"
|
||||||
|
{{#unless @root.editable}}disabled{{/unless}}
|
||||||
|
>
|
||||||
|
<i class="fas fa-dice-d20"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<header class="sheet-header">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.name"}}" name="name" value="{{actor.name}}" />
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.Biographie.spezies"}}" name="system.biographie.spezies" value="{{system.biographie.spezies}}" />
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text" type="text" placeholder="{{localize "Midgard6.Biographie.kultur"}}" name="system.biographie.kultur" value="{{system.biographie.kultur}}" />
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
class="profile-img"
|
||||||
|
style="z-index:1"
|
||||||
|
src="{{actor.img}}"
|
||||||
|
alt="{{actor.name}}"
|
||||||
|
{{#if editable}}
|
||||||
|
data-action="editImage"
|
||||||
|
data-edit="img"
|
||||||
|
{{/if}}
|
||||||
|
data-tooltip="{{actor.name}}"
|
||||||
|
height="100" width="100"
|
||||||
|
>
|
||||||
|
<div class="col-6">
|
||||||
|
<input {{#if @root.system.locked}}disabled{{/if}} class="text right" type="number" placeholder="{{localize "Midgard6.NSC.kompetenz"}}" name="system.kompetenz" value="{{system.kompetenz}}" />
|
||||||
|
<select
|
||||||
|
type="text"
|
||||||
|
class="text right"
|
||||||
|
name="system.größe"
|
||||||
|
id="system.größe"
|
||||||
|
{{#if @root.system.locked}}disabled{{/if}}
|
||||||
|
>
|
||||||
|
<option {{#ifeq system.größe "winzig"}}selected{{/ifeq}} value="winzig">{{localize
|
||||||
|
"Midgard6.NSC.Größe.winzig"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "klein"}}selected{{/ifeq}} value="klein">{{localize
|
||||||
|
"Midgard6.NSC.Größe.klein"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "normal"}}selected{{/ifeq}} value="normal">{{localize
|
||||||
|
"Midgard6.NSC.Größe.normal"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "groß"}}selected{{/ifeq}} value="groß">{{localize
|
||||||
|
"Midgard6.NSC.Größe.groß"
|
||||||
|
}}</option>
|
||||||
|
<option {{#ifeq system.größe "riesig"}}selected{{/ifeq}} value="riesig">{{localize
|
||||||
|
"Midgard6.NSC.Größe.riesig"
|
||||||
|
}}</option>
|
||||||
|
</select>
|
||||||
|
<div></div>
|
||||||
|
{{!-- <input {{#if @root.system.locked}}disabled{{/if}} class="text right" type="text" placeholder="{{localize "Midgard6.Biographie.mondgestalt"}}" name="system.biographie.mondgestalt" value="{{system.biographie.mondgestalt}}" /> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
{{! Beschreibung Allgemein Tab }}
|
||||||
|
<section
|
||||||
|
class="standard-form tab scrollable {{tab.cssClass}}"
|
||||||
|
data-tab="{{tab.id}}"
|
||||||
|
data-group="{{tab.group}}"
|
||||||
|
>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Grad.grad"}}</legend>
|
||||||
|
<div class="d-flex justify-content-center align-items-center">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
class="text center"
|
||||||
|
style="max-width:3rem;"
|
||||||
|
name="system.grad.grad"
|
||||||
|
value="{{system.grad.grad}}"
|
||||||
|
/>
|
||||||
|
<p style="font-size:18px; font-weight: bold; padding: 0 8px">{{localize
|
||||||
|
"Midgard6.Grad.erfahrung"
|
||||||
|
}}</p>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-size: 12px;">{{localize
|
||||||
|
"Midgard6.Grad.frei"
|
||||||
|
}}</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
class="text center"
|
||||||
|
style="max-width:3rem;"
|
||||||
|
name="system.grad.erfahrungspunkteFrei"
|
||||||
|
value="{{system.grad.erfahrungspunkteFrei}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p style=" font-size:32px; padding: 0 8px">+</p>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-size: 12px;">{{localize
|
||||||
|
"Midgard6.Grad.eingesetzt"
|
||||||
|
}}</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
class="text center"
|
||||||
|
style="max-width:3rem;"
|
||||||
|
name="system.grad.erfahrungspunkteEingesetzt"
|
||||||
|
value="{{system.grad.erfahrungspunkteEingesetzt}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p style=" font-size:32px; padding: 0 8px">=</p>
|
||||||
|
<div
|
||||||
|
class="d-flex align-items-center justify-content-center flex-column"
|
||||||
|
style="position: relative;"
|
||||||
|
>
|
||||||
|
<label style="position: absolute; bottom: 100%; font-size: 12px;">{{localize
|
||||||
|
"Midgard6.Grad.gesamt"
|
||||||
|
}}</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
class="text center"
|
||||||
|
style="max-width:3rem;"
|
||||||
|
name="system.grad.erfahrungsschatz"
|
||||||
|
value="{{system.grad.erfahrungsschatz}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Hintergrund.type.gunst.singular"}}
|
||||||
|
&
|
||||||
|
{{localize "Midgard6.Hintergrund.type.makel.singular"}}</legend>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
{{#with itemTypes.gunst}}
|
||||||
|
<div class="itemHeader" style="margin-bottom: 8px">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="gunst"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#each this.items as |gunst|}}
|
||||||
|
<div
|
||||||
|
class="collapsible"
|
||||||
|
data-action="collapsible"
|
||||||
|
data-item-id="{{gunst._id}}"
|
||||||
|
data-type="Item"
|
||||||
|
data-document-class="Item"
|
||||||
|
>{{gunst.name}}
|
||||||
|
<div>
|
||||||
|
<i class="fas fa-expand"></i>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=gunst.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=gunst.name}}"
|
||||||
|
style="z-index:9999"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{{gunst.system.beschreibung}}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
{{#with itemTypes.makel}}
|
||||||
|
<div class="itemHeader" style="margin-bottom: 8px">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="makel"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#each this.items as |makel|}}
|
||||||
|
<div
|
||||||
|
type="button"
|
||||||
|
class="collapsible"
|
||||||
|
data-action="collapsible"
|
||||||
|
data-item-id="{{makel._id}}"
|
||||||
|
data-type="Item"
|
||||||
|
data-document-class="Item"
|
||||||
|
>{{makel.name}}
|
||||||
|
<div>
|
||||||
|
<i class="fas fa-expand"></i>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=makel.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=makel.name}}"
|
||||||
|
style="z-index:9999"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
{{{makel.system.beschreibung}}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-6" style="height: 100%">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Hintergrund.type.legende.plural"}}</legend>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{#with itemTypes.legende}}
|
||||||
|
<div class="itemHeader" style="margin-bottom: 8px">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="legende"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#each this.items as |legende|}}
|
||||||
|
<div
|
||||||
|
class="collapsible"
|
||||||
|
data-action="collapsible"
|
||||||
|
data-item-id="{{legende._id}}"
|
||||||
|
data-type="Item"
|
||||||
|
data-document-class="Item"
|
||||||
|
>{{legende.name}}
|
||||||
|
<div>
|
||||||
|
<i class="fas fa-expand"></i>
|
||||||
|
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=legende.name}}"
|
||||||
|
style="z-index:9999"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{{legende.system.beschreibung}}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-6">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Hintergrund.type.schicksalsgabe.plural"}}</legend>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{#with itemTypes.schicksalsgabe}}
|
||||||
|
<div class="itemHeader" style="margin-bottom: 8px">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="schicksalsgabe"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{#each this.items as |schicksalsgabe|}}
|
||||||
|
<div
|
||||||
|
class="collapsible"
|
||||||
|
data-action="collapsible"
|
||||||
|
data-item-id="{{schicksalsgabe._id}}"
|
||||||
|
data-type="Item"
|
||||||
|
data-document-class="Item"
|
||||||
|
>{{schicksalsgabe.name}}
|
||||||
|
<div>
|
||||||
|
<i class="fas fa-expand"></i>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=schicksalsgabe.name}}"
|
||||||
|
style="z-index:9999"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{{gunst.system.beschreibung}}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
{{! Items Tab }}
|
||||||
|
<section class="standard-form tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="items">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<fieldset >
|
||||||
|
<legend>{{localize "Midgard6.Item.type.münze.plural" }}</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.geld}}
|
||||||
|
<li class="itemHeader">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="geld"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<div class="document-controls">
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
data-action="decreaseDoc"
|
||||||
|
data-item-id="{{item._id}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-minus"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control"
|
||||||
|
data-action="increaseDoc"
|
||||||
|
data-item-id="{{item._id}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="document-controls">
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset >
|
||||||
|
<legend>{{localize "Midgard6.Item.type.item.plural" }}</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.item}}
|
||||||
|
<li class="itemHeader">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="item"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
{{!-- Waffen --}}
|
||||||
|
|
||||||
|
<fieldset class="highlight">
|
||||||
|
<legend>{{localize "Midgard6.Item.type.weapon.plural" }}</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.weapon}}
|
||||||
|
<li class="itemHeader">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="weapon"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<a class="sword" data-action="cycleEquip" data-item-id="{{item._id}}" style="{{#if item.system.equipped}}background-color: var(--M6-text-brown){{/if}}">
|
||||||
|
</a>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{!-- Rüstung --}}
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Item.type.armor.plural" }}</legend>
|
||||||
|
<ul class="itemTypes">
|
||||||
|
{{#with itemTypes.armor}}
|
||||||
|
<li class="itemHeader">
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-create"
|
||||||
|
title="{{localize 'DOCUMENT.Create' type=this.label}}"
|
||||||
|
data-action="createDoc"
|
||||||
|
data-document-class="Item"
|
||||||
|
data-type="armor"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.Create" type=this.label}}
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<ul class="items">
|
||||||
|
{{#each this.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-type="Item" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.system.anzahl}}x {{item.name}}</div>
|
||||||
|
<a class="fa-solid fa-shield" data-action="cycleEquip" data-item-id="{{item._id}}" style="{{#if item.system.equipped}}color: var(--M6-text-brown){{/if}}"></a>
|
||||||
|
<div class="document-controls">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=item.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=item.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/with}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
<div class="sticky-progress-container">
|
||||||
|
<div class="tooltip-wrapper">
|
||||||
|
<span class="tooltiptext">{{localize "Midgard6.Traglast"}}: {{gewicht.gewicht}} / {{gewicht.traglast}}</span>
|
||||||
|
|
||||||
|
<div class="progress-background">
|
||||||
|
<progress
|
||||||
|
class="progress-bar"
|
||||||
|
value="{{gewicht.gewicht}}"
|
||||||
|
max="{{gewicht.traglast}}"
|
||||||
|
></progress>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
{{! 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">
|
||||||
|
<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" style="padding-top: 8px">{{zauber.name}}</p>
|
||||||
|
<p class="col-3 item-name">{{zauber.system.eigenschaften.ursprung}}</p>
|
||||||
|
<p class="col-2 item-name">{{localize "Midgard6.Zauber.stufe"}} {{zauber.system.eigenschaften.stufe}}</p>
|
||||||
|
<a class="align-self-center col-1 fa-solid fa-book-open" {{#unless @root.editable}}disabled{{/unless}} data-action="cycleEquip" data-item-id="{{zauber._id}}" style="{{#if zauber.system.equipped}}color: var(--M6-text-brown);{{/if}}"></a>
|
||||||
|
<a class="align-self-center col-2 fa-solid fa-dice-d20" data-action="rollSpell" {{#unless @root.editable}}disabled{{/unless}} data-name="{{zauber.name}}" data-item-id="{{zauber._id}}"></a>
|
||||||
|
<div class="col-1 d-flex document-controls" style="margin: 0.5rem 0; padding: 0">
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<a
|
||||||
|
class="item-control item-edit"
|
||||||
|
title="{{localize 'DOCUMENT.Update' type=zauber.name}}"
|
||||||
|
data-action="viewDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
class="item-control item-delete"
|
||||||
|
title="{{localize 'DOCUMENT.Delete' type=zauber.name}}"
|
||||||
|
data-action="deleteDoc"
|
||||||
|
>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
Reference in new issue
Block a user