mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Bug/103 enrich htmlfield content before its used in applications (#369)
* 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>
This commit is contained in:
parent
615df65415
commit
b8930b18a4
61 changed files with 1768 additions and 1434 deletions
|
|
@ -21,11 +21,24 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
submitOnChange: true
|
||||
},
|
||||
actions: {
|
||||
openSettings: DHBaseActorSheet.#openSettings
|
||||
openSettings: DHBaseActorSheet.#openSettings,
|
||||
sendExpToChat: DHBaseActorSheet.#sendExpToChat,
|
||||
},
|
||||
contextMenus: [
|
||||
{
|
||||
handler: DHBaseActorSheet.#getFeatureContextOptions,
|
||||
selector: '[data-item-uuid][data-type="feature"]',
|
||||
options: {
|
||||
parentClassHooks: false,
|
||||
fixed: true
|
||||
}
|
||||
}
|
||||
],
|
||||
dragDrop: [{ dragSelector: '.inventory-item[data-type="attack"]', dropSelector: null }]
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@type {typeof DHBaseActorSettings}*/
|
||||
#settingSheet;
|
||||
|
||||
|
|
@ -35,6 +48,10 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
return (this.#settingSheet ??= SheetClass ? new SheetClass({ document: this.document }) : null);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Prepare Context */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
|
|
@ -42,6 +59,56 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
|
||||
/**@inheritdoc */
|
||||
async _preparePartContext(partId, context, options) {
|
||||
context = await super._preparePartContext(partId, context, options);
|
||||
switch (partId) {
|
||||
case 'effects':
|
||||
await this._prepareEffectsContext(context, options);
|
||||
break;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare render context for the Effect part.
|
||||
* @param {ApplicationRenderContext} context
|
||||
* @param {ApplicationRenderOptions} options
|
||||
* @returns {Promise<void>}
|
||||
* @protected
|
||||
*/
|
||||
async _prepareEffectsContext(context, _options) {
|
||||
context.effects = {
|
||||
actives: [],
|
||||
inactives: [],
|
||||
};
|
||||
|
||||
for (const effect of this.actor.allApplicableEffects()) {
|
||||
const list = effect.active ? context.effects.actives : context.effects.inactives;
|
||||
list.push(effect);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Context Menu */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Get the set of ContextMenu options for Features.
|
||||
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||
* @this {DHSheetV2}
|
||||
* @protected
|
||||
*/
|
||||
static #getFeatureContextOptions() {
|
||||
return this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true });
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Open the Actor Setting Sheet
|
||||
* @type {ApplicationClickAction}
|
||||
|
|
@ -50,6 +117,29 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
await this.settingSheet.render({ force: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Experience to Chat
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #sendExpToChat(_, button) {
|
||||
const experience = this.document.system.experiences[button.dataset.id];
|
||||
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
|
||||
description: `${experience.name} ${experience.value.signedString()}`
|
||||
};
|
||||
|
||||
foundry.documents.ChatMessage.implementation.create({
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Drag/Drop */
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue