mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 04:31:07 +01:00
* FIX: Add enritch to HTMLField FIX: Remove no-HTMLField from Manifest FIX: Convert Scar's HTMLField to StringField FIX: Remove unused HTMLField * REMOVE unused hanldebars helpers * FEAT: add inventory-fieldset-items-V2 and inventory-item-V2 partials for Actors * FIX showLabels to hideTags * FEAT: add template to items sheet * FEAT: add effects tabs on ItemSheet * FEAT: add context menus for all inventory-items * FEAT: add resources to inventory-item template * FEAT: add enritch on inventory-item description FEAT: add extensible behavior on inventory-item-content FEAT: add fade effect on item-img to roll-itmg * FEAT: add eritch to NPC description FIX: missing htmlFieldss on manfiest FIX: add misisng localizations * FIX_ minor fixes * Little resource fix. Noone will notice ._. * FIX: remove default list styles FIX: .extended css reduce max-height, shorten animation duration to 0.5s, and set overflow to auto. FIX: set enriched=notes.enriche on notes.hbs FIX: set experience.value on sidebar.hbs FIX: move tooltip from item-img to img-portrait on inventory-item-V2.hbs REMOVE: unused files --------- Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com> Co-authored-by: WBHarry <williambjrklund@gmail.com>
126 lines
4.1 KiB
JavaScript
126 lines
4.1 KiB
JavaScript
import DHBaseActorSheet from '../api/base-actor.mjs';
|
|
|
|
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
|
|
|
export default class AdversarySheet extends DHBaseActorSheet {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ['adversary'],
|
|
position: { width: 660, height: 766 },
|
|
window: { resizable: true },
|
|
actions: {
|
|
reactionRoll: AdversarySheet.#reactionRoll,
|
|
},
|
|
window: {
|
|
resizable: true
|
|
}
|
|
};
|
|
|
|
static PARTS = {
|
|
sidebar: { template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs' },
|
|
header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.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' }
|
|
};
|
|
|
|
/** @inheritdoc */
|
|
static TABS = {
|
|
primary: {
|
|
tabs: [{ id: 'features' }, { id: 'effects' }, { id: 'notes' }],
|
|
initial: 'features',
|
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
|
}
|
|
};
|
|
|
|
/**@inheritdoc */
|
|
async _prepareContext(options) {
|
|
const context = await super._prepareContext(options);
|
|
context.systemFields.attack.fields = this.document.system.attack.schema.fields;
|
|
return context;
|
|
}
|
|
|
|
/**@inheritdoc */
|
|
async _preparePartContext(partId, context, options) {
|
|
context = await super._preparePartContext(partId, context, options);
|
|
switch (partId) {
|
|
case 'header':
|
|
await this._prepareHeaderContext(context, options);
|
|
break;
|
|
case 'notes':
|
|
await this._prepareNotesContext(context, options);
|
|
break;
|
|
}
|
|
return context;
|
|
}
|
|
|
|
/**
|
|
* Prepare render context for the Biography part.
|
|
* @param {ApplicationRenderContext} context
|
|
* @param {ApplicationRenderOptions} options
|
|
* @returns {Promise<void>}
|
|
* @protected
|
|
*/
|
|
async _prepareNotesContext(context, _options) {
|
|
const { system } = this.document;
|
|
const { TextEditor } = foundry.applications.ux;
|
|
|
|
const paths = {
|
|
notes: 'notes'
|
|
};
|
|
|
|
for (const [key, path] of Object.entries(paths)) {
|
|
const value = foundry.utils.getProperty(system, path);
|
|
context[key] = {
|
|
field: system.schema.getField(path),
|
|
value,
|
|
enriched: await TextEditor.implementation.enrichHTML(value, {
|
|
secrets: this.document.isOwner,
|
|
relativeTo: this.document
|
|
})
|
|
};
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Prepare render context for the Header part.
|
|
* @param {ApplicationRenderContext} context
|
|
* @param {ApplicationRenderOptions} options
|
|
* @returns {Promise<void>}
|
|
* @protected
|
|
*/
|
|
async _prepareHeaderContext(context, _options) {
|
|
const { system } = this.document;
|
|
const { TextEditor } = foundry.applications.ux;
|
|
|
|
context.description = await TextEditor.implementation.enrichHTML(system.description, {
|
|
secrets: this.document.isOwner,
|
|
relativeTo: this.document
|
|
});
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
/* Application Clicks Actions */
|
|
/* -------------------------------------------- */
|
|
|
|
/**
|
|
* Performs a reaction roll for an Adversary.
|
|
* @type {ApplicationClickAction}
|
|
*/
|
|
static #reactionRoll(event) {
|
|
const config = {
|
|
event: event,
|
|
title: `Reaction Roll: ${this.actor.name}`,
|
|
headerTitle: 'Adversary Reaction Roll',
|
|
roll: {
|
|
type: 'reaction'
|
|
},
|
|
chatMessage: {
|
|
type: 'adversaryRoll',
|
|
template: 'systems/daggerheart/templates/ui/chat/adversary-roll.hbs',
|
|
mute: true
|
|
}
|
|
};
|
|
|
|
this.actor.diceRoll(config);
|
|
}
|
|
}
|