changes
This commit is contained in:
1 parent
ba31eea229
commit
9b36127621
13 files changed
+878
-377
No files matched your search
+4
-2
@@ -64,7 +64,8 @@
|
|||||||
"properties": "Fertigkeiten",
|
"properties": "Fertigkeiten",
|
||||||
"items": "Gegenstände",
|
"items": "Gegenstände",
|
||||||
"effects": "Effekte"
|
"effects": "Effekte"
|
||||||
}
|
},
|
||||||
|
"spezialisierung": "Spezialisierung"
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"Quantity": "Anzahl",
|
"Quantity": "Anzahl",
|
||||||
@@ -76,7 +77,8 @@
|
|||||||
"character": "Charakter"
|
"character": "Charakter"
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": "Gegenstand"
|
"item": "Gegenstand",
|
||||||
|
"spezialisierung": "Spezialisierung"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
function defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
description: new fields.HTMLField({ initial: "" }),
|
||||||
|
level: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
nullable: false,
|
||||||
|
integer: true,
|
||||||
|
initial: 1,
|
||||||
|
min: 0
|
||||||
|
}),
|
||||||
|
linkedSkill: new fields.StringField({ initial: "" })
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SpezialisierungData extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema = defineSchema;
|
||||||
|
}
|
||||||
@@ -362,7 +362,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
// Construct the Roll instance
|
// Construct the Roll instance
|
||||||
const skillValue = dataset.value;
|
const skillValue = dataset.value;
|
||||||
let die = "";
|
let die = "";
|
||||||
console.warn(dialogResult);
|
|
||||||
switch (dialogResult.vorteil) {
|
switch (dialogResult.vorteil) {
|
||||||
case -1:
|
case -1:
|
||||||
die = "2d20kl";
|
die = "2d20kl";
|
||||||
@@ -399,7 +398,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
|||||||
// 1. Define the path to .hbs template
|
// 1. Define the path to .hbs template
|
||||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||||
const templateData = {
|
const templateData = {
|
||||||
classes: ["dialog"],
|
classes: ["M6", "dialog"],
|
||||||
skill,
|
skill,
|
||||||
vorteil,
|
vorteil,
|
||||||
customRoll
|
customRoll
|
||||||
|
|||||||
+267
-313
@@ -1,26 +1,28 @@
|
|||||||
import { systemPath } from "../constants.mjs";
|
|
||||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
|
import { systemPath } from "../constants.mjs";
|
||||||
const { api, sheets } = foundry.applications;
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the basic ActorSheet with some very simple modifications.
|
* Extend the basic ItemSheet with some very simple modifications.
|
||||||
*/
|
*/
|
||||||
export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheetV2) {
|
export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ["M6", "item"],
|
|
||||||
window: {
|
|
||||||
icon: "fa-solid fa-suitcase",
|
|
||||||
resizable: true
|
|
||||||
},
|
|
||||||
position: {
|
position: {
|
||||||
width: 800,
|
width: 600
|
||||||
height: 400
|
},
|
||||||
|
classes: ["M6", "item", "standard-form"],
|
||||||
|
actions: {
|
||||||
|
viewDoc: this.#viewEffect,
|
||||||
|
createDoc: this.#createEffect,
|
||||||
|
deleteDoc: this.#deleteEffect,
|
||||||
|
toggleEffect: this.#toggleEffect
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
submitOnChange: true
|
submitOnChange: true
|
||||||
}
|
},
|
||||||
|
// Custom property that's merged into `this.options`
|
||||||
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -29,20 +31,14 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
primary: {
|
primary: {
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
id: "properties",
|
id: "properties"
|
||||||
icon: "fa-feather-pointed"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "items",
|
id: "effects"
|
||||||
icon: "fa-suitcase"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "effects",
|
|
||||||
icon: "fa-bolt"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
initial: "properties",
|
initial: "properties",
|
||||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
labelPrefix: "M6.Sheets.Tabs"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -50,20 +46,17 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: {
|
|
||||||
template: systemPath("templates/actor/tabs.hbs")
|
|
||||||
},
|
|
||||||
header: {
|
header: {
|
||||||
template: systemPath("templates/actor/header.hbs")
|
template: systemPath("templates/item/header.hbs")
|
||||||
|
},
|
||||||
|
tabs: {
|
||||||
|
// Foundry-provided generic template
|
||||||
|
template: "templates/generic/tab-navigation.hbs"
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
template: systemPath("templates/shared/properties.hbs"),
|
template: systemPath("templates/shared/properties.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""]
|
||||||
},
|
},
|
||||||
items: {
|
|
||||||
template: systemPath("templates/actor/items.hbs"),
|
|
||||||
scrollable: [""]
|
|
||||||
},
|
|
||||||
effects: {
|
effects: {
|
||||||
template: systemPath("templates/shared/effects.hbs"),
|
template: systemPath("templates/shared/effects.hbs"),
|
||||||
scrollable: [""]
|
scrollable: [""]
|
||||||
@@ -90,10 +83,11 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
Object.assign(context, {
|
Object.assign(context, {
|
||||||
owner: this.document.isOwner,
|
owner: this.document.isOwner,
|
||||||
limited: this.document.limited,
|
limited: this.document.limited,
|
||||||
|
item: this.item,
|
||||||
actor: this.actor,
|
actor: this.actor,
|
||||||
system: this.actor.system,
|
system: this.item.system,
|
||||||
skills: this.actor.system.skills,
|
flags: this.item.flags,
|
||||||
flags: this.actor.flags,
|
itemFields: this.item.schema.fields,
|
||||||
config: CONFIG
|
config: CONFIG
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,36 +98,29 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
async _preparePartContext(partId, context) {
|
async _preparePartContext(partId, context) {
|
||||||
|
// TODO: Come up with clever way to automatically handle enriching HTML fields
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
// case "stats":
|
|
||||||
// context.fields = await this._getResources();
|
|
||||||
// context.tab = context.tabs[partId];
|
|
||||||
// break;
|
|
||||||
case "effects":
|
case "effects":
|
||||||
context.effects = prepareActiveEffectCategories(this.actor.allApplicableEffects());
|
context.effects = prepareActiveEffectCategories(this.item.effects);
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
case "properties":
|
case "properties":
|
||||||
context.skills = await this._getSkills();
|
context.fields = await this._getFields();
|
||||||
context.resistenzen = await this._getResistenzen();
|
|
||||||
context.tab = context.tabs[partId];
|
|
||||||
break;
|
|
||||||
case "items":
|
|
||||||
context.itemTypes = this._getItems();
|
|
||||||
context.tab = context.tabs[partId];
|
context.tab = context.tabs[partId];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the system fields for the form-fields generic.
|
* Handles the system fields for the form-fields generic.
|
||||||
* @returns {object[]}
|
|
||||||
*/
|
*/
|
||||||
async _getFields() {
|
async _getFields() {
|
||||||
const doc = this.actor;
|
const doc = this.item;
|
||||||
const source = doc._source;
|
const source = doc._source;
|
||||||
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields;
|
const systemFields = CONFIG.Item.dataModels[doc.type]?.schema.fields;
|
||||||
const fieldSets = [];
|
const fieldSets = [];
|
||||||
// TODO: Find a clever way to handle enrichment
|
// TODO: Find a clever way to handle enrichment
|
||||||
for (const field of Object.values(systemFields ?? {})) {
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
@@ -149,73 +136,6 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
return fieldSets;
|
return fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _getSkills() {
|
|
||||||
const doc = this.actor;
|
|
||||||
const source = doc._source;
|
|
||||||
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.skills.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.Skills.gruppen.${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 _getResistenzen() {
|
|
||||||
const doc = this.actor;
|
|
||||||
const source = doc._source;
|
|
||||||
const systemFields = CONFIG.Actor.dataModels[doc.type]?.schema.fields.resistenzen;
|
|
||||||
const fieldset = {
|
|
||||||
fieldset: true,
|
|
||||||
legend: `Midgard6.Attribute.${systemFields.label}`,
|
|
||||||
fields: []
|
|
||||||
};
|
|
||||||
for (const field of Object.values(systemFields.fields ?? {})) {
|
|
||||||
const path = `system.resistenzen.${field.name}`;
|
|
||||||
fieldset.fields.push({
|
|
||||||
field,
|
|
||||||
value: foundry.utils.getProperty(source, path),
|
|
||||||
localizationName: "Midgard6.Resistenzen." + field.name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.warn(fieldset);
|
|
||||||
return fieldset;
|
|
||||||
}
|
|
||||||
|
|
||||||
async _getResources() {
|
|
||||||
const doc = this.actor;
|
|
||||||
const source = doc._source;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,47 +147,22 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
if (field instanceof foundry.data.fields.SchemaField) {
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
this.#addSystemFields(fieldset, field.fields, source, path);
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
} else if (field.constructor.hasFormSupport) {
|
} else if (field.constructor.hasFormSupport) {
|
||||||
fieldset.fields.push({
|
fieldset.fields.push({ field, value: foundry.utils.getProperty(source, path) });
|
||||||
field,
|
|
||||||
value: foundry.utils.getProperty(source, path),
|
|
||||||
localizationName: "Midgard6.Skills." + field.name
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
// Only show Base if it's actually being used
|
|
||||||
if (types.base.items.length === 0) delete types.base;
|
|
||||||
return types;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions performed after any render of the Application.
|
* Actions performed after any render of the Application.
|
||||||
* Post-render steps are not awaited by the render process.
|
* Post-render steps are not awaited by the render process.
|
||||||
* @param {ApplicationRenderContext} context Prepared context data.
|
* @param {ApplicationRenderContext} context Prepared context data.
|
||||||
* @param {RenderOptions} options Provided render options.
|
* @param {RenderOptions} options Provided render options.
|
||||||
* @protected
|
* @protected
|
||||||
* @inheritdoc
|
|
||||||
*/
|
*/
|
||||||
async _onRender(context, options) {
|
_onRender(context, options) {
|
||||||
await super._onRender(context, options);
|
this.#dragDrop.forEach((d) => d.bind(this.element));
|
||||||
this.#disableOverrides();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -277,14 +172,14 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/**
|
/**
|
||||||
* Renders an embedded document's sheet.
|
* Renders an embedded document's sheet.
|
||||||
*
|
*
|
||||||
* @this M6ActorSheet
|
* @this UTSItemSheet
|
||||||
* @param {PointerEvent} event The originating click event.
|
* @param {PointerEvent} event The originating click event.
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
static async #viewDoc(event, target) {
|
static async #viewEffect(event, target) {
|
||||||
const doc = this._getEmbeddedDocument(target);
|
const effect = this._getEffect(target);
|
||||||
doc.sheet.render(true);
|
effect.sheet.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -292,14 +187,14 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/**
|
/**
|
||||||
* Handles item deletion.
|
* Handles item deletion.
|
||||||
*
|
*
|
||||||
* @this M6ActorSheet
|
* @this UTSItemSheet
|
||||||
* @param {PointerEvent} event The originating click event.
|
* @param {PointerEvent} event The originating click event.
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
static async #deleteDoc(event, target) {
|
static async #deleteEffect(event, target) {
|
||||||
const doc = this._getEmbeddedDocument(target);
|
const effect = this._getEffect(target);
|
||||||
doc.delete();
|
effect.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -307,24 +202,25 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/**
|
/**
|
||||||
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
||||||
*
|
*
|
||||||
* @this M6ActorSheet
|
* @this UTSItemSheet
|
||||||
* @param {PointerEvent} event The originating click event.
|
* @param {PointerEvent} event The originating click event.
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static async #createDoc(event, target) {
|
static async #createEffect(event, target) {
|
||||||
const docCls = getDocumentClass(target.dataset.documentClass);
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
const docData = {
|
const effectData = {
|
||||||
name: docCls.defaultName({
|
name: aeCls.defaultName({
|
||||||
type: target.dataset.type,
|
type: target.dataset.type,
|
||||||
parent: this.actor
|
parent: this.item
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
if (["action", "documentClass"].includes(dataKey)) continue;
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
foundry.utils.setProperty(docData, dataKey, value);
|
foundry.utils.setProperty(effectData, dataKey, value);
|
||||||
}
|
}
|
||||||
docCls.create(docData, { parent: this.actor });
|
|
||||||
|
aeCls.create(effectData, { parent: this.item });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
@@ -332,191 +228,249 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
|||||||
/**
|
/**
|
||||||
* Determines effect parent to pass to helper.
|
* Determines effect parent to pass to helper.
|
||||||
*
|
*
|
||||||
* @this M6ActorSheet
|
* @this UTSItemSheet
|
||||||
* @param {PointerEvent} event The originating click event.
|
* @param {PointerEvent} event The originating click event.
|
||||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static async #toggleEffect(event, target) {
|
static async #toggleEffect(event, target) {
|
||||||
const effect = this._getEmbeddedDocument(target);
|
const effect = this._getEffect(target);
|
||||||
effect.update({ disabled: !effect.disabled });
|
effect.update({ disabled: !effect.disabled });
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #rollSkill(event, target) {
|
|
||||||
const dataset = target.dataset;
|
|
||||||
const actor = this.actor;
|
|
||||||
const dialogResult = await this.rollDialog({
|
|
||||||
dataset,
|
|
||||||
actor
|
|
||||||
});
|
|
||||||
if (dialogResult.noRoll) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Construct the Roll instance
|
|
||||||
const skillValue = dataset.value;
|
|
||||||
let die = "";
|
|
||||||
console.warn(dialogResult);
|
|
||||||
switch (dialogResult.vorteil) {
|
|
||||||
case "-1":
|
|
||||||
die = "2d20kl";
|
|
||||||
break;
|
|
||||||
case "1":
|
|
||||||
die = "2d20kh";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
die = "1d20";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let roll = new Roll("@die + @skill", { die: die, skill: skillValue }, { flavor: dataset.name });
|
|
||||||
|
|
||||||
// The parsed terms of the roll formula
|
|
||||||
console.log("Roll:", roll); // [Die, OperatorTerm, NumericTerm, OperatorTerm, NumericTerm]
|
|
||||||
|
|
||||||
// Execute the roll
|
|
||||||
await roll.evaluate();
|
|
||||||
|
|
||||||
roll.toMessage();
|
|
||||||
|
|
||||||
roll.toAnchor();
|
|
||||||
// let message = new Message(roll);
|
|
||||||
// console.warn(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
async rollDialog(rollDialogRequest) {
|
|
||||||
// Assamble dialog depending on roll type
|
|
||||||
let label = rollDialogRequest.dataset.name;
|
|
||||||
let skill = rollDialogRequest.dataset.value;
|
|
||||||
let vorteil = 0;
|
|
||||||
let customRoll = "";
|
|
||||||
// 1. Define the path to .hbs template
|
|
||||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
|
||||||
const templateData = {
|
|
||||||
classes: ["roll"],
|
|
||||||
skill,
|
|
||||||
vorteil,
|
|
||||||
customRoll
|
|
||||||
};
|
|
||||||
// 2. Render the Handlebars template into an HTML string
|
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(
|
|
||||||
templatePath,
|
|
||||||
templateData
|
|
||||||
);
|
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// const dialog = new foundry.applications.api.DialogV2({
|
|
||||||
return foundry.applications.api.DialogV2.wait({
|
|
||||||
window: { title: "Würfel Modifikatoren: " + label },
|
|
||||||
position: {
|
|
||||||
width: 600
|
|
||||||
},
|
|
||||||
content,
|
|
||||||
actions: {},
|
|
||||||
render: (_event, dialog) => {
|
|
||||||
const dialogHTML = dialog.element;
|
|
||||||
|
|
||||||
const slider = dialogHTML.querySelector("#vorteilSlider");
|
|
||||||
const display = dialogHTML.querySelector("#rollDisplay");
|
|
||||||
|
|
||||||
slider.addEventListener("input", (e) => {
|
|
||||||
const vorteilWert = parseInt(e.target.value);
|
|
||||||
switch (vorteilWert) {
|
|
||||||
case 1:
|
|
||||||
display.placeholder = `2d20kh + ${skill} (Vorteil)`;
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
display.placeholder = `2d20kl + ${skill} (Nachteil)`;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
display.placeholder = `1d20 + ${skill}`;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
action: "abort",
|
|
||||||
label: "Midgard6.Dialog.abbrechen",
|
|
||||||
callback: (event, button, dialog) => {
|
|
||||||
return { noRoll: true };
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
action: "roll",
|
|
||||||
label: "Midgard6.Dialog.würfeln",
|
|
||||||
default: true,
|
|
||||||
callback: (event, button, dialog) => {
|
|
||||||
const rollData = {
|
|
||||||
customRoll: button.form.elements.customRoll.value,
|
|
||||||
vorteil: button.form.elements.vorteil.value
|
|
||||||
};
|
|
||||||
return rollData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
// submit: (rollData) => {
|
|
||||||
// if (noRoll) {
|
|
||||||
// resolve({ noRoll: true });
|
|
||||||
// } else {
|
|
||||||
// resolve(rollData);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the embedded document representing the containing HTML element.
|
* Fetches the row with the data for the rendered embedded document.
|
||||||
*
|
*
|
||||||
* @param {HTMLElement} target The element subject to search.
|
* @param {HTMLElement} target The element with the action.
|
||||||
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
* @returns {HTMLLIElement} The document's row.
|
||||||
*/
|
*/
|
||||||
_getEmbeddedDocument(target) {
|
_getEffect(target) {
|
||||||
const docRow = target.closest("li[data-document-class]");
|
const li = target.closest(".effect");
|
||||||
if (docRow.dataset.documentClass === "Item") {
|
return this.item.effects.get(li?.dataset?.effectId);
|
||||||
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 */
|
/* Drag and drop */
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit a document update based on the processed form data.
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
||||||
* @param {SubmitEvent} event The originating form submission event.
|
* @param {string} selector The candidate HTML selector for dragging.
|
||||||
* @param {HTMLFormElement} form The form element that was submitted.
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
* @param {object} submitData Processed and validated form data to be used for a document update.
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
* @protected
|
* @protected
|
||||||
* @inheritdoc
|
|
||||||
*/
|
*/
|
||||||
async _processSubmitData(event, form, submitData) {
|
_canDragStart(selector) {
|
||||||
const overrides = foundry.utils.flattenObject(this.actor.overrides);
|
return this.isEditable;
|
||||||
for (const k of Object.keys(overrides)) delete submitData[k];
|
|
||||||
this.document.update(submitData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables inpM6 subject to active effects.
|
* 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
|
||||||
*/
|
*/
|
||||||
#disableOverrides() {
|
_canDragDrop(selector) {
|
||||||
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
return this.isEditable;
|
||||||
for (const override of Object.keys(flatOverrides)) {
|
}
|
||||||
const input = this.element.querySelector(`[name="${override}"]`);
|
|
||||||
if (input) input.disabled = true;
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const li = event.currentTarget;
|
||||||
|
if ("link" in event.target.dataset) return;
|
||||||
|
|
||||||
|
let dragData = null;
|
||||||
|
|
||||||
|
if (li.dataset.effectId) {
|
||||||
|
const effect = this.item.effects.get(li.dataset.effectId);
|
||||||
|
dragData = effect.toDragData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!dragData) return;
|
||||||
|
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
|
const item = this.item;
|
||||||
|
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||||
|
if (allowed === false) return;
|
||||||
|
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "ActiveEffect":
|
||||||
|
return this._onDropActiveEffect(event, data);
|
||||||
|
case "Actor":
|
||||||
|
return this._onDropActor(event, data);
|
||||||
|
case "Item":
|
||||||
|
return this._onDropItem(event, data);
|
||||||
|
case "Folder":
|
||||||
|
return this._onDropFolder(event, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActiveEffect(event, data) {
|
||||||
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
|
const effect = await aeCls.fromDropData(data);
|
||||||
|
if (!this.item.isOwner || !effect) return false;
|
||||||
|
|
||||||
|
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
||||||
|
aeCls.create(effect, { parent: this.item });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts an Active Effect based on its surrounding attributes.
|
||||||
|
*
|
||||||
|
* @param {DragEvent} event
|
||||||
|
* @param {ActiveEffect} effect
|
||||||
|
*/
|
||||||
|
_onEffectSort(event, effect) {
|
||||||
|
const effects = this.item.effects;
|
||||||
|
const dropTarget = event.target.closest("[data-effect-id]");
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = effects.get(dropTarget.dataset.effectId);
|
||||||
|
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (effect.id === target.id) return;
|
||||||
|
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.effectId;
|
||||||
|
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
|
target,
|
||||||
|
siblings
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target._id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an Actor data onto another Actor sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
||||||
|
* not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActor(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropItem(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of a Folder on an Actor Sheet.
|
||||||
|
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropFolder(event, data) {
|
||||||
|
if (!this.item.isOwner) return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* The following pieces set up drag */
|
||||||
|
/* handling and are unlikely to need modification */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
// This is marked as private because there's no real need
|
||||||
|
// for subclasses or external hooks to mess with it directly
|
||||||
|
#dragDrop = this.#createDragDropHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of DragDrop instances.
|
||||||
|
* @type {DragDrop[]}
|
||||||
|
*/
|
||||||
|
get dragDrop() {
|
||||||
|
return this.#dragDrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application.
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this)
|
||||||
|
};
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this)
|
||||||
|
};
|
||||||
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,448 @@
|
|||||||
|
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||||
|
import { systemPath } from "../constants.mjs";
|
||||||
|
import { CharacterData } from "../data/character-data.mjs";
|
||||||
|
|
||||||
|
const { api, sheets } = foundry.applications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the basic ItemSheet with some very simple modifications.
|
||||||
|
*/
|
||||||
|
export class M6SpezialisierungSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
|
||||||
|
/** @inheritdoc */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
position: {
|
||||||
|
width: 600
|
||||||
|
},
|
||||||
|
classes: ["M6", "spezialisierung", "standard-form"],
|
||||||
|
actions: {
|
||||||
|
viewDoc: this.#viewEffect,
|
||||||
|
createDoc: this.#createEffect,
|
||||||
|
deleteDoc: this.#deleteEffect,
|
||||||
|
toggleEffect: this.#toggleEffect
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true
|
||||||
|
},
|
||||||
|
// Custom property that's merged into `this.options`
|
||||||
|
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static PARTS = {
|
||||||
|
body: {
|
||||||
|
template: systemPath("templates/spezialisierung/spezialisierung.hbs")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
_initializeApplicationOptions(options) {
|
||||||
|
const initialized = super._initializeApplicationOptions(options);
|
||||||
|
|
||||||
|
initialized.classes.push(initialized.document.type);
|
||||||
|
|
||||||
|
return initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _prepareContext(options) {
|
||||||
|
const context = await super._prepareContext(options);
|
||||||
|
|
||||||
|
Object.assign(context, {
|
||||||
|
owner: this.document.isOwner,
|
||||||
|
limited: this.document.limited,
|
||||||
|
item: this.item,
|
||||||
|
actor: this.actor,
|
||||||
|
system: this.item.system,
|
||||||
|
flags: this.item.flags,
|
||||||
|
itemFields: this.item.schema.fields,
|
||||||
|
config: CONFIG
|
||||||
|
});
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
// TODO: Come up with clever way to automatically handle enriching HTML fields
|
||||||
|
context.skills = await this._getSkills();
|
||||||
|
console.warn(context);
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the system fields for the form-fields generic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
async _getSkills() {
|
||||||
|
const doc = this.item;
|
||||||
|
const actorData = this.actor;
|
||||||
|
return actorData?.system.skills;
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getFields() {
|
||||||
|
const doc = this.item;
|
||||||
|
const source = doc._source;
|
||||||
|
const systemFields = CONFIG.Item.dataModels[doc.type]?.schema.fields;
|
||||||
|
const fieldSets = [];
|
||||||
|
// TODO: Find a clever way to handle enrichment
|
||||||
|
for (const field of Object.values(systemFields ?? {})) {
|
||||||
|
const path = `system.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
const fieldset = { fieldset: true, legend: field.label, fields: [] };
|
||||||
|
await this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
fieldSets.push(fieldset);
|
||||||
|
} else {
|
||||||
|
fieldSets.push({ outer: { field, value: foundry.utils.getProperty(source, path) } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively add system model fields to the fieldset.
|
||||||
|
*/
|
||||||
|
async #addSystemFields(fieldset, schema, source, _path = "system") {
|
||||||
|
for (const field of Object.values(schema)) {
|
||||||
|
const path = `${_path}.${field.name}`;
|
||||||
|
if (field instanceof foundry.data.fields.SchemaField) {
|
||||||
|
this.#addSystemFields(fieldset, field.fields, source, path);
|
||||||
|
} else if (field.constructor.hasFormSupport) {
|
||||||
|
fieldset.fields.push({ field, value: foundry.utils.getProperty(source, path) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions performed after any render of the Application.
|
||||||
|
* Post-render steps are not awaited by the render process.
|
||||||
|
* @param {ApplicationRenderContext} context Prepared context data.
|
||||||
|
* @param {RenderOptions} options Provided render options.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onRender(context, options) {
|
||||||
|
this.#dragDrop.forEach((d) => d.bind(this.element));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Event handlers */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders an embedded document's sheet.
|
||||||
|
*
|
||||||
|
* @this UTSItemSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #viewEffect(event, target) {
|
||||||
|
const effect = this._getEffect(target);
|
||||||
|
effect.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles item deletion.
|
||||||
|
*
|
||||||
|
* @this UTSItemSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static async #deleteEffect(event, target) {
|
||||||
|
const effect = this._getEffect(target);
|
||||||
|
effect.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle creating a new Owned Item or ActiveEffect for the actor using initial data defined in the HTML dataset.
|
||||||
|
*
|
||||||
|
* @this UTSItemSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #createEffect(event, target) {
|
||||||
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
|
const effectData = {
|
||||||
|
name: aeCls.defaultName({
|
||||||
|
type: target.dataset.type,
|
||||||
|
parent: this.item
|
||||||
|
})
|
||||||
|
};
|
||||||
|
for (const [dataKey, value] of Object.entries(target.dataset)) {
|
||||||
|
if (["action", "documentClass"].includes(dataKey)) continue;
|
||||||
|
foundry.utils.setProperty(effectData, dataKey, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
aeCls.create(effectData, { parent: this.item });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines effect parent to pass to helper.
|
||||||
|
*
|
||||||
|
* @this UTSItemSheet
|
||||||
|
* @param {PointerEvent} event The originating click event.
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action].
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #toggleEffect(event, target) {
|
||||||
|
const effect = this._getEffect(target);
|
||||||
|
effect.update({ disabled: !effect.disabled });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Helper functions */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the row with the data for the rendered embedded document.
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} target The element with the action.
|
||||||
|
* @returns {HTMLLIElement} The document's row.
|
||||||
|
*/
|
||||||
|
_getEffect(target) {
|
||||||
|
const li = target.closest(".effect");
|
||||||
|
return this.item.effects.get(li?.dataset?.effectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* Drag and drop */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to begin a dragstart workflow for a given drag selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for dragging.
|
||||||
|
* @returns {boolean} Can the current user drag this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragStart(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector.
|
||||||
|
* @param {string} selector The candidate HTML selector for the drop target.
|
||||||
|
* @returns {boolean} Can the current user drop on this selector?
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_canDragDrop(selector) {
|
||||||
|
return this.isEditable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const li = event.currentTarget;
|
||||||
|
if ("link" in event.target.dataset) return;
|
||||||
|
|
||||||
|
let dragData = null;
|
||||||
|
|
||||||
|
if (li.dataset.effectId) {
|
||||||
|
const effect = this.item.effects.get(li.dataset.effectId);
|
||||||
|
dragData = effect.toDragData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dragData) return;
|
||||||
|
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) {}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
|
const item = this.item;
|
||||||
|
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||||
|
if (allowed === false) return;
|
||||||
|
|
||||||
|
// Handle different data types
|
||||||
|
switch (data.type) {
|
||||||
|
case "ActiveEffect":
|
||||||
|
return this._onDropActiveEffect(event, data);
|
||||||
|
case "Actor":
|
||||||
|
return this._onDropActor(event, data);
|
||||||
|
case "Item":
|
||||||
|
return this._onDropItem(event, data);
|
||||||
|
case "Folder":
|
||||||
|
return this._onDropFolder(event, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the dropping of ActiveEffect data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<ActiveEffect|boolean>} The created ActiveEffect object or false if it couldn't be created.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActiveEffect(event, data) {
|
||||||
|
const aeCls = getDocumentClass("ActiveEffect");
|
||||||
|
const effect = await aeCls.fromDropData(data);
|
||||||
|
if (!this.item.isOwner || !effect) return false;
|
||||||
|
|
||||||
|
if (this.item.uuid === effect.parent?.uuid) return this._onEffectSort(event, effect);
|
||||||
|
aeCls.create(effect, { parent: this.item });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts an Active Effect based on its surrounding attributes.
|
||||||
|
*
|
||||||
|
* @param {DragEvent} event
|
||||||
|
* @param {ActiveEffect} effect
|
||||||
|
*/
|
||||||
|
_onEffectSort(event, effect) {
|
||||||
|
const effects = this.item.effects;
|
||||||
|
const dropTarget = event.target.closest("[data-effect-id]");
|
||||||
|
if (!dropTarget) return;
|
||||||
|
const target = effects.get(dropTarget.dataset.effectId);
|
||||||
|
|
||||||
|
// Don't sort on yourself
|
||||||
|
if (effect.id === target.id) return;
|
||||||
|
|
||||||
|
// Identify sibling items based on adjacent HTML elements
|
||||||
|
const siblings = [];
|
||||||
|
for (let el of dropTarget.parentElement.children) {
|
||||||
|
const siblingId = el.dataset.effectId;
|
||||||
|
if (siblingId && siblingId !== effect.id) siblings.push(effects.get(el.dataset.effectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort
|
||||||
|
const sortUpdates = foundry.utils.performIntegerSort(effect, {
|
||||||
|
target,
|
||||||
|
siblings
|
||||||
|
});
|
||||||
|
const updateData = sortUpdates.map((u) => {
|
||||||
|
const update = u.update;
|
||||||
|
update._id = u.target._id;
|
||||||
|
return update;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Perform the update
|
||||||
|
this.item.updateEmbeddedDocuments("ActiveEffect", updateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an Actor data onto another Actor sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<object|boolean>} A data object which describes the result of the drop, or false if the drop was
|
||||||
|
* not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropActor(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]|boolean>} The created or updated Item instances, or false if the drop was not permitted.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropItem(event, data) {
|
||||||
|
if (!this.item.isOwner) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dropping of a Folder on an Actor Sheet.
|
||||||
|
* The core sheet currently supports dropping a Folder of Items to create all items as owned items.
|
||||||
|
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||||
|
* @param {object} data The data transfer extracted from the event.
|
||||||
|
* @returns {Promise<Item[]>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDropFolder(event, data) {
|
||||||
|
if (!this.item.isOwner) return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
/* The following pieces set up drag */
|
||||||
|
/* handling and are unlikely to need modification */
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
// This is marked as private because there's no real need
|
||||||
|
// for subclasses or external hooks to mess with it directly
|
||||||
|
#dragDrop = this.#createDragDropHandlers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of DragDrop instances.
|
||||||
|
* @type {DragDrop[]}
|
||||||
|
*/
|
||||||
|
get dragDrop() {
|
||||||
|
return this.#dragDrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create drag-and-drop workflow handlers for this Application.
|
||||||
|
* @returns {DragDrop[]} An array of DragDrop handlers.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#createDragDropHandlers() {
|
||||||
|
return this.options.dragDrop.map((d) => {
|
||||||
|
d.permissions = {
|
||||||
|
dragstart: this._canDragStart.bind(this),
|
||||||
|
drop: this._canDragDrop.bind(this)
|
||||||
|
};
|
||||||
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
|
dragover: this._onDragOver.bind(this),
|
||||||
|
drop: this._onDrop.bind(this)
|
||||||
|
};
|
||||||
|
return new foundry.applications.ux.DragDrop(d);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-19
@@ -12,33 +12,36 @@
|
|||||||
--M6-text-brown: #be7742;
|
--M6-text-brown: #be7742;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset {
|
.M6 {
|
||||||
border-radius: 0;
|
fieldset {
|
||||||
border: none;
|
border-radius: 0;
|
||||||
background-color: var(--M6-background-grey);
|
border: none;
|
||||||
|
background-color: var(--M6-background-grey);
|
||||||
|
|
||||||
&.highlight {
|
&.highlight {
|
||||||
background-color: var(--M6-background-brown);
|
background-color: var(--M6-background-brown);
|
||||||
|
}
|
||||||
|
legend {
|
||||||
|
color: var(--M6-text-brown);
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
legend {
|
h5 {
|
||||||
color: var(--M6-text-brown);
|
color: var(--M6-text-grey);
|
||||||
font-size: 24px;
|
}
|
||||||
|
i {
|
||||||
|
font-size: 18px;
|
||||||
|
text-shadow: 0 0 10px var(--M6-background-white);
|
||||||
|
}
|
||||||
|
i:hover {
|
||||||
|
text-shadow: 0 0 10px var(--M6-background-brown);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
h5 {
|
|
||||||
color: var(--M6-text-grey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.application {
|
.application {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
i {
|
|
||||||
font-size: 18px;
|
|
||||||
text-shadow: 0 0 10px var(--M6-background-white);
|
|
||||||
}
|
|
||||||
i:hover {
|
|
||||||
text-shadow: 0 0 10px var(--M6-background-brown);
|
|
||||||
}
|
|
||||||
.application.sheet.M6 {
|
.application.sheet.M6 {
|
||||||
background-color: var(--M6-background-white);
|
background-color: var(--M6-background-white);
|
||||||
color: var(--M6-text-grey);
|
color: var(--M6-text-grey);
|
||||||
|
|||||||
@@ -2,6 +2,29 @@
|
|||||||
background-color: var(--M6-background-white);
|
background-color: var(--M6-background-white);
|
||||||
color: var(--M6-text-grey);
|
color: var(--M6-text-grey);
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
background-color: var(--M6-background-grey);
|
||||||
|
|
||||||
|
&.highlight {
|
||||||
|
background-color: var(--M6-background-brown);
|
||||||
|
}
|
||||||
|
legend {
|
||||||
|
color: var(--M6-text-brown);
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h5 {
|
||||||
|
color: var(--M6-text-grey);
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
font-size: 18px;
|
||||||
|
text-shadow: 0 0 10px var(--M6-background-white);
|
||||||
|
}
|
||||||
|
i:hover {
|
||||||
|
text-shadow: 0 0 10px var(--M6-background-brown);
|
||||||
|
}
|
||||||
input {
|
input {
|
||||||
background-color: var(--M6-background-white);
|
background-color: var(--M6-background-white);
|
||||||
color: black;
|
color: black;
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import { CharacterData } from "./data/character-data.mjs";
|
|||||||
import { ItemData } from "./data/item-data.mjs";
|
import { ItemData } from "./data/item-data.mjs";
|
||||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
||||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||||
|
import { M6SpezialisierungSheet } from "./sheets/spezialisierung-sheet.mjs";
|
||||||
import { loadHelpers } from "./helpers/handlebar-helpers.mjs";
|
import { loadHelpers } from "./helpers/handlebar-helpers.mjs";
|
||||||
import "./styles/M6.scss";
|
import "./styles/M6.scss";
|
||||||
|
import { SpezialisierungData } from "./data/spezialisierung-data.mjs";
|
||||||
|
|
||||||
Hooks.once("init", () => {
|
Hooks.once("init", () => {
|
||||||
CONFIG.Actor.dataModels.character = CharacterData;
|
CONFIG.Actor.dataModels.character = CharacterData;
|
||||||
@@ -18,11 +20,20 @@ Hooks.once("init", () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
CONFIG.Item.dataModels.item = ItemData;
|
CONFIG.Item.dataModels.item = ItemData;
|
||||||
|
CONFIG.Item.dataModels.spezialisierung = SpezialisierungData;
|
||||||
|
|
||||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
||||||
types: ["character"],
|
types: ["character"],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
});
|
});
|
||||||
|
foundry.applications.apps.DocumentSheetConfig.registerSheet(
|
||||||
|
Item,
|
||||||
|
"midgard6-lvd",
|
||||||
|
M6SpezialisierungSheet,
|
||||||
|
{
|
||||||
|
types: ["spezialisierung"]
|
||||||
|
}
|
||||||
|
);
|
||||||
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
|
||||||
|
|||||||
@@ -2,46 +2,51 @@
|
|||||||
<section class="tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="items">
|
<section class="tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="items">
|
||||||
<ul class="itemTypes">
|
<ul class="itemTypes">
|
||||||
{{#each itemTypes as |group type|}}
|
{{#each itemTypes as |group type|}}
|
||||||
<li class="itemHeader flexrow">
|
<li class="itemHeader flexrow">
|
||||||
<div class="type-label">
|
<div class="type-label">
|
||||||
{{group.label}}
|
{{group.label}}
|
||||||
</div>
|
</div>
|
||||||
<div class="document-controls">
|
|
||||||
{{#if @root.editable}}
|
|
||||||
<a class="item-control item-create"
|
|
||||||
title="{{localize 'DOCUMENT.Create' type=group.label}}"
|
|
||||||
data-action="createDoc"
|
|
||||||
data-document-class="Item"
|
|
||||||
data-type="{{type}}"
|
|
||||||
>
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
{{localize "DOCUMENT.New" type=group.label}}
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<ul class="items">
|
|
||||||
{{#each group.items as |item|}}
|
|
||||||
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-document-class="Item">
|
|
||||||
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24">
|
|
||||||
<div class="item-name">{{item.name}}</div>
|
|
||||||
<div class="document-controls">
|
<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>
|
|
||||||
{{#if @root.editable}}
|
{{#if @root.editable}}
|
||||||
<a class="item-control item-delete"
|
<a
|
||||||
title="{{localize 'DOCUMENT.Delete' type=item.name}}"
|
class="item-control item-create"
|
||||||
data-action="deleteDoc">
|
title="{{localize 'DOCUMENT.Create' type=group.label}}"
|
||||||
<i class="fas fa-trash"></i>
|
data-action="createDoc"
|
||||||
</a>
|
data-document-class="Item"
|
||||||
|
data-type="{{type}}"
|
||||||
|
>
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DOCUMENT.New" type=group.label}}
|
||||||
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
<ul class="items">
|
||||||
</ul>
|
{{#each group.items as |item|}}
|
||||||
|
<li class="item flexrow draggable" data-item-id="{{item._id}}" data-document-class="Item">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" width="24" height="24" />
|
||||||
|
<div class="item-name">{{item.name}}</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>
|
||||||
|
{{#if @root.editable}}
|
||||||
|
<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>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<a
|
<a
|
||||||
class="flexrow"
|
class="flexrow"
|
||||||
data-action="rollSkill"
|
data-action="rollSkill"
|
||||||
data-name="{{field.fieldPath}}"
|
data-name="{{localize localizationName}}"
|
||||||
data-value="{{value}}"
|
data-value="{{value}}"
|
||||||
>
|
>
|
||||||
<p class="flex1" style="margin-left: 4px; max-width:7rem">{{localize
|
<p class="flex1" style="margin-left: 4px; max-width:7rem">{{localize
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<section>
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "Midgard6.Sheets.spezialisierung"}}</legend>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">
|
||||||
|
{{formInput itemFields.name value=item.name}}
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
list="skills"
|
||||||
|
name="system.linkedSkill"
|
||||||
|
value="{{system.linkedSkill}}"
|
||||||
|
/>
|
||||||
|
<datalist id="skills">
|
||||||
|
{{#each skills}}
|
||||||
|
{{#each this}}
|
||||||
|
<option value="{{@key}}">{{@key}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<input type="number" list="levels" name="system.level" value="{{system.level}}" />
|
||||||
|
<datalist id="levels">
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
import type { CharacterData } from "../data/character-data";
|
import { CharacterData } from "../data/character-data";
|
||||||
import type { ItemData } from "../data/item-data";
|
import { ItemData } from "../data/item-data";
|
||||||
|
import { SpezialisierungData } from "../data/spezialisierung-data";
|
||||||
|
|
||||||
declare module "fvtt-types/configuration" {
|
declare module "fvtt-types/configuration" {
|
||||||
interface DataModelConfig {
|
interface DataModelConfig {
|
||||||
Actor: { character: typeof CharacterData };
|
Actor: { character: typeof CharacterData };
|
||||||
Item: { item: typeof ItemData };
|
Item: { item: typeof ItemData };
|
||||||
|
Spezialisierung: { spezialisierung: typeof SpezialisierungData };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -33,7 +33,8 @@
|
|||||||
"character": {}
|
"character": {}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"item": {}
|
"item": {},
|
||||||
|
"spezialisierung": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
"manifest": "",
|
"manifest": "",
|
||||||
"download": "",
|
"download": "",
|
||||||
"grid": {
|
"grid": {
|
||||||
"distance": 5,
|
"distance": 1,
|
||||||
"units": "m"
|
"units": "m"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
|
|||||||
Reference in new issue
Block a user