mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
264 - Action Feature Swap (#265)
* Removed action fields on Adversary/Environment in favor of using Feature Items * Added drag/drop for features onto adversary/environment settings * Added Drag of features from Adversary/Environment settings to anywhere in Foundry * Updated all item types except Class/Subclass * Added for Class/Subclass * Items now copy over their features to Character * Corrected back to actions for right items * Fixed adversary/environment features display * PR Fixes
This commit is contained in:
parent
eac58c1386
commit
e9ad9c539a
58 changed files with 1146 additions and 1114 deletions
|
|
@ -349,8 +349,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
}
|
||||
|
||||
static async finish() {
|
||||
const embeddedAncestries = await this.character.createEmbeddedDocuments('Item', [this.setup.ancestry]);
|
||||
const embeddedCommunities = await this.character.createEmbeddedDocuments('Item', [this.setup.community]);
|
||||
await this.character.createEmbeddedDocuments('Item', [this.setup.ancestry]);
|
||||
await this.character.createEmbeddedDocuments('Item', [this.setup.community]);
|
||||
await this.character.createEmbeddedDocuments('Item', [this.setup.class]);
|
||||
await this.character.createEmbeddedDocuments('Item', [this.setup.subclass]);
|
||||
await this.character.createEmbeddedDocuments('Item', Object.values(this.setup.domainCards));
|
||||
|
|
@ -379,9 +379,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
await this.character.update({
|
||||
system: {
|
||||
traits: this.setup.traits,
|
||||
experiences: this.setup.experiences,
|
||||
ancestry: embeddedAncestries[0].uuid,
|
||||
community: embeddedCommunities[0].uuid
|
||||
experiences: this.setup.experiences
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
import DHActionConfig from './action-config.mjs';
|
||||
import DHBaseItemSheet from '../sheets/api/base-item.mjs';
|
||||
import { actionsTypes } from '../../data/action/_module.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class DHAdversarySettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
|
|
@ -9,6 +5,7 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
super({});
|
||||
|
||||
this.actor = actor;
|
||||
this._dragDrop = this._createDragDropHandlers();
|
||||
}
|
||||
|
||||
get title() {
|
||||
|
|
@ -26,15 +23,19 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
actions: {
|
||||
addExperience: this.#addExperience,
|
||||
removeExperience: this.#removeExperience,
|
||||
addAction: this.#addAction,
|
||||
editAction: this.#editAction,
|
||||
removeAction: this.#removeAction
|
||||
addFeature: this.#addFeature,
|
||||
editFeature: this.#editFeature,
|
||||
removeFeature: this.#removeFeature
|
||||
},
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
}
|
||||
},
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.tab.features' },
|
||||
{ dragSelector: '.feature-item', dropSelector: null }
|
||||
]
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
|
|
@ -55,9 +56,9 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
id: 'experiences',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/experiences.hbs'
|
||||
},
|
||||
actions: {
|
||||
id: 'actions',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/actions.hbs'
|
||||
features: {
|
||||
id: 'features',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/features.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -86,13 +87,13 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.experiences'
|
||||
},
|
||||
actions: {
|
||||
features: {
|
||||
active: false,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'actions',
|
||||
id: 'features',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.actions'
|
||||
label: 'DAGGERHEART.General.tabs.features'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -107,6 +108,22 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
return context;
|
||||
}
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
this._dragDrop.forEach(d => d.bind(htmlElement));
|
||||
}
|
||||
|
||||
_createDragDropHandlers() {
|
||||
return this.options.dragDrop.map(d => {
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
drop: this._onDrop.bind(this)
|
||||
};
|
||||
return new foundry.applications.ux.DragDrop.implementation(d);
|
||||
});
|
||||
}
|
||||
|
||||
_getTabs(tabs) {
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
|
||||
|
|
@ -130,46 +147,25 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
this.render();
|
||||
}
|
||||
|
||||
static async #addAction(_event, _button) {
|
||||
const actionType = await DHBaseItemSheet.selectActionType();
|
||||
if (!actionType) return;
|
||||
try {
|
||||
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.actor)
|
||||
},
|
||||
{
|
||||
parent: this.actor
|
||||
}
|
||||
);
|
||||
await this.actor.update({ 'system.actions': [...this.actor.system.actions, action] });
|
||||
await new DHActionConfig(this.actor.system.actions[this.actor.system.actions.length - 1]).render({
|
||||
force: true
|
||||
});
|
||||
this.render();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
static async #addFeature(_, _button) {
|
||||
await this.actor.createEmbeddedDocuments('Item', [
|
||||
{
|
||||
type: 'feature',
|
||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }),
|
||||
img: 'icons/skills/melee/weapons-crossed-swords-black.webp'
|
||||
}
|
||||
]);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async #editAction(event, target) {
|
||||
static async #editFeature(event, target) {
|
||||
event.stopPropagation();
|
||||
const actionIndex = target.dataset.index;
|
||||
await new DHActionConfig(this.actor.system.actions[actionIndex]).render({
|
||||
force: true
|
||||
});
|
||||
this.actor.items.get(target.id).sheet.render(true);
|
||||
}
|
||||
|
||||
static async #removeAction(event, target) {
|
||||
static async #removeFeature(event, target) {
|
||||
event.stopPropagation();
|
||||
const actionIndex = target.dataset.index;
|
||||
await this.actor.update({
|
||||
'system.actions': this.actor.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||
});
|
||||
await this.actor.deleteEmbeddedDocuments('Item', [target.id]);
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
@ -177,4 +173,26 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
|
|||
await this.actor.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
const featureItem = event.currentTarget.closest('.feature-item');
|
||||
|
||||
if (featureItem) {
|
||||
const feature = this.actor.items.get(featureItem.id);
|
||||
const featureData = { type: 'Item', uuid: feature.uuid, fromInternal: true };
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(featureData));
|
||||
event.dataTransfer.setDragImage(featureItem.querySelector('img'), 60, 0);
|
||||
}
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'feature') {
|
||||
await this.actor.createEmbeddedDocuments('Item', [item]);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
import DHActionConfig from './action-config.mjs';
|
||||
import DHBaseItemSheet from '../sheets/api/base-item.mjs';
|
||||
import { actionsTypes } from '../../data/action/_module.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
|
|
@ -25,9 +21,9 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
},
|
||||
position: { width: 455, height: 'auto' },
|
||||
actions: {
|
||||
addAction: this.#addAction,
|
||||
editAction: this.#editAction,
|
||||
removeAction: this.#removeAction,
|
||||
addFeature: this.#addFeature,
|
||||
editFeature: this.#editFeature,
|
||||
removeFeature: this.#removeFeature,
|
||||
addCategory: this.#addCategory,
|
||||
deleteProperty: this.#deleteProperty,
|
||||
viewAdversary: this.#viewAdversary,
|
||||
|
|
@ -38,7 +34,11 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
},
|
||||
dragDrop: [{ dragSelector: null, dropSelector: '.category-container' }]
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.category-container' },
|
||||
{ dragSelector: null, dropSelector: '.tab.features' },
|
||||
{ dragSelector: '.feature-item', dropSelector: null }
|
||||
]
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
|
|
@ -51,9 +51,9 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
id: 'details',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/details.hbs'
|
||||
},
|
||||
actions: {
|
||||
id: 'actions',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/actions.hbs'
|
||||
features: {
|
||||
id: 'features',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/environment-settings/features.hbs'
|
||||
},
|
||||
adversaries: {
|
||||
id: 'adversaries',
|
||||
|
|
@ -70,13 +70,13 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.details'
|
||||
},
|
||||
actions: {
|
||||
features: {
|
||||
active: false,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'actions',
|
||||
id: 'features',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.actions'
|
||||
label: 'DAGGERHEART.General.tabs.features'
|
||||
},
|
||||
adversaries: {
|
||||
active: false,
|
||||
|
|
@ -107,6 +107,7 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
_createDragDropHandlers() {
|
||||
return this.options.dragDrop.map(d => {
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
drop: this._onDrop.bind(this)
|
||||
};
|
||||
return new foundry.applications.ux.DragDrop.implementation(d);
|
||||
|
|
@ -122,46 +123,23 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
return tabs;
|
||||
}
|
||||
|
||||
static async #addAction(_event, _button) {
|
||||
const actionType = await DHBaseItemSheet.selectActionType();
|
||||
if (!actionType) return;
|
||||
try {
|
||||
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.actor)
|
||||
},
|
||||
{
|
||||
parent: this.actor
|
||||
}
|
||||
);
|
||||
await this.actor.update({ 'system.actions': [...this.actor.system.actions, action] });
|
||||
await new DHActionConfig(this.actor.system.actions[this.actor.system.actions.length - 1]).render({
|
||||
force: true
|
||||
});
|
||||
this.render();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
static async #addFeature(_, _button) {
|
||||
await this.actor.createEmbeddedDocuments('Item', [
|
||||
{
|
||||
type: 'feature',
|
||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }),
|
||||
img: 'icons/magic/perception/orb-crystal-ball-scrying-blue.webp'
|
||||
}
|
||||
]);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async #editAction(event, target) {
|
||||
event.stopPropagation();
|
||||
const actionIndex = target.dataset.index;
|
||||
await new DHActionConfig(this.actor.system.actions[actionIndex]).render({
|
||||
force: true
|
||||
});
|
||||
static async #editFeature(_, target) {
|
||||
this.actor.items.get(target.id).sheet.render(true);
|
||||
}
|
||||
|
||||
static async #removeAction(event, target) {
|
||||
event.stopPropagation();
|
||||
const actionIndex = target.dataset.index;
|
||||
await this.actor.update({
|
||||
'system.actions': this.actor.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||
});
|
||||
static async #removeFeature(_, target) {
|
||||
await this.actor.deleteEmbeddedDocuments('Item', [target.id]);
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
@ -199,10 +177,23 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
this.render();
|
||||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
const featureItem = event.currentTarget.closest('.feature-item');
|
||||
|
||||
if (featureItem) {
|
||||
const feature = this.actor.items.get(featureItem.id);
|
||||
const featureData = { type: 'Item', uuid: feature.uuid, fromInternal: true };
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(featureData));
|
||||
event.dataTransfer.setDragImage(featureItem.querySelector('img'), 60, 0);
|
||||
}
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'adversary') {
|
||||
if (item.type === 'adversary' && event.target.closest('.category-container')) {
|
||||
const target = event.target.closest('.category-container');
|
||||
const path = `system.potentialAdversaries.${target.dataset.potentialAdversary}.adversaries`;
|
||||
const current = foundry.utils.getProperty(this.actor, path).map(x => x.uuid);
|
||||
|
|
@ -210,6 +201,9 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
|
|||
[path]: [...current, item.uuid]
|
||||
});
|
||||
this.render();
|
||||
} else if (item.type === 'feature' && event.target.closest('.tab.features')) {
|
||||
await this.actor.createEmbeddedDocuments('Item', [item]);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,19 +29,19 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
static PARTS = {
|
||||
sidebar: { template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs' },
|
||||
header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.hbs' },
|
||||
actions: { template: 'systems/daggerheart/templates/sheets/actors/adversary/actions.hbs' },
|
||||
features: { template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs' },
|
||||
notes: { template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs' },
|
||||
effects: { template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs' }
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
actions: {
|
||||
features: {
|
||||
active: true,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'actions',
|
||||
id: 'features',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.actions'
|
||||
label: 'DAGGERHEART.General.tabs.features'
|
||||
},
|
||||
notes: {
|
||||
active: false,
|
||||
|
|
@ -71,9 +71,9 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
getAction(element) {
|
||||
getItem(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.system.actions.find(x => x.id === itemId);
|
||||
item = this.document.items.get(itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
}
|
||||
|
||||
static async useItem(event) {
|
||||
const action = this.getAction(event) ?? this.actor.system.attack;
|
||||
const action = this.getItem(event) ?? this.actor.system.attack;
|
||||
action.use(event);
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
|
||||
cls.create(msg.toObject());
|
||||
} else {
|
||||
const item = this.getAction(event) ?? this.document.system.attack;
|
||||
const item = this.getItem(event) ?? this.document.system.attack;
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,12 +307,12 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
getItem(element) {
|
||||
const listElement = (element.target ?? element).closest('[data-item-id]');
|
||||
const itemId = listElement.dataset.itemId;
|
||||
if (listElement.dataset.type === 'effect') {
|
||||
return this.document.effects.get(itemId);
|
||||
} else if (['armor', 'weapon', 'feature', 'consumable', 'miscellaneous'].includes(listElement.dataset.type)) {
|
||||
return this.document.items.get(itemId);
|
||||
} else {
|
||||
return this.document.system[listElement.dataset.type].system.actions.find(x => x.id === itemId);
|
||||
|
||||
switch (listElement.dataset.type) {
|
||||
case 'effect':
|
||||
return this.document.effects.get(itemId);
|
||||
default:
|
||||
return this.document.items.get(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
|
||||
static PARTS = {
|
||||
header: { template: 'systems/daggerheart/templates/sheets/actors/environment/header.hbs' },
|
||||
actions: { template: 'systems/daggerheart/templates/sheets/actors/environment/actions.hbs' },
|
||||
features: { template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs' },
|
||||
potentialAdversaries: {
|
||||
template: 'systems/daggerheart/templates/sheets/actors/environment/potentialAdversaries.hbs'
|
||||
},
|
||||
|
|
@ -34,13 +34,13 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
};
|
||||
|
||||
static TABS = {
|
||||
actions: {
|
||||
features: {
|
||||
active: true,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'actions',
|
||||
id: 'features',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.General.tabs.actions'
|
||||
label: 'DAGGERHEART.General.tabs.features'
|
||||
},
|
||||
potentialAdversaries: {
|
||||
active: false,
|
||||
|
|
@ -69,9 +69,9 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
getAction(element) {
|
||||
getItem(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.system.actions.find(x => x.id === itemId);
|
||||
item = this.document.items.get(itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
}
|
||||
|
||||
static async useItem(event, button) {
|
||||
const action = this.getAction(event);
|
||||
const action = this.getItem(event);
|
||||
if (!action) {
|
||||
await this.viewAdversary(event, button);
|
||||
} else {
|
||||
|
|
@ -123,7 +123,7 @@ export default class DhpEnvironment extends DaggerheartSheet(ActorSheetV2) {
|
|||
}
|
||||
|
||||
static async toChat(event) {
|
||||
const item = this.getAction(event);
|
||||
const item = this.getItem(event);
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,12 +128,20 @@ export default function DHApplicationMixin(Base) {
|
|||
_createDragDropHandlers() {
|
||||
return this.options.dragDrop.map(d => {
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
drop: this._onDrop.bind(this)
|
||||
};
|
||||
return new foundry.applications.ux.DragDrop.implementation(d);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dragStart event.
|
||||
* @param {DragEvent} event
|
||||
* @protected
|
||||
*/
|
||||
_onDragStart(event) {}
|
||||
|
||||
/**
|
||||
* Handle drop event.
|
||||
* @param {DragEvent} event
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import DHApplicationMixin from './application-mixin.mjs';
|
||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
||||
import DHApplicationMixin from './application-mixin.mjs';
|
||||
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
|
||||
|
|
@ -20,8 +19,15 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
actions: {
|
||||
addAction: DHBaseItemSheet.#addAction,
|
||||
editAction: DHBaseItemSheet.#editAction,
|
||||
removeAction: DHBaseItemSheet.#removeAction
|
||||
}
|
||||
removeAction: DHBaseItemSheet.#removeAction,
|
||||
addFeature: DHBaseItemSheet.#addFeature,
|
||||
editFeature: DHBaseItemSheet.#editFeature,
|
||||
removeFeature: DHBaseItemSheet.#removeFeature
|
||||
},
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.tab.features .drop-section' },
|
||||
{ dragSelector: '.feature-item', dropSelector: null }
|
||||
]
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -93,7 +99,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
const actionType = await DHBaseItemSheet.selectActionType();
|
||||
if (!actionType) return;
|
||||
try {
|
||||
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
||||
const cls =
|
||||
game.system.api.models.actions.actionsTypes[actionType] ??
|
||||
game.system.api.models.actions.actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
|
|
@ -136,4 +144,90 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new feature to the item, prompting the user for its type.
|
||||
* @param {PointerEvent} _event - The originating click event
|
||||
* @param {HTMLElement} _button - The capturing HTML element which defines the [data-action="addFeature"]
|
||||
*/
|
||||
static async #addFeature(_event, _button) {
|
||||
const feature = await game.items.documentClass.create({
|
||||
type: 'feature',
|
||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
|
||||
});
|
||||
await this.document.update({
|
||||
'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an existing feature on the item
|
||||
* @param {PointerEvent} _event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editFeature"]
|
||||
*/
|
||||
static async #editFeature(_event, button) {
|
||||
const target = button.closest('.feature-item');
|
||||
const feature = this.document.system.features.find(x => x?.id === target.id);
|
||||
if (!feature) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
feature.sheet.render(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a feature from the item.
|
||||
* @param {PointerEvent} event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeFeature"]
|
||||
*/
|
||||
static async #removeFeature(event, button) {
|
||||
event.stopPropagation();
|
||||
const target = button.closest('.feature-item');
|
||||
|
||||
await this.document.update({
|
||||
'system.features': this.document.system.features
|
||||
.filter(feature => feature && feature.id !== target.id)
|
||||
.map(x => x.uuid)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Drag/Drop */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* On dragStart on the item.
|
||||
* @param {DragEvent} event - The drag event
|
||||
*/
|
||||
async _onDragStart(event) {
|
||||
const featureItem = event.currentTarget.closest('.feature-item');
|
||||
|
||||
if (featureItem) {
|
||||
const feature = this.document.system.features.find(x => x?.id === featureItem.id);
|
||||
if (!feature) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
const featureData = { type: 'Item', data: { ...feature.toObject(), _id: null }, fromInternal: true };
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(featureData));
|
||||
event.dataTransfer.setDragImage(featureItem.querySelector('img'), 60, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On drop on the item.
|
||||
* @param {DragEvent} event - The drag event
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item?.type === 'feature') {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
await this.document.update({ 'system.features': [...current, item.uuid] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ export default class DHHeritageSheet extends DHBaseItemSheet {
|
|||
static PARTS = {
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||
actions: {
|
||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
||||
scrollable: ['.actions']
|
||||
feature: {
|
||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||
scrollable: ['.feature']
|
||||
},
|
||||
effects: {
|
||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||
|
|
@ -23,7 +23,7 @@ export default class DHHeritageSheet extends DHBaseItemSheet {
|
|||
/** @override*/
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'effects' }],
|
||||
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'effects' }],
|
||||
initial: 'description',
|
||||
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ import DHBaseItemSheet from '../api/base-item.mjs';
|
|||
export default class BeastformSheet extends DHBaseItemSheet {
|
||||
/**@inheritdoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ['beastform'],
|
||||
dragDrop: [{ dragSelector: null, dropSelector: '.drop-section' }],
|
||||
actions: {
|
||||
editFeature: this.editFeature,
|
||||
removeFeature: this.removeFeature
|
||||
}
|
||||
classes: ['beastform']
|
||||
};
|
||||
|
||||
/**@override */
|
||||
|
|
@ -40,26 +35,4 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
|||
|
||||
return context;
|
||||
}
|
||||
|
||||
static editFeature(event) {
|
||||
const target = event.target.closest('[data-action="editFeature"]');
|
||||
const feature = this.document.system.features[target.dataset.index];
|
||||
feature.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static async removeFeature(_, target) {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
await this.document.update({
|
||||
'system.features': current.filter((_, index) => index !== Number(target.dataset.index))
|
||||
});
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'feature') {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
await this.document.update({ 'system.features': [...current, item.uuid] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
||||
|
||||
const { TextEditor } = foundry.applications.ux;
|
||||
|
||||
|
|
@ -169,71 +167,45 @@ export default class ClassSheet extends DHBaseItemSheet {
|
|||
doc.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
//TODO: redo this
|
||||
async selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type',
|
||||
type = 'form',
|
||||
data = {};
|
||||
return Dialog.prompt({
|
||||
title,
|
||||
label: title,
|
||||
content,
|
||||
type,
|
||||
callback: html => {
|
||||
const form = html[0].querySelector('form'),
|
||||
fd = new foundry.applications.ux.FormDataExtended(form);
|
||||
foundry.utils.mergeObject(data, fd.object, { inplace: true });
|
||||
|
||||
return data;
|
||||
},
|
||||
rejectClose: false
|
||||
});
|
||||
}
|
||||
|
||||
//TODO: redo this
|
||||
getActionPath(type) {
|
||||
return type === 'hope' ? 'hopeFeatures' : 'classFeatures';
|
||||
}
|
||||
|
||||
//TODO: redo this
|
||||
static async addFeature(_, target) {
|
||||
const actionPath = this.getActionPath(target.dataset.type);
|
||||
const actionType = await this.selectActionType();
|
||||
const cls = actionsTypes[actionType?.type] ?? actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
systemPath: actionPath,
|
||||
type: actionType.type,
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
parent: this.document
|
||||
}
|
||||
);
|
||||
await this.document.update({ [`system.${actionPath}`]: [...this.document.system[actionPath], action] });
|
||||
}
|
||||
|
||||
//TODO: redo this
|
||||
static async editFeature(_, target) {
|
||||
const action = this.document.system[this.getActionPath(target.dataset.type)].find(
|
||||
x => x._id === target.dataset.feature
|
||||
);
|
||||
await new DHActionConfig(action).render(true);
|
||||
}
|
||||
|
||||
//TODO: redo this
|
||||
static async deleteFeature(_, target) {
|
||||
const actionPath = this.getActionPath(target.dataset.type);
|
||||
const feature = await game.items.documentClass.create({
|
||||
type: 'feature',
|
||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
|
||||
});
|
||||
await this.document.update({
|
||||
[`system.${actionPath}`]: this.document.system[actionPath].filter(
|
||||
action => action._id !== target.dataset.feature
|
||||
)
|
||||
[`system.${actionPath}`]: [
|
||||
...this.document.system[actionPath].filter(x => x).map(x => x.uuid),
|
||||
feature.uuid
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
static async editFeature(_, button) {
|
||||
const target = button.closest('.feature-item');
|
||||
const actionPath = this.getActionPath(button.dataset.type);
|
||||
const feature = this.document.system[actionPath].find(x => x?.id === target.dataset.featureId);
|
||||
if (!feature) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
feature.sheet.render(true);
|
||||
}
|
||||
|
||||
static async deleteFeature(event, button) {
|
||||
event.stopPropagation();
|
||||
const target = button.closest('.feature-item');
|
||||
const actionPath = this.getActionPath(button.dataset.type);
|
||||
|
||||
await this.document.update({
|
||||
[`system.${actionPath}`]: this.document.system[actionPath]
|
||||
.filter(feature => feature && feature.id !== target.dataset.featureId)
|
||||
.map(x => x.uuid)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||
|
||||
export default class FeatureSheet extends DHBaseItemSheet {
|
||||
|
|
@ -6,7 +8,12 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
|||
id: 'daggerheart-feature',
|
||||
classes: ['feature'],
|
||||
position: { height: 600 },
|
||||
window: { resizable: true }
|
||||
window: { resizable: true },
|
||||
actions: {
|
||||
addAction: FeatureSheet.#addAction,
|
||||
editAction: FeatureSheet.#editAction,
|
||||
removeAction: FeatureSheet.#removeAction
|
||||
}
|
||||
};
|
||||
|
||||
/**@override */
|
||||
|
|
@ -41,4 +48,83 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
|||
|
||||
return context;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Render a dialog prompting the user to select an action type.
|
||||
*
|
||||
* @returns {Promise<object>} An object containing the selected action type.
|
||||
*/
|
||||
static async selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type';
|
||||
|
||||
return foundry.applications.api.DialogV2.prompt({
|
||||
window: { title },
|
||||
content,
|
||||
ok: {
|
||||
label: title,
|
||||
callback: (event, button, dialog) => button.form.elements.type.value
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the item, prompting the user for its type.
|
||||
* @param {PointerEvent} _event - The originating click event
|
||||
* @param {HTMLElement} _button - The capturing HTML element which defines the [data-action="addAction"]
|
||||
*/
|
||||
static async #addAction(_event, _button) {
|
||||
const actionType = await FeatureSheet.selectActionType();
|
||||
if (!actionType) return;
|
||||
try {
|
||||
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
type: actionType,
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
parent: this.document
|
||||
}
|
||||
);
|
||||
await this.document.update({ 'system.actions': [...this.document.system.actions, action] });
|
||||
await new DHActionConfig(this.document.system.actions[this.document.system.actions.length - 1]).render({
|
||||
force: true
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an existing action on the item
|
||||
* @param {PointerEvent} _event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editAction"]
|
||||
*/
|
||||
static async #editAction(_event, button) {
|
||||
const action = this.document.system.actions[button.dataset.index];
|
||||
await new DHActionConfig(action).render({ force: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an action from the item.
|
||||
* @param {PointerEvent} event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
||||
*/
|
||||
static async #removeAction(event, button) {
|
||||
event.stopPropagation();
|
||||
const actionIndex = button.closest('[data-index]').dataset.index;
|
||||
await this.document.update({
|
||||
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
||||
|
||||
export default class SubclassSheet extends DHBaseItemSheet {
|
||||
/**@inheritdoc */
|
||||
|
|
@ -39,101 +37,63 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
|||
}
|
||||
};
|
||||
|
||||
//TODO redo everything below this message
|
||||
|
||||
static addFeature(_, target) {
|
||||
if (target.dataset.type === 'action') this.addAction(target.dataset.level);
|
||||
else this.addEffect(target.dataset.level);
|
||||
}
|
||||
|
||||
static async editFeature(_, target) {
|
||||
if (target.dataset.type === 'action') this.editAction(target.dataset.level, target.dataset.feature);
|
||||
else this.editEffect(target.dataset.feature);
|
||||
}
|
||||
|
||||
static async deleteFeature(_, target) {
|
||||
if (target.dataset.type === 'action') this.removeAction(target.dataset.level, target.dataset.feature);
|
||||
else this.removeEffect(target.dataset.level, target.dataset.feature);
|
||||
}
|
||||
|
||||
async #selectActionType() {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
),
|
||||
title = 'Select Action Type',
|
||||
type = 'form',
|
||||
data = {};
|
||||
return Dialog.prompt({
|
||||
title,
|
||||
label: title,
|
||||
content,
|
||||
type,
|
||||
callback: html => {
|
||||
const form = html[0].querySelector('form'),
|
||||
fd = new foundry.applications.ux.FormDataExtended(form);
|
||||
foundry.utils.mergeObject(data, fd.object, { inplace: true });
|
||||
return data;
|
||||
},
|
||||
rejectClose: false
|
||||
static async addFeature(_, target) {
|
||||
const feature = await game.items.documentClass.create({
|
||||
type: 'feature',
|
||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
|
||||
});
|
||||
}
|
||||
|
||||
async addAction(level) {
|
||||
const actionType = await this.#selectActionType();
|
||||
const cls = actionsTypes[actionType?.type] ?? actionsTypes.attack,
|
||||
action = new cls(
|
||||
{
|
||||
_id: foundry.utils.randomID(),
|
||||
systemPath: `${level}.actions`,
|
||||
type: actionType.type,
|
||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name),
|
||||
...cls.getSourceConfig(this.document)
|
||||
},
|
||||
{
|
||||
parent: this.document
|
||||
}
|
||||
);
|
||||
await this.document.update({ [`system.${level}.actions`]: [...this.document.system[level].actions, action] });
|
||||
await new DHActionConfig(
|
||||
this.document.system[level].actions[this.document.system[level].actions.length - 1]
|
||||
).render(true);
|
||||
}
|
||||
|
||||
async addEffect(level) {
|
||||
const embeddedItems = await this.document.createEmbeddedDocuments('ActiveEffect', [
|
||||
{ name: game.i18n.localize('DAGGERHEART.Feature.NewEffect') }
|
||||
]);
|
||||
await this.document.update({
|
||||
[`system.${level}.effects`]: [
|
||||
...this.document.system[level].effects.map(x => x.uuid),
|
||||
embeddedItems[0].uuid
|
||||
]
|
||||
[`system.${target.dataset.type}`]: feature.uuid
|
||||
});
|
||||
}
|
||||
|
||||
async editAction(level, id) {
|
||||
const action = this.document.system[level].actions.find(x => x._id === id);
|
||||
await new DHActionConfig(action).render(true);
|
||||
static async editFeature(_, button) {
|
||||
const feature = this.document.system[button.dataset.type];
|
||||
if (!feature) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
feature.sheet.render(true);
|
||||
}
|
||||
|
||||
async editEffect(id) {
|
||||
const effect = this.document.effects.get(id);
|
||||
effect.sheet.render(true);
|
||||
}
|
||||
static async deleteFeature(event, button) {
|
||||
event.stopPropagation();
|
||||
|
||||
async removeAction(level, id) {
|
||||
await this.document.update({
|
||||
[`system.${level}.actions`]: this.document.system[level].actions.filter(action => action._id !== id)
|
||||
[`system.${button.dataset.type}`]: null
|
||||
});
|
||||
}
|
||||
|
||||
async removeEffect(level, id) {
|
||||
await this.document.effects.get(id).delete();
|
||||
await this.document.update({
|
||||
[`system.${level}.effects`]: this.document.system[level].effects
|
||||
.filter(x => x && x.id !== id)
|
||||
.map(effect => effect.uuid)
|
||||
});
|
||||
async _onDragStart(event) {
|
||||
const featureItem = event.currentTarget.closest('.drop-section');
|
||||
|
||||
if (featureItem) {
|
||||
const feature = this.document.system[featureItem.dataset.type];
|
||||
if (!feature) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
const featureData = { type: 'Item', data: { ...feature.toObject(), _id: null }, fromInternal: true };
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(featureData));
|
||||
event.dataTransfer.setDragImage(featureItem.querySelector('img'), 60, 0);
|
||||
}
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item?.type === 'feature') {
|
||||
const dropSection = event.target.closest('.drop-section');
|
||||
if (this.document.system[dropSection.dataset.type]) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsFull'));
|
||||
return;
|
||||
}
|
||||
|
||||
await this.document.update({ [`system.${dropSection.dataset.type}`]: item.uuid });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
|
||||
getTargetList = (event, message) => {
|
||||
const targetSelection = event.target
|
||||
.closest('.message-content')
|
||||
.querySelector('.button-target-selection.target-selected'),
|
||||
.closest('.message-content')
|
||||
.querySelector('.button-target-selection.target-selected'),
|
||||
isHit = Boolean(targetSelection.dataset.targetHit);
|
||||
return {
|
||||
isHit,
|
||||
|
|
@ -255,7 +255,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle selecting an advantage and disable further selection.
|
||||
* @param {MouseEvent} event
|
||||
|
|
@ -277,7 +276,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
abilityUseButton = async (event, message) => {
|
||||
event.stopPropagation();
|
||||
|
||||
|
|
|
|||
|
|
@ -199,11 +199,7 @@ export default class FilterMenu extends foundry.applications.ux.ContextMenu {
|
|||
|
||||
const sort = arr => game.i18n.sortObjects(arr, 'name');
|
||||
|
||||
return [
|
||||
...sort(typesFilters, 'name'),
|
||||
...sort(burdenFilter, 'name'),
|
||||
...sort(damageTypeFilter, 'name')
|
||||
];
|
||||
return [...sort(typesFilters, 'name'), ...sort(burdenFilter, 'name'), ...sort(damageTypeFilter, 'name')];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue