mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Added DhTooltipManager aswell as placeholder rendering for Armor/Weapon/DomainCard (#245)
This commit is contained in:
parent
750282aeec
commit
ee8a48f73d
7 changed files with 34 additions and 1 deletions
|
|
@ -124,6 +124,7 @@ Hooks.once('init', () => {
|
|||
|
||||
CONFIG.ui.resources = Resources;
|
||||
CONFIG.ux.ContextMenu = applications.DhContextMenu;
|
||||
CONFIG.ux.TooltipManager = applications.DhTooltipManager;
|
||||
|
||||
game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ export { default as DhpChatMessage } from './chatMessage.mjs';
|
|||
export { default as DhpEnvironment } from './sheets/actors/environment.mjs';
|
||||
export { default as DhActiveEffectConfig } from './sheets/activeEffectConfig.mjs';
|
||||
export { default as DhContextMenu } from './contextMenu.mjs';
|
||||
export { default as DhTooltipManager } from './tooltipManager.mjs';
|
||||
|
||||
export * as api from './sheets/api/_modules.mjs';
|
||||
|
|
|
|||
16
module/applications/tooltipManager.mjs
Normal file
16
module/applications/tooltipManager.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export default class DhTooltipManager extends TooltipManager {
|
||||
async activate(element, options = {}) {
|
||||
let html = options.html;
|
||||
if (element.dataset.tooltip.startsWith('#item#')) {
|
||||
const item = await foundry.utils.fromUuid(element.dataset.tooltip.slice(6));
|
||||
if (item) {
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/tooltip/${item.type}.hbs`,
|
||||
item
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
super.activate(element, { ...options, html: html });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<li class="inventory-item" data-item-id="{{item.id}}" data-companion="{{companion}}">
|
||||
<li class="inventory-item" data-item-id="{{item.id}}" data-companion="{{companion}}" data-tooltip="{{concat "#item#" item.uuid}}">
|
||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem"/>
|
||||
<div class="item-label">
|
||||
<div class="item-name">{{item.name}}</div>
|
||||
|
|
|
|||
5
templates/tooltip/armor.hbs
Normal file
5
templates/tooltip/armor.hbs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div>
|
||||
<div>{{name}}</div>
|
||||
<img src="{{img}}" />
|
||||
<div>{{{system.description}}}</div>
|
||||
</div>
|
||||
5
templates/tooltip/domainCard.hbs
Normal file
5
templates/tooltip/domainCard.hbs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div>
|
||||
<div>{{name}}</div>
|
||||
<img src="{{img}}" />
|
||||
<div>{{{system.description}}}</div>
|
||||
</div>
|
||||
5
templates/tooltip/weapon.hbs
Normal file
5
templates/tooltip/weapon.hbs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div>
|
||||
<div>{{name}}</div>
|
||||
<img src="{{img}}" />
|
||||
<div>{{{system.description}}}</div>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue