Functoning weapons
This commit is contained in:
1 parent
747bd3eb8e
commit
2291c5d1e6
24 files changed
+1091
-167
No files matched your search
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
||||
<svg fill="#000000" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64px" height="64px" viewBox="0 0 260 260" enable-background="new 0 0 260 260" xml:space="preserve">
|
||||
␍<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
||||
␍<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
␍<g id="SVGRepo_iconCarrier"> <path d="M258,2l-16,48L97.06,181.76l-7.23-11.14l-11.68-7.58L210,18L258,2z M101.029,238.26l11.314-11.314l-31.176-48.02 l-48.02-31.176l-11.314,11.314l31.386,31.386l-34.26,37.693c-4.464-0.586-9.138,0.82-12.568,4.249 c-5.858,5.858-5.858,15.355,0,21.213c5.858,5.858,15.355,5.858,21.213,0c3.428-3.428,4.834-8.1,4.25-12.562l37.695-34.262 L101.029,238.26z"/> </g>
|
||||
␍</svg>
|
||||
|
After Width: | Height: | Size: 937 B |
+20
-2
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"Midgard6": {
|
||||
"name": "Name",
|
||||
"Angriff": "Angriff",
|
||||
"Schaden": "Schaden",
|
||||
"Biography": {
|
||||
"spezies": "Spezies",
|
||||
"kultur": "Kultur",
|
||||
@@ -75,7 +77,22 @@
|
||||
},
|
||||
"Item": {
|
||||
"Quantity": "Anzahl",
|
||||
"Description": "Beschreibung"
|
||||
"Description": "Beschreibung",
|
||||
"Eigenschaften": "Eigenschaften",
|
||||
"type": {
|
||||
"item": {
|
||||
"singular": "Gegenstand",
|
||||
"plural": "Gegenstände"
|
||||
},
|
||||
"weapon": {
|
||||
"singular": "Waffe",
|
||||
"plural": "Waffen"
|
||||
},
|
||||
"armor": {
|
||||
"singular": "Rüstung",
|
||||
"plural": "Rüstungen"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"TYPES": {
|
||||
@@ -84,7 +101,8 @@
|
||||
},
|
||||
"Item": {
|
||||
"item": "Gegenstand",
|
||||
"spezialisierung": "Spezialisierung"
|
||||
"weapon": "Waffe",
|
||||
"armor": "Rüstung"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,3 +6,6 @@ export const systemID = "midgard6-lvd";
|
||||
* @returns {string} The path relative to the Foundry data folder.
|
||||
*/
|
||||
export const systemPath = (path) => `systems/${systemID}/src/${path}`;
|
||||
export const assetPath = (path) => `systems/${systemID}/assets/${path}`;
|
||||
|
||||
export const swordSVG = "systems/midgard6-lvd/assets/sword.svg";
|
||||
@@ -0,0 +1,22 @@
|
||||
import { ItemData } from "./item-data.mjs";
|
||||
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const baseData = ItemData.defineSchema();
|
||||
const extendData = {
|
||||
rüstung: new fields.NumberField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
integer: true,
|
||||
initial: 1,
|
||||
min: 0
|
||||
}),
|
||||
equipped: new fields.BooleanField({ inital: false })
|
||||
};
|
||||
|
||||
return Object.assign(baseData, extendData);
|
||||
}
|
||||
|
||||
export class ArmorData extends ItemData {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ItemData } from "./item-data.mjs";
|
||||
|
||||
function defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const baseData = ItemData.defineSchema();
|
||||
const extendData = {
|
||||
schaden: new fields.StringField({ initial: "1d6" }),
|
||||
equipped: new fields.BooleanField({ inital: false }),
|
||||
fertigkeit: new fields.StringField({ initial: "system.skills.kampf.nahkampf" }),
|
||||
spezialisierung: new fields.StringField({ initial: "" }),
|
||||
customRoll: new fields.StringField({ initial: "" })
|
||||
};
|
||||
|
||||
return Object.assign(baseData, extendData);
|
||||
}
|
||||
|
||||
export class WeaponData extends ItemData {
|
||||
static defineSchema = defineSchema;
|
||||
}
|
||||
@@ -2,4 +2,17 @@ export const loadHelpers = async function () {
|
||||
Handlebars.registerHelper("ifeq", function (arg1, arg2, options) {
|
||||
return arg1 == arg2 ? options.fn(this) : options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("fetchPath", function (actor, arg1, arg2 = "") {
|
||||
let arg = arg1;
|
||||
if (typeof arg2 === "string") {
|
||||
arg = arg + "" + arg2;
|
||||
}
|
||||
console.warn(actor, arg);
|
||||
return foundry.utils.getProperty(actor, arg);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("isdefined", function (value) {
|
||||
return value !== undefined;
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { M6ItemSheet } from "./item-sheet.mjs";
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications.
|
||||
*/
|
||||
export class M6ArmorSheet extends M6ItemSheet {
|
||||
static get DEFAULT_OPTIONS() {
|
||||
return {
|
||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||
actions: {
|
||||
...super.DEFAULT_OPTIONS.actions,
|
||||
cycleEquip: this.#cycleEquip // Fügt NUR für dieses Sheet die neue Action hinzu
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static #cycleEquip() {
|
||||
this.item.update({
|
||||
system: {
|
||||
equipped: !this.item.system.equipped
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+405
-13
@@ -24,12 +24,15 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
deleteDoc: this.#deleteDoc,
|
||||
toggleEffect: this.#toggleEffect,
|
||||
rollSkill: this.#rollSkill,
|
||||
rollWeapon: this.#rollWeapon,
|
||||
cycleEquip: this.#cycleEquip,
|
||||
addSpezialisierung: addSpezialisierung,
|
||||
editSepzialisierung: editSepzialisierung
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true
|
||||
}
|
||||
},
|
||||
dragDrop: [{ dragSelector: ".draggable", dropSelector: null }]
|
||||
};
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
@@ -39,12 +42,16 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
tabs: [
|
||||
{
|
||||
id: "properties",
|
||||
icon: "fa-feather-pointed"
|
||||
icon: "fa-shield-halved"
|
||||
},
|
||||
{
|
||||
id: "items",
|
||||
icon: "fa-suitcase"
|
||||
},
|
||||
{
|
||||
id: "biographie",
|
||||
icon: "fa-feather"
|
||||
},
|
||||
{
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
@@ -73,6 +80,10 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
template: systemPath("templates/actor/items.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
// biographie: {
|
||||
// template: systemPath("templates/items/description.hbs"),
|
||||
// scrollable: [""]
|
||||
// },
|
||||
effects: {
|
||||
template: systemPath("templates/shared/effects.hbs"),
|
||||
scrollable: [""]
|
||||
@@ -125,10 +136,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
case "properties":
|
||||
context.skills = await this._getSkills();
|
||||
context.resistenzen = await this._getResistenzen();
|
||||
context.equippedWeapons = await this._prepWeapons();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "items":
|
||||
context.itemTypes = this._getItems();
|
||||
context.itemTypes = await this._getItems();
|
||||
context.gewicht = this._clacWeight();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
@@ -245,6 +257,35 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
async _prepWeapons() {
|
||||
const weaponItems = this.actor.items.filter((x) => x.type === "weapon" && x.system.equipped);
|
||||
const weapons = [];
|
||||
weaponItems.forEach((weapon) => {
|
||||
const skill = foundry.utils.getProperty(this.actor, weapon.system.fertigkeit);
|
||||
const w = {
|
||||
name: weapon.name,
|
||||
skillValue: skill.value,
|
||||
bonusValue:
|
||||
skill.bonuses.find((x) => x.name === weapon.system.spezialisierung)?.level + 1 || "",
|
||||
img: weapon.img,
|
||||
skillPath: weapon.system.fertigkeit,
|
||||
path: weapon.system.fertigkeit,
|
||||
id: weapon.id
|
||||
};
|
||||
weapons.push(w);
|
||||
});
|
||||
return weapons;
|
||||
}
|
||||
|
||||
static async #cycleEquip(event, target) {
|
||||
const item = this.actor.items.get(target.dataset.itemId);
|
||||
item.update({
|
||||
system: {
|
||||
equipped: !item.system.equipped
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
@@ -279,17 +320,18 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
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;
|
||||
}
|
||||
|
||||
_clacWeight() {
|
||||
const items = this._getItems();
|
||||
let gewicht = items.item.items.reduce(
|
||||
(accumulator, item) => accumulator + item.system.gewicht,
|
||||
0
|
||||
);
|
||||
const items = this.actor.items.filter((x) => x.system.gewicht);
|
||||
let gewicht = items.reduce((accumulator, item) => accumulator + item.system.gewicht, 0);
|
||||
|
||||
let traglast = Math.max(this.actor.system.skills.körper.athletik.value, 10);
|
||||
return {
|
||||
@@ -394,8 +436,8 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
skill,
|
||||
actor
|
||||
});
|
||||
console.warn(dialogResult);
|
||||
if (dialogResult.noRoll) {
|
||||
console.log("Dialog Result", dialogResult);
|
||||
if (!dialogResult) {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
@@ -441,11 +483,83 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
roll.toMessage();
|
||||
}
|
||||
|
||||
static async #rollWeapon(event, target) {
|
||||
const dataset = target.dataset;
|
||||
const weapon = this.actor.items.get(dataset.itemId);
|
||||
const skill = foundry.utils.getProperty(this.actor, weapon.system.fertigkeit);
|
||||
const actor = this.actor;
|
||||
const dialogResult = await this.rollDialog({
|
||||
name: weapon.name,
|
||||
skill,
|
||||
damageRoll: weapon.system.schaden,
|
||||
preSelectedSpez: weapon.system.spezialisierung,
|
||||
actor
|
||||
});
|
||||
console.log("Dialog Result", dialogResult);
|
||||
if (!dialogResult) {
|
||||
return;
|
||||
}
|
||||
// Construct the Roll instance
|
||||
const skillValue = skill.value;
|
||||
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.Angriff");
|
||||
let attackRoll;
|
||||
let damageRoll;
|
||||
|
||||
if (dialogResult.spezLevel) {
|
||||
rollTerm += " + @spezBonus";
|
||||
rollFlavor += " (" + dialogResult.spezName + ")";
|
||||
}
|
||||
rollFlavor += ": " + weapon.name;
|
||||
|
||||
if (dialogResult.customRoll) {
|
||||
attackRoll = await new Roll(dialogResult.customRoll).evaluate();
|
||||
} else {
|
||||
attackRoll = await new Roll(
|
||||
rollTerm,
|
||||
{ die: die, skill: skillValue, spezBonus: dialogResult.spezLevel + 1 },
|
||||
{ flavor: rollFlavor }
|
||||
).evaluate();
|
||||
}
|
||||
|
||||
damageRoll = await new Roll(
|
||||
"@die",
|
||||
{ die: weapon.system.schaden },
|
||||
{ flavor: game.i18n.localize("Midgard6.Schaden") }
|
||||
).evaluate();
|
||||
|
||||
// The parsed terms of the roll formula
|
||||
|
||||
const chatData = {
|
||||
user: game.user.id,
|
||||
rolls: [attackRoll, damageRoll] // Übergibt beide Rolls an die Nachricht
|
||||
};
|
||||
|
||||
console.log("Roll:", chatData.rolls);
|
||||
|
||||
await ChatMessage.create(chatData);
|
||||
}
|
||||
|
||||
async rollDialog(rollDialogRequest) {
|
||||
// Assamble dialog depending on roll type
|
||||
let label = rollDialogRequest.name;
|
||||
let skillValue = rollDialogRequest.skill.value || rollDialogRequest.skill;
|
||||
let bonuses = rollDialogRequest.skill.bonuses || [];
|
||||
let damageRoll = rollDialogRequest.damageRoll || "";
|
||||
let preSelectedSpez = rollDialogRequest.preSelectedSpez || "";
|
||||
let vorteil = 0;
|
||||
let customRoll = "";
|
||||
let spezLevel;
|
||||
@@ -453,10 +567,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
// 1. Define the path to .hbs template
|
||||
const templatePath = systemPath("templates/dialog/roll-dialog.hbs");
|
||||
const templateData = {
|
||||
classes: ["M6", "dialog"],
|
||||
skillValue,
|
||||
bonuses,
|
||||
vorteil,
|
||||
damageRoll,
|
||||
preSelectedSpez,
|
||||
customRoll
|
||||
};
|
||||
// 2. Render the Handlebars template into an HTML string
|
||||
@@ -471,6 +586,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
position: {
|
||||
width: 600
|
||||
},
|
||||
classes: ["M6", "dialog"],
|
||||
content,
|
||||
actions: {},
|
||||
render: (_event, dialog) => {
|
||||
@@ -499,9 +615,13 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
|
||||
document.querySelectorAll('input[name="spezialisierung-segment"]').forEach((radio) => {
|
||||
radio.addEventListener("change", (e) => {
|
||||
console.log(e.target.dataset.name);
|
||||
spezLevel = parseInt(e.target.value);
|
||||
spezName = e.target.dataset.name;
|
||||
});
|
||||
if (radio.dataset.name === preSelectedSpez) {
|
||||
radio.click();
|
||||
}
|
||||
});
|
||||
},
|
||||
buttons: [
|
||||
@@ -509,7 +629,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
action: "abort",
|
||||
label: "Midgard6.Dialog.abbrechen",
|
||||
callback: (event, button, dialog) => {
|
||||
return { noRoll: true };
|
||||
return null;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -519,6 +639,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
callback: (event, button, dialog) => {
|
||||
const rollData = {
|
||||
customRoll: button.form.elements.customRoll.value,
|
||||
customDamageRoll: button.form.elements.customDamageRoll?.value || "",
|
||||
vorteil,
|
||||
spezLevel,
|
||||
spezName
|
||||
@@ -577,7 +698,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Disables inpM6 subject to active effects.
|
||||
* Disables inputs subject to active effects.
|
||||
*/
|
||||
#disableOverrides() {
|
||||
const flatOverrides = foundry.utils.flattenObject(this.actor.overrides);
|
||||
@@ -586,4 +707,275 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
// Prüfen, ob das Item von diesem Actor stammt und Shift NICHT gedrückt ist
|
||||
// Sortieren, nicht kopieren/verschieben
|
||||
return this._onSortItem(event, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
// item = items.get(item.itemId);
|
||||
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ const { api, sheets } = foundry.applications;
|
||||
*/
|
||||
export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet) {
|
||||
/** @inheritdoc */
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
window: {
|
||||
resizable: true
|
||||
@@ -35,7 +36,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "description",
|
||||
id: "beschreibung",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
@@ -43,8 +44,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "description",
|
||||
labelPrefix: "M6.Sheets.Tabs"
|
||||
initial: "beschreibung",
|
||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,7 +59,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
},
|
||||
description: {
|
||||
beschreibung: {
|
||||
template: systemPath("templates/item/description.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
@@ -109,7 +110,7 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
context.effects = prepareActiveEffectCategories(this.item.effects);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "description":
|
||||
case "beschreibung":
|
||||
context.fields = await this._getFields();
|
||||
context.enrichedBeschreibung =
|
||||
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
@@ -125,6 +126,9 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
);
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
default:
|
||||
await this._addSpecifics(context);
|
||||
context.tab = context.tabs[partId];
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -338,8 +342,10 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = this.item;
|
||||
console.warn(data.type);
|
||||
|
||||
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||
if (allowed === false) return;
|
||||
// if (allowed === false) return;
|
||||
|
||||
// Handle different data types
|
||||
switch (data.type) {
|
||||
@@ -436,6 +442,55 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
*/
|
||||
async _onDropItem(event, data) {
|
||||
if (!this.item.isOwner) return false;
|
||||
|
||||
// Prüfen, ob das Item von diesem Actor stammt und Shift NICHT gedrückt ist
|
||||
const isSameActor = this.actor.uuid === item.parent?.uuid;
|
||||
const isShift = event.shiftKey;
|
||||
console.warn(isSameActor);
|
||||
|
||||
if (isSameActor) {
|
||||
console.warn("here");
|
||||
// Sortieren, nicht kopieren/verschieben
|
||||
return this._onSortItem(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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]");
|
||||
if (!dropTarget) return;
|
||||
const target = items.get(dropTarget.dataset.itemId);
|
||||
|
||||
// Don't sort on yourself
|
||||
if (item.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 !== item.id) siblings.push(items.get(el.dataset.itemId));
|
||||
}
|
||||
|
||||
// Perform the sort
|
||||
const sortUpdates = foundry.utils.SortingHelpers.performIntegerSort(item, {
|
||||
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);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
@@ -490,4 +545,8 @@ export class M6ItemSheet extends api.HandlebarsApplicationMixin(sheets.ItemSheet
|
||||
return new foundry.applications.ux.DragDrop(d);
|
||||
});
|
||||
}
|
||||
|
||||
async _addSpecifics(context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { prepareActiveEffectCategories } from "../helpers/utils.mjs";
|
||||
import { systemPath } from "../constants.mjs";
|
||||
import { M6ItemSheet } from "./item-sheet.mjs";
|
||||
const { api, sheets } = foundry.applications;
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications.
|
||||
*/
|
||||
export class M6WeaponSheet extends M6ItemSheet {
|
||||
static get DEFAULT_OPTIONS() {
|
||||
return {
|
||||
...super.DEFAULT_OPTIONS, // Kopiert alle bestehenden Actions aus M6ItemSheet
|
||||
actions: {
|
||||
...super.DEFAULT_OPTIONS.actions,
|
||||
cycleEquip: this.#cycleEquip // Fügt NUR für dieses Sheet die neue Action hinzu
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [
|
||||
{
|
||||
id: "eigenschaften",
|
||||
icon: "fa-shield-halved"
|
||||
},
|
||||
{
|
||||
id: "beschreibung",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
}
|
||||
],
|
||||
initial: "eigenschaften",
|
||||
labelPrefix: "Midgard6.Sheets.Tabs"
|
||||
}
|
||||
};
|
||||
|
||||
/** @inheritdoc */
|
||||
static PARTS = {
|
||||
header: {
|
||||
template: systemPath("templates/item/header.hbs")
|
||||
},
|
||||
tabs: {
|
||||
template: systemPath("templates/actor/tabs.hbs")
|
||||
},
|
||||
eigenschaften: {
|
||||
template: systemPath("templates/item/eigenschaften.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
beschreibung: {
|
||||
template: systemPath("templates/item/description.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
effects: {
|
||||
template: systemPath("templates/shared/effects.hbs"),
|
||||
scrollable: [""]
|
||||
}
|
||||
};
|
||||
|
||||
_addSpecifics(context) {
|
||||
context.bonuses = foundry.utils.getProperty(this.actor, this.item.system.fertigkeit).bonuses;
|
||||
}
|
||||
|
||||
static #cycleEquip() {
|
||||
this.item.update({
|
||||
system: {
|
||||
equipped: !this.item.system.equipped
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+17
-1
@@ -4,6 +4,7 @@
|
||||
@import url("./resistenzen.scss");
|
||||
@import url("./dialog.scss");
|
||||
@import url("./items-page.scss");
|
||||
@import url("./icons.scss");
|
||||
|
||||
:root {
|
||||
--M6-background-grey: #d3d7d7;
|
||||
@@ -43,7 +44,7 @@
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.application.sheet.M6 {
|
||||
.M6 {
|
||||
background-color: var(--M6-background-white);
|
||||
color: var(--M6-text-grey);
|
||||
|
||||
@@ -51,6 +52,7 @@
|
||||
background-color: var(--M6-background-white);
|
||||
color: black;
|
||||
border-radius: 0;
|
||||
transition: none;
|
||||
&.skill {
|
||||
max-width: 2rem;
|
||||
text-align: center;
|
||||
@@ -63,6 +65,9 @@
|
||||
margin: 0 0.5rem;
|
||||
}
|
||||
&.text {
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
&.right {
|
||||
text-align: end;
|
||||
}
|
||||
@@ -71,6 +76,17 @@
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
select {
|
||||
background-color: var(--M6-background-white);
|
||||
color: black;
|
||||
border-radius: 0;
|
||||
transition: none;
|
||||
margin-bottom: 4px;
|
||||
option:hover {
|
||||
background-color: var(--M6-background-brown);
|
||||
}
|
||||
}
|
||||
p {
|
||||
&.center {
|
||||
text-align: center;
|
||||
|
||||
+57
-56
@@ -1,4 +1,4 @@
|
||||
.application.dialog {
|
||||
.application.dialog.M6 {
|
||||
background-color: var(--M6-background-white);
|
||||
color: var(--M6-text-grey);
|
||||
|
||||
@@ -57,66 +57,67 @@
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
/* Container für die gesamte Reihe */
|
||||
.segmented-button-row {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Einzelnes Segment */
|
||||
.segmented-button {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
/* Container für die gesamte Reihe */
|
||||
.segmented-button-row {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
/* Versteckt den echten Radio-Button, behält aber die Tastatur-Navigation */
|
||||
.segmented-button input[type="radio"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
/* Einzelnes Segment */
|
||||
.segmented-button {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Inhalt des Segments (Layout & Abstände) */
|
||||
.segmented-button__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
color 0.2s;
|
||||
background-color: transparent;
|
||||
user-select: none;
|
||||
}
|
||||
/* Versteckt den echten Radio-Button, behält aber die Tastatur-Navigation */
|
||||
.segmented-button input[type="radio"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* --- ZUSTÄNDE --- */
|
||||
/* Inhalt des Segments (Layout & Abstände) */
|
||||
.segmented-button__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
color 0.2s;
|
||||
background-color: transparent;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Selektiert (Selected State) */
|
||||
.segmented-button input[type="radio"]:checked + .segmented-button__content {
|
||||
// background-color: #e8def8; /* M3 Secondary Container Color */
|
||||
/* --- ZUSTÄNDE --- */
|
||||
|
||||
/* Selektiert (Selected State) */
|
||||
.segmented-button input[type="radio"]:checked + .segmented-button__content {
|
||||
// background-color: #e8def8; /* M3 Secondary Container Color */
|
||||
text-shadow: 0 0 10px var(--M6-text-brown) !important;
|
||||
color: #1d192b; /* M3 On-Secondary Container Text */
|
||||
.icon {
|
||||
text-shadow: 0 0 10px var(--M6-text-brown) !important;
|
||||
color: #1d192b; /* M3 On-Secondary Container Text */
|
||||
.icon {
|
||||
text-shadow: 0 0 10px var(--M6-text-brown) !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hover-Effekt */
|
||||
.segmented-button:hover .segmented-button__content {
|
||||
background-color: rgba(73, 69, 79, 0.08);
|
||||
}
|
||||
.segmented-button input[type="radio"]:checked:hover + .segmented-button__content {
|
||||
background-color: rgba(232, 222, 248, 0.85);
|
||||
}
|
||||
|
||||
/* Tastatur-Fokus (Barrierefreiheit) */
|
||||
.segmented-button input[type="radio"]:focus-visible + .segmented-button__content {
|
||||
outline: 2px solid #6750a4;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hover-Effekt */
|
||||
.segmented-button:hover .segmented-button__content {
|
||||
background-color: rgba(73, 69, 79, 0.08);
|
||||
}
|
||||
.segmented-button input[type="radio"]:checked:hover + .segmented-button__content {
|
||||
background-color: rgba(232, 222, 248, 0.85);
|
||||
}
|
||||
|
||||
/* Tastatur-Fokus (Barrierefreiheit) */
|
||||
.segmented-button input[type="radio"]:focus-visible + .segmented-button__content {
|
||||
outline: 2px solid #6750a4;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ html {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
.application.sheet.M6 {
|
||||
.M6 {
|
||||
.container {
|
||||
width: 100%;
|
||||
/* padding-right: 15px;
|
||||
|
||||
@@ -45,4 +45,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon-checked {
|
||||
background-color: var(--M6-text-brown);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
.sword {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
/* Das SVG wird als Maske geladen */
|
||||
mask: url("../assets/sword.svg") no-repeat center / contain;
|
||||
-webkit-mask: url("../assets/sword.svg") no-repeat center / contain;
|
||||
|
||||
/* Standardfarbe (wird durch die Maske in die Form des SVGs gepresst) */
|
||||
background-color: var(--M6-text-grey);
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
import { CharacterData } from "./data/character-data.mjs";
|
||||
import { WeaponData } from "./data/weapon-data.mjs";
|
||||
import { ItemData } from "./data/item-data.mjs";
|
||||
import { ArmorData } from "./data/armor-data.mjs";
|
||||
import { M6ActorSheet } from "./sheets/character-sheet.mjs";
|
||||
import { M6ItemSheet } from "./sheets/item-sheet.mjs";
|
||||
import { M6WeaponSheet } from "./sheets/weapon-sheet.mjs";
|
||||
import { M6ArmorSheet } from "./sheets/armor-sheet.mjs";
|
||||
import { loadHelpers } from "./helpers/handlebar-helpers.mjs";
|
||||
import "./styles/M6.scss";
|
||||
|
||||
@@ -18,6 +22,8 @@ Hooks.once("init", () => {
|
||||
}
|
||||
};
|
||||
CONFIG.Item.dataModels.item = ItemData;
|
||||
CONFIG.Item.dataModels.weapon = WeaponData;
|
||||
CONFIG.Item.dataModels.armor = ArmorData;
|
||||
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "midgard6-lvd", M6ActorSheet, {
|
||||
types: ["character"],
|
||||
@@ -27,6 +33,12 @@ Hooks.once("init", () => {
|
||||
types: ["item"],
|
||||
makeDefault: true
|
||||
});
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6WeaponSheet, {
|
||||
types: ["weapon"]
|
||||
});
|
||||
foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "midgard6-lvd", M6ArmorSheet, {
|
||||
types: ["armor"]
|
||||
});
|
||||
|
||||
loadHelpers();
|
||||
});
|
||||
+160
-49
@@ -1,53 +1,164 @@
|
||||
{{! Items Tab }}
|
||||
<section class="tab scrollable {{tab.cssClass}}" data-group="primary" data-tab="items">
|
||||
<ul class="itemTypes">
|
||||
{{#each itemTypes as |group type|}}
|
||||
<li class="itemHeader flexrow">
|
||||
<div class="type-label">
|
||||
{{group.label}}
|
||||
</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">
|
||||
<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}}
|
||||
<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.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">
|
||||
<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>
|
||||
{{/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">
|
||||
<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>
|
||||
{{/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>
|
||||
<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>
|
||||
{{/with}}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="sticky-progress-container">
|
||||
<div class="progress-background">
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
<section class="standard-form" style="margin-bottom: 1rem">
|
||||
<fieldset>
|
||||
<legend>Modifikation</legend>
|
||||
<div class="">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="icon fa-solid fa-dice-d20"></i>
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px; max-width:10rem"
|
||||
name="customRoll"
|
||||
id="rollDisplay"
|
||||
placeholder="1d20 + {{skillValue}}"
|
||||
value="{{customRoll}}"
|
||||
/>
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{{! <div class="d-flex align-items-center"> }}
|
||||
<div class="col-6">
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px;"
|
||||
name="customRoll"
|
||||
id="rollDisplay"
|
||||
placeholder="1d20 + {{skillValue}}"
|
||||
value="{{customRoll}}"
|
||||
/>
|
||||
</div>
|
||||
<div class="d-flex col-6" style="padding-left: 8px;">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
<label class="segmented-button">
|
||||
@@ -42,27 +44,41 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
{{#each bonuses}}
|
||||
<label class="segmented-button">
|
||||
<input
|
||||
type="radio"
|
||||
name="spezialisierung-segment"
|
||||
value="{{level}}"
|
||||
data-name="{{name}}"
|
||||
/>
|
||||
<span class="segmented-button__content">
|
||||
{{name}}:
|
||||
{{level}}
|
||||
</span>
|
||||
</label>
|
||||
{{/each}}
|
||||
{{! </div> }}
|
||||
<div class="col-12 d-flex">
|
||||
<div class="flexrow" style="padding-left: 8px">
|
||||
<div class="segmented-button-row">
|
||||
<!-- Option 1 -->
|
||||
{{#each bonuses}}
|
||||
<label class="segmented-button">
|
||||
<input
|
||||
type="radio"
|
||||
name="spezialisierung-segment"
|
||||
value="{{level}}"
|
||||
data-name="{{name}}"
|
||||
{{#ifeq name preSelectedSpez}}checked{{/ifeq}}
|
||||
/>
|
||||
<span class="segmented-button__content">
|
||||
{{name}}:
|
||||
{{level}}
|
||||
</span>
|
||||
</label>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if damageRoll}}
|
||||
<div class="col-6">
|
||||
<input
|
||||
type="text"
|
||||
style="margin-left: 8px;"
|
||||
name="customRollDamage"
|
||||
id="rollDamageDisplay"
|
||||
placeholder="{{damageRoll}}"
|
||||
value="{{customDamageRoll}}"
|
||||
/>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
{{! Beschreibung Allgemein Tab }}
|
||||
<section class="tab {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
|
||||
<section
|
||||
class="standard-form tab {{tab.cssClass}}"
|
||||
data-tab="{{tab.id}}"
|
||||
data-group="{{tab.group}}"
|
||||
style="overflow: hidden"
|
||||
>
|
||||
{{! Editors must receive enriched text data from getData to properly handle rolls, UUID links, etc. }}
|
||||
<fieldset style="height:100%">
|
||||
<legend>{{localize "Midgard6.Item.Description"}}</legend>
|
||||
{{#if editable}}
|
||||
<prose-mirror
|
||||
style="height:100%"
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<section
|
||||
class="standard-form tab {{tab.cssClass}}"
|
||||
data-tab="{{tab.id}}"
|
||||
data-group="{{tab.group}}"
|
||||
style="overflow: hidden"
|
||||
>
|
||||
<fieldset style="height:100%">
|
||||
<legend>{{localize "Midgard6.Item.Eigenschaften"}}</legend>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>Schaden</p>
|
||||
<input
|
||||
type="text"
|
||||
style=" max-width:10rem"
|
||||
name="system.schaden"
|
||||
id="rollDisplay"
|
||||
placeholder="1d6"
|
||||
value="{{system.schaden}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>Fertigkeit</p>
|
||||
<select
|
||||
type="text"
|
||||
style="margin-left: 8px; max-width:10rem"
|
||||
name="system.fertigkeit"
|
||||
id="fertigkeit"
|
||||
placeholder="Nahkampf"
|
||||
/>
|
||||
<option {{#ifeq system.fertigkeit "system.skills.kampf.fernkampf"}}selected{{/ifeq}} value="system.skills.kampf.fernkampf">{{localize
|
||||
"Midgard6.Skills.fernkampf"
|
||||
}}</option>
|
||||
<option {{#ifeq system.fertigkeit "system.skills.kampf.nahkampf"}}selected{{/ifeq}} value="system.skills.kampf.nahkampf">{{localize
|
||||
"Midgard6.Skills.nahkampf"
|
||||
}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>Spezialisierung</p>
|
||||
<select
|
||||
type="text"
|
||||
style="margin-left: 8px; max-width:10rem"
|
||||
name="system.spezialisierung"
|
||||
id="spezialisierung"
|
||||
placeholder=""
|
||||
/>
|
||||
{{#each bonuses as |bonus|}}
|
||||
<option {{#ifeq system.spezialisierung bonus.name}}selected{{/ifeq}} value="{{bonus.name}}">
|
||||
{{bonus.name}}
|
||||
</option>
|
||||
{{/each}}
|
||||
<option {{#ifeq system.spezialisierung ""}}selected{{/ifeq}} value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
@@ -1,7 +1,17 @@
|
||||
<header class="sheet-header" style="margin: 1px;">
|
||||
<div class="container">
|
||||
<div class="row align-items-end" style="height: 108px" >
|
||||
<div class="col-12" style="height:36px"></div>
|
||||
<div class="col-6" style="height:32px">
|
||||
{{#if (isdefined system.equipped)}}
|
||||
<div class="d-flex justify-content-center justify-items-center">
|
||||
<a class="sword {{#if system.equipped}}icon-checked{{/if}}" data-action="cycleEquip" data-item-id="{{item._id}}"></a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input class="custom-input right text" type="number" placeholder="{{localize "Midgard6.Gegenstand.anzahl"}}" name="system.anzahl" value="{{item.system.anzahl}}" />
|
||||
<i class="fa-solid fa-sack-dollar input-icon left"></i>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input class="custom-input left text" type="number" placeholder="{{localize "Midgard6.Gegenstand.wert"}}" name="system.wert" value="{{item.system.wert}}" />
|
||||
<i class="fa-solid fa-sack-dollar input-icon left"></i>
|
||||
@@ -16,15 +26,15 @@
|
||||
<img
|
||||
class="profile-img"
|
||||
style="z-index:1"
|
||||
src="{{actor.img}}"
|
||||
alt="{{actor.name}}"
|
||||
src="{{item.img}}"
|
||||
alt="{{item.name}}"
|
||||
{{#if editable}}
|
||||
data-action="editImage"
|
||||
data-edit="img"
|
||||
{{/if}}
|
||||
data-tooltip="{{actor.name}}"
|
||||
data-tooltip="{{item.name}}"
|
||||
height="100" width="100"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
@@ -142,6 +142,37 @@
|
||||
</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}}"
|
||||
>
|
||||
<i class="fas fa-dice-d20"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { CharacterData } from "../data/character-data";
|
||||
import { ItemData } from "../data/item-data";
|
||||
import { WeaponData } from "../data/weapon-data";
|
||||
import { ArmorData } from "../data/armor-data";
|
||||
|
||||
declare module "fvtt-types/configuration" {
|
||||
interface DataModelConfig {
|
||||
Actor: { character: typeof CharacterData };
|
||||
Item: { item: typeof ItemData };
|
||||
Item: { item: typeof ItemData, weapon: typeof WeaponData, armor: typeof ArmorData };
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -33,7 +33,9 @@
|
||||
"character": {}
|
||||
},
|
||||
"Item": {
|
||||
"item": {}
|
||||
"item": {},
|
||||
"weapon": {},
|
||||
"armor": {}
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
|
||||
Reference in new issue
Block a user