Hintergründe
This commit is contained in:
1 parent
b02d9c2313
commit
920c68a7da
23 files changed
+712
-39
No files matched your search
@@ -55,6 +55,10 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
id: "zauber",
|
||||
icon: "fa-hand-sparkles"
|
||||
},
|
||||
{
|
||||
id: "hintergrund",
|
||||
icon: "fa-feather-pointed"
|
||||
},
|
||||
{
|
||||
id: "effects",
|
||||
icon: "fa-bolt"
|
||||
@@ -87,16 +91,40 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
template: systemPath("templates/actor/items.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
// biographie: {
|
||||
// template: systemPath("templates/items/description.hbs"),
|
||||
// scrollable: [""]
|
||||
// },
|
||||
hintergrund: {
|
||||
template: systemPath("templates/actor/hintergrund.hbs"),
|
||||
scrollable: [""]
|
||||
},
|
||||
effects: {
|
||||
template: systemPath("templates/shared/effects.hbs"),
|
||||
scrollable: [""]
|
||||
}
|
||||
};
|
||||
|
||||
_attachPartListeners(partId, html, bubble) {
|
||||
super._attachPartListeners(partId, html, bubble);
|
||||
|
||||
switch (partId) {
|
||||
case "hintergrund":
|
||||
const collapsible = html.querySelectorAll("div[data-action=collapsible]");
|
||||
if (collapsible) {
|
||||
collapsible.forEach((node) => {
|
||||
node.addEventListener(
|
||||
"click",
|
||||
function () {
|
||||
node.classList.toggle("active");
|
||||
var content = node.nextElementSibling;
|
||||
content.classList.toggle("active");
|
||||
node.getElementsByTagName("i")[0].classList.toggle("fa-compress");
|
||||
},
|
||||
{ capture: true }
|
||||
);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
/** @inheritdoc */
|
||||
@@ -153,6 +181,21 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
context.zauber = await this._getZauber();
|
||||
context.tab = context.tabs[partId];
|
||||
break;
|
||||
case "hintergrund":
|
||||
context.fields = await this._getFields();
|
||||
context.enrichedBeschreibung =
|
||||
await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
this.actor.system.biographie.beschreibung,
|
||||
{
|
||||
// Whether to show secret blocks in the finished html
|
||||
secrets: this.document.isOwner,
|
||||
// Data to fill in for inline rolls
|
||||
rollData: this.actor.getRollData(),
|
||||
// Relative UUID resolution
|
||||
relativeTo: this.actor
|
||||
}
|
||||
);
|
||||
context.tab = context.tabs[partId];
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -701,7 +744,7 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
* @returns {Item|ActiveEffect} The embedded Item or ActiveEffect.
|
||||
*/
|
||||
_getEmbeddedDocument(target) {
|
||||
const docRow = target.closest("li[data-document-class]");
|
||||
const docRow = target.closest("[data-document-class]");
|
||||
if (docRow.dataset.documentClass === "Item") {
|
||||
return this.actor.items.get(docRow.dataset.itemId);
|
||||
} else if (docRow.dataset.documentClass === "ActiveEffect") {
|
||||
@@ -825,7 +868,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
|
||||
const allowed = Hooks.call("dropItemSheetData", item, this, data);
|
||||
if (allowed === false) return;
|
||||
|
||||
// Handle different data types
|
||||
switch (data.type) {
|
||||
case "ActiveEffect":
|
||||
@@ -912,6 +954,11 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
async _onDropItemCreate(actor, itemData) {
|
||||
itemData = itemData instanceof Array ? itemData : [itemData];
|
||||
return actor.createEmbeddedDocuments("Item", itemData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dropping of an item reference or item data onto an Actor Sheet.
|
||||
* @param {DragEvent} event The concluding DragEvent which contains drop data.
|
||||
@@ -922,9 +969,12 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
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);
|
||||
if (this.actor.items.get(data.itemId)) return this._onSortItem(event, data);
|
||||
|
||||
const item = await Item.implementation.fromDropData(data);
|
||||
const itemData = item.toObject();
|
||||
|
||||
return this._onDropItemCreate(this.actor, itemData);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -948,7 +998,6 @@ export class M6ActorSheet extends api.HandlebarsApplicationMixin(sheets.ActorShe
|
||||
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, {
|
||||
|
||||
Reference in new issue
Block a user