mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
FEAT: add inventory-fieldset-items-V2 and inventory-item-V2 partials for Actors
This commit is contained in:
parent
9ccbfe1b01
commit
634bb3d644
28 changed files with 733 additions and 514 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { getDocFromElement } from '../../helpers/utils.mjs';
|
||||
import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
|
||||
|
||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||
|
|
@ -9,8 +10,7 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
|
|||
actions: {
|
||||
addCategory: DHEnvironmentSettings.#addCategory,
|
||||
removeCategory: DHEnvironmentSettings.#removeCategory,
|
||||
viewAdversary: this.#viewAdversary,
|
||||
deleteAdversary: this.#deleteAdversary
|
||||
deleteAdversary: DHEnvironmentSettings.#deleteAdversary
|
||||
},
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.category-container' },
|
||||
|
|
@ -69,37 +69,30 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
|
|||
await this.actor.update({ [`system.potentialAdversaries.-=${target.dataset.categoryId}`]: null });
|
||||
}
|
||||
|
||||
static async #viewAdversary(_, button) {
|
||||
const adversary = await foundry.utils.fromUuid(button.dataset.adversary);
|
||||
if (!adversary) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.adversaryMissing'));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @type {ApplicationClickAction}
|
||||
* @returns
|
||||
*/
|
||||
static async #deleteAdversary(_event, target) {
|
||||
const doc = getDocFromElement(target);
|
||||
const { category } = target.dataset;
|
||||
const path = `system.potentialAdversaries.${category}.adversaries`;
|
||||
|
||||
adversary.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static async #deleteAdversary(event, target) {
|
||||
const adversaryKey = target.dataset.adversary;
|
||||
const path = `system.potentialAdversaries.${target.dataset.potentialAdversary}.adversaries`;
|
||||
const property = foundry.utils.getProperty(this.actor, path);
|
||||
const adversary = property.find(x => (x?.uuid ?? x) === adversaryKey);
|
||||
|
||||
if (adversary) {
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||
type: game.i18n.localize('TYPES.Actor.adversary'),
|
||||
name: adversary.name
|
||||
name: doc.name
|
||||
})
|
||||
},
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: adversary.name })
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: doc.name })
|
||||
});
|
||||
|
||||
if (!confirmed) return;
|
||||
}
|
||||
|
||||
const newAdversaries = property.filter(x => x && (x?.uuid ?? x) !== adversaryKey);
|
||||
const adversaries = foundry.utils.getProperty(this.actor, path);
|
||||
const newAdversaries = adversaries.filter(a => a.uuid !== doc.uuid);
|
||||
await this.actor.update({ [path]: newAdversaries });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
window: { resizable: true },
|
||||
actions: {
|
||||
reactionRoll: AdversarySheet.#reactionRoll,
|
||||
useItem: this.useItem,
|
||||
toChat: this.toChat
|
||||
},
|
||||
window: {
|
||||
resizable: true
|
||||
|
|
@ -28,7 +26,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
/** @inheritdoc */
|
||||
static TABS = {
|
||||
primary: {
|
||||
tabs: [{ id: 'features' }, { id: 'notes' }, { id: 'effects' }],
|
||||
tabs: [{ id: 'features' }, { id: 'effects' }, { id: 'notes' }],
|
||||
initial: 'features',
|
||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||
}
|
||||
|
|
@ -80,12 +78,6 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
}
|
||||
}
|
||||
|
||||
getItem(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.items.get(itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -111,42 +103,4 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
|
||||
this.actor.diceRoll(config);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async useItem(event) {
|
||||
const action = this.getItem(event) ?? this.actor.system.attack;
|
||||
action.use(event);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async toChat(event, button) {
|
||||
if (button?.dataset?.type === 'experience') {
|
||||
const experience = this.document.system.experiences[button.dataset.uuid];
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
|
||||
description: `${experience.name} ${experience.total.signedString()}`
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
||||
cls.create(msg.toObject());
|
||||
} else {
|
||||
const item = this.getItem(event) ?? this.document.system.attack;
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { abilities } from '../../../config/actorConfig.mjs';
|
|||
import DhCharacterlevelUp from '../../levelup/characterLevelup.mjs';
|
||||
import DhCharacterCreation from '../../characterCreation/characterCreation.mjs';
|
||||
import FilterMenu from '../../ux/filter-menu.mjs';
|
||||
import { getDocFromElement } from "../../../helpers/utils.mjs";
|
||||
|
||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||
|
||||
|
|
@ -23,8 +24,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
makeDeathMove: CharacterSheet.#makeDeathMove,
|
||||
levelManagement: CharacterSheet.#levelManagement,
|
||||
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
||||
useItem: this.useItem, //TODO Fix this
|
||||
toChat: this.toChat
|
||||
},
|
||||
window: {
|
||||
resizable: true
|
||||
|
|
@ -33,7 +32,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
contextMenus: [
|
||||
{
|
||||
handler: CharacterSheet._getContextMenuOptions,
|
||||
selector: '[data-item-id]',
|
||||
selector: '[data-item-uuid]',
|
||||
options: {
|
||||
parentClassHooks: false,
|
||||
fixed: true
|
||||
|
|
@ -97,20 +96,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this._createSearchFilter();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
getItem(element) {
|
||||
const listElement = (element.target ?? element).closest('[data-item-id]');
|
||||
const itemId = listElement.dataset.itemId;
|
||||
|
||||
switch (listElement.dataset.type) {
|
||||
case 'effect':
|
||||
return this.document.effects.get(itemId);
|
||||
default:
|
||||
return this.document.items.get(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Prepare Context */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -175,7 +160,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
* @protected
|
||||
*/
|
||||
async _prepareLoadoutContext(context, _options) {
|
||||
context.listView = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList);
|
||||
context.cardView = !game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -229,38 +214,21 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
* @protected
|
||||
*/
|
||||
static _getContextMenuOptions() {
|
||||
/**
|
||||
* Get the item from the element.
|
||||
* @param {HTMLElement} el
|
||||
* @returns {foundry.documents.Item?}
|
||||
*/
|
||||
const getItem = element => {
|
||||
const listElement = (element.target ?? element).closest('[data-item-id]');
|
||||
const itemId = listElement.dataset.itemId;
|
||||
|
||||
switch (listElement.dataset.type) {
|
||||
case 'effect':
|
||||
return this.document.effects.get(itemId);
|
||||
default:
|
||||
return this.document.items.get(itemId);
|
||||
}
|
||||
};
|
||||
|
||||
return [
|
||||
{
|
||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.useItem',
|
||||
icon: '<i class="fa-solid fa-burst"></i>',
|
||||
condition: el => {
|
||||
const item = getItem(el);
|
||||
return !['class', 'subclass'].includes(item.type);
|
||||
condition: target => {
|
||||
const doc = getDocFromElement(target);
|
||||
return typeof doc.use === 'function';
|
||||
},
|
||||
callback: (button, event) => CharacterSheet.useItem.call(this, event, button)
|
||||
callback: (target, event) => getDocFromElement(target).use(event)
|
||||
},
|
||||
{
|
||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.equip',
|
||||
icon: '<i class="fa-solid fa-hands"></i>',
|
||||
condition: el => {
|
||||
const item = getItem(el);
|
||||
condition: target => {
|
||||
const item = getDocFromElement(target);
|
||||
return ['weapon', 'armor'].includes(item.type) && !item.system.equipped;
|
||||
},
|
||||
callback: CharacterSheet.#toggleEquipItem.bind(this)
|
||||
|
|
@ -269,7 +237,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.unequip',
|
||||
icon: '<i class="fa-solid fa-hands"></i>',
|
||||
condition: el => {
|
||||
const item = getItem(el);
|
||||
const item = getDocFromElement(el);
|
||||
return ['weapon', 'armor'].includes(item.type) && item.system.equipped;
|
||||
},
|
||||
callback: CharacterSheet.#toggleEquipItem.bind(this)
|
||||
|
|
@ -277,51 +245,38 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
{
|
||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.toLoadout',
|
||||
icon: '<i class="fa-solid fa-arrow-up"></i>',
|
||||
condition: el => {
|
||||
const item = getItem(el);
|
||||
condition: target => {
|
||||
const item = getDocFromElement(target);
|
||||
return ['domainCard'].includes(item.type) && item.system.inVault;
|
||||
},
|
||||
callback: target => getItem(target).update({ 'system.inVault': false })
|
||||
callback: target => getDocFromElement(target).update({ 'system.inVault': false })
|
||||
},
|
||||
{
|
||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.toVault',
|
||||
icon: '<i class="fa-solid fa-arrow-down"></i>',
|
||||
condition: el => {
|
||||
const item = getItem(el);
|
||||
condition: target => {
|
||||
const item = getDocFromElement(target);
|
||||
return ['domainCard'].includes(item.type) && !item.system.inVault;
|
||||
},
|
||||
callback: target => getItem(target).update({ 'system.inVault': true })
|
||||
callback: target => getDocFromElement(target).update({ 'system.inVault': true })
|
||||
},
|
||||
{
|
||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.sendToChat',
|
||||
icon: '<i class="fa-regular fa-message"></i>',
|
||||
callback: CharacterSheet.toChat.bind(this)
|
||||
condition: target => {
|
||||
return typeof getDocFromElement(target).toChat === 'function';
|
||||
},
|
||||
callback: (target) => getDocFromElement(target).toChat(this.document.id),
|
||||
},
|
||||
{
|
||||
name: 'CONTROLS.CommonEdit',
|
||||
icon: '<i class="fa-solid fa-pen-to-square"></i>',
|
||||
callback: target => getItem(target).sheet.render({ force: true })
|
||||
callback: target => getDocFromElement(target).sheet.render({ force: true })
|
||||
},
|
||||
{
|
||||
name: 'CONTROLS.CommonDelete',
|
||||
icon: '<i class="fa-solid fa-trash"></i>',
|
||||
callback: async el => {
|
||||
const item = getItem(el);
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||
type: game.i18n.localize(`TYPES.${item.documentName}.${item.type}`),
|
||||
name: item.name
|
||||
})
|
||||
},
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', {
|
||||
name: item.name
|
||||
})
|
||||
});
|
||||
if (!confirmed) return;
|
||||
|
||||
item.delete();
|
||||
}
|
||||
callback: async el => getDocFromElement(el).deleteDialog(),
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
@ -417,7 +372,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.#filteredItems.inventory.search.clear();
|
||||
|
||||
for (const li of html.querySelectorAll('.inventory-item')) {
|
||||
const item = this.document.items.get(li.dataset.itemId);
|
||||
const item = getDocFromElement(li);
|
||||
const matchesSearch = !query || foundry.applications.ux.SearchFilter.testQuery(rgx, item.name);
|
||||
if (matchesSearch) this.#filteredItems.inventory.search.add(item.id);
|
||||
const { menu } = this.#filteredItems.inventory;
|
||||
|
|
@ -437,7 +392,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.#filteredItems.loadout.search.clear();
|
||||
|
||||
for (const li of html.querySelectorAll('.items-list .inventory-item, .card-list .card-item')) {
|
||||
const item = this.document.items.get(li.dataset.itemId);
|
||||
const item = getDocFromElement(li);
|
||||
const matchesSearch = !query || foundry.applications.ux.SearchFilter.testQuery(rgx, item.name);
|
||||
if (matchesSearch) this.#filteredItems.loadout.search.add(item.id);
|
||||
const { menu } = this.#filteredItems.loadout;
|
||||
|
|
@ -488,7 +443,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.#filteredItems.inventory.menu.clear();
|
||||
|
||||
for (const li of html.querySelectorAll('.inventory-item')) {
|
||||
const item = this.document.items.get(li.dataset.itemId);
|
||||
const item = getDocFromElement(li);
|
||||
|
||||
const matchesMenu =
|
||||
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
||||
|
|
@ -509,7 +464,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.#filteredItems.loadout.menu.clear();
|
||||
|
||||
for (const li of html.querySelectorAll('.items-list .inventory-item, .card-list .card-item')) {
|
||||
const item = this.document.items.get(li.dataset.itemId);
|
||||
const item = getDocFromElement(li);
|
||||
|
||||
const matchesMenu =
|
||||
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
||||
|
|
@ -577,13 +532,15 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
this.document.diceRoll(config);
|
||||
}
|
||||
|
||||
//TODO: redo toggleEquipItem method
|
||||
|
||||
|
||||
/**
|
||||
* Toggles the equipped state of an item (armor or weapon).
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #toggleEquipItem(_event, button) {
|
||||
//TODO: redo this
|
||||
const item = this.actor.items.get(button.closest('[data-item-id]')?.dataset.itemId);
|
||||
const item = getDocFromElement(button);
|
||||
if (!item) return;
|
||||
if (item.system.equipped) {
|
||||
await item.update({ 'system.equipped': false });
|
||||
|
|
@ -631,9 +588,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
* Toggles whether an item is stored in the vault.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #toggleVault(event, button) {
|
||||
const docId = button.closest('[data-item-id]')?.dataset.itemId;
|
||||
const doc = this.document.items.get(docId);
|
||||
static async #toggleVault(_event, button) {
|
||||
const doc = getDocFromElement(button)
|
||||
await doc?.update({ 'system.inVault': !doc.system.inVault });
|
||||
}
|
||||
|
||||
|
|
@ -645,61 +601,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
return CONFIG.ux.ContextMenu.triggerContextMenu(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a item
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async useItem(event, button) {
|
||||
const item = this.getItem(button);
|
||||
if (!item) return;
|
||||
|
||||
// Should dandle its actions. Or maybe they'll be separate buttons as per an Issue on the board
|
||||
if (item.type === 'feature') {
|
||||
item.use(event);
|
||||
} else if (item instanceof ActiveEffect) {
|
||||
item.toChat(this);
|
||||
} else {
|
||||
const wasUsed = await item.use(event);
|
||||
if (wasUsed && item.type === 'weapon') {
|
||||
Hooks.callAll(CONFIG.DH.HOOKS.characterAttack, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send item to Chat
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async toChat(event, button) {
|
||||
if (button?.dataset?.type === 'experience') {
|
||||
const experience = this.document.system.experiences[button.dataset.uuid];
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
|
||||
description: `${experience.name} ${experience.total < 0 ? experience.total : `+${experience.total}`}`
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
||||
cls.create(msg.toObject());
|
||||
} else {
|
||||
const item = this.getItem(event);
|
||||
if (!item) return;
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
}
|
||||
|
||||
async _onDragStart(_, event) {
|
||||
super._onDragStart(event);
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
super._onDrop(event);
|
||||
this._onDropItem(event, TextEditor.getDragEventData(event));
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
|
|||
static DEFAULT_OPTIONS = {
|
||||
classes: ['actor', 'companion'],
|
||||
position: { width: 300 },
|
||||
actions: {
|
||||
viewActor: this.viewActor,
|
||||
useItem: this.useItem,
|
||||
toChat: this.toChat
|
||||
}
|
||||
actions: {}
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
|
|
@ -29,52 +25,4 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
|
|||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static async viewActor(_, button) {
|
||||
const target = button.closest('[data-item-uuid]');
|
||||
const actor = await foundry.utils.fromUuid(target.dataset.itemUuid);
|
||||
if (!actor) return;
|
||||
|
||||
actor.sheet.render(true);
|
||||
}
|
||||
|
||||
getAction(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.system.actions.find(x => x.id === itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
static async useItem(event) {
|
||||
const action = this.getAction(event) ?? this.actor.system.attack;
|
||||
action.use(event);
|
||||
}
|
||||
|
||||
static async toChat(event, button) {
|
||||
if (button?.dataset?.type === 'experience') {
|
||||
const experience = this.document.system.experiences[button.dataset.uuid];
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
|
||||
description: `${experience.name} ${experience.total < 0 ? experience.total : `+${experience.total}`}`
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
|
||||
cls.create(msg.toObject());
|
||||
} else {
|
||||
const item = this.getAction(event) ?? this.document.system.attack;
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
position: {
|
||||
width: 500
|
||||
},
|
||||
actions: {
|
||||
useItem: this.useItem,
|
||||
toChat: this.toChat
|
||||
},
|
||||
actions: {},
|
||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||
};
|
||||
|
||||
|
|
@ -76,45 +73,6 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
getItem(element) {
|
||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
||||
item = this.document.items.get(itemId);
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
async viewAdversary(_, button) {
|
||||
const target = button.closest('[data-item-uuid]');
|
||||
const adversary = await foundry.utils.fromUuid(target.dataset.itemUuid);
|
||||
if (!adversary) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.adversaryMissing'));
|
||||
return;
|
||||
}
|
||||
|
||||
adversary.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static async useItem(event, button) {
|
||||
const action = this.getItem(event);
|
||||
if (!action) {
|
||||
await this.viewAdversary(event, button);
|
||||
} else {
|
||||
action.use(event);
|
||||
}
|
||||
}
|
||||
|
||||
static async toChat(event) {
|
||||
const item = this.getItem(event);
|
||||
item.toChat(this.document.id);
|
||||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
const item = event.currentTarget.closest('.inventory-item');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
import { tagifyElement } from '../../../helpers/utils.mjs';
|
||||
import { getDocFromElement, tagifyElement } from '../../../helpers/utils.mjs';
|
||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||
|
||||
/**
|
||||
* @typedef {import('@client/applications/_types.mjs').ApplicationClickAction}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} DragDropConfig
|
||||
|
|
@ -73,7 +78,9 @@ export default function DHApplicationMixin(Base) {
|
|||
actions: {
|
||||
createDoc: DHSheetV2.#createDoc,
|
||||
editDoc: DHSheetV2.#editDoc,
|
||||
deleteDoc: DHSheetV2.#deleteDoc
|
||||
deleteDoc: DHSheetV2.#deleteDoc,
|
||||
toChat: DHSheetV2.#toChat,
|
||||
useItem: DHSheetV2.#useItem,
|
||||
},
|
||||
contextMenus: [],
|
||||
dragDrop: [],
|
||||
|
|
@ -162,14 +169,14 @@ export default function DHApplicationMixin(Base) {
|
|||
* @param {DragEvent} event
|
||||
* @protected
|
||||
*/
|
||||
_onDragStart(event) {}
|
||||
_onDragStart(event) { }
|
||||
|
||||
/**
|
||||
* Handle drop event.
|
||||
* @param {DragEvent} event
|
||||
* @protected
|
||||
*/
|
||||
_onDrop(event) {}
|
||||
_onDrop(event) { }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Context Menu */
|
||||
|
|
@ -213,11 +220,10 @@ export default function DHApplicationMixin(Base) {
|
|||
|
||||
/**
|
||||
* Create an embedded document.
|
||||
* @param {PointerEvent} event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #createDoc(event, button) {
|
||||
const { documentClass, type } = button.dataset;
|
||||
static async #createDoc(event, target) {
|
||||
const { documentClass, type } = target.dataset;
|
||||
const parent = this.document;
|
||||
|
||||
const cls = getDocumentClass(documentClass);
|
||||
|
|
@ -234,39 +240,83 @@ export default function DHApplicationMixin(Base) {
|
|||
|
||||
/**
|
||||
* Renders an embedded document.
|
||||
* @param {PointerEvent} event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static #editDoc(_event, button) {
|
||||
const { type, docId } = button.dataset;
|
||||
this.document.getEmbeddedDocument(type, docId, { strict: true }).sheet.render({ force: true });
|
||||
static #editDoc(_event, target) {
|
||||
const doc = getDocFromElement(target);
|
||||
|
||||
// TODO: REDO this
|
||||
if (doc) return doc.sheet.render({ force: true });
|
||||
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||
const { actions, attack } = this.document.system;
|
||||
const action = attack.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||
new DHActionConfig(action).render({ force: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an embedded document.
|
||||
* @param {PointerEvent} _event - The originating click event
|
||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #deleteDoc(_event, button) {
|
||||
const { type, docId } = button.dataset;
|
||||
const document = this.document.getEmbeddedDocument(type, docId, { strict: true });
|
||||
const typeName = game.i18n.localize(
|
||||
document.type === 'base' ? `DOCUMENT.${type}` : `TYPES.${type}.${document.type}`
|
||||
);
|
||||
static async #deleteDoc(_event, target) {
|
||||
const doc = getDocFromElement(target);
|
||||
|
||||
// TODO: REDO this
|
||||
if (doc) return await doc.deleteDialog()
|
||||
|
||||
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||
const { actions, attack } = this.document.system;
|
||||
if (attack.id === actionId) return;
|
||||
const action = actions.find(a => a.id === actionId);
|
||||
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||
type: typeName,
|
||||
name: document.name
|
||||
type: game.i18n.localize(`DAGGERHEART.GENERAL.Action.single`),
|
||||
name: action.name
|
||||
})
|
||||
},
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: document.name })
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: action.name })
|
||||
});
|
||||
if (!confirmed) return;
|
||||
|
||||
await document.delete();
|
||||
return await this.document.update({
|
||||
'system.actions': actions.filter((a) => a.id !== action.id)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send item to Chat
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #toChat(_event, target) {
|
||||
let doc = getDocFromElement(target);
|
||||
|
||||
// TODO: REDO this
|
||||
if (!doc) {
|
||||
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||
const { actions, attack } = this.document.system;
|
||||
doc = attack.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||
}
|
||||
return doc.toChat(this.document.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a item
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #useItem(event, target) {
|
||||
let doc = getDocFromElement(target);
|
||||
|
||||
// TODO: REDO this
|
||||
if (!doc) {
|
||||
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||
const { actions, attack } = this.document.system;
|
||||
doc = attack.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||
}
|
||||
|
||||
await doc.use(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return DHSheetV2;
|
||||
|
|
|
|||
|
|
@ -21,11 +21,14 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
submitOnChange: true
|
||||
},
|
||||
actions: {
|
||||
openSettings: DHBaseActorSheet.#openSettings
|
||||
openSettings: DHBaseActorSheet.#openSettings,
|
||||
sendExpToChat: DHBaseActorSheet.#sendExpToChat,
|
||||
},
|
||||
dragDrop: []
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@type {typeof DHBaseActorSettings}*/
|
||||
#settingSheet;
|
||||
|
||||
|
|
@ -35,6 +38,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 +49,41 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Application Clicks Actions */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Open the Actor Setting Sheet
|
||||
* @type {ApplicationClickAction}
|
||||
|
|
@ -49,4 +91,27 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
static async #openSettings() {
|
||||
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.total < 0 ? experience.total : `+${experience.total}`}`
|
||||
};
|
||||
|
||||
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
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,3 +314,15 @@ export const updateActorTokens = async (actor, update) => {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves a Foundry document associated with the nearest ancestor element
|
||||
* that has a `data-item-uuid` attribute.
|
||||
* @param {HTMLElement} element - The DOM element to start the search from.
|
||||
* @returns {foundry.abstract.Document|null} The resolved document, or null if not found or invalid.
|
||||
*/
|
||||
export function getDocFromElement(element) {
|
||||
const target = element.closest('[data-item-uuid]');
|
||||
return foundry.utils.fromUuidSync(target.dataset.itemUuid) ?? null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
export const preloadHandlebarsTemplates = async function () {
|
||||
foundry.applications.handlebars.loadTemplates({
|
||||
'daggerheart.inventory-items': 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs',
|
||||
'daggerheart.inventory-item': 'systems/daggerheart/templates/sheets/global/partials/inventory-item-V2.hbs',
|
||||
})
|
||||
return foundry.applications.handlebars.loadTemplates([
|
||||
'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs',
|
||||
'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs',
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
<span>{{feature.name}}</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<a data-action="editDoc" data-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
<a data-action="deleteDoc" data-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></i></a>
|
||||
<a data-action="editDoc" data-item-uuid="{{feature.uuid}}" data-tooltip="{{localize 'DAGGERHEART.CommonEdit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
<a data-action="deleteDoc" data-item-uuid="{{feature.uuid}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,27 @@
|
|||
<section
|
||||
class='tab {{tabs.adversaries.cssClass}} {{tabs.adversaries.id}}'
|
||||
data-tab='{{tabs.adversaries.id}}'
|
||||
data-group='{{tabs.adversaries.group}}'
|
||||
>
|
||||
<section class='tab {{tabs.adversaries.cssClass}} {{tabs.adversaries.id}}' data-tab='{{tabs.adversaries.id}}'
|
||||
data-group='{{tabs.adversaries.group}}'>
|
||||
<button type="button" class="add-action-btn" data-action="addCategory">
|
||||
New Category
|
||||
</button>
|
||||
{{#each document.system.potentialAdversaries as |category id|}}
|
||||
<fieldset class="category-container" data-potential-adversary="{{id}}">
|
||||
{{#each document.system.potentialAdversaries as |category categoryId|}}
|
||||
<fieldset class="category-container" data-potential-adversary="{{categoryId}}">
|
||||
<legend>{{category.label}}</legend>
|
||||
<div class="category-name">
|
||||
<input type="text" name="{{concat "system.potentialAdversaries." @key ".label" }}" value="{{category.label}}" />
|
||||
<a data-action="removeCategory" data-category-id={{id}} data-tooltip='{{localize "CONTROLS.CommonDelete"}}'>
|
||||
<input type="text" name="system.potentialAdversaries.{{categoryId}}.label"
|
||||
value="{{category.label}}" />
|
||||
<a data-action="removeCategory" data-category-id={{categoryId}} data-tooltip='{{localize "CONTROLS.CommonDelete"}}'>
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="adversaries-container">
|
||||
{{#each category.adversaries as |adversary|}}
|
||||
<div class="adversary-container">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' isActor=true categoryAdversary=@../key}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=adversary
|
||||
type='adversary'
|
||||
isActor=true
|
||||
categoryAdversary=categoryId
|
||||
}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
<span>{{feature.name}}</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<a data-action="editDoc" data-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
<a data-action="deleteDoc" data-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></i></a>
|
||||
<a data-action="editDoc" data-doc-uuid="{{feature.uuid}}" data-tooltip="{{localize 'CONTROLS.CommonEdit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
<a data-action="deleteDoc" data-item-uuid="{{feature.uuid}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
<section
|
||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
||||
data-tab='{{tabs.effects.id}}'
|
||||
data-group='{{tabs.effects.group}}'
|
||||
>
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
||||
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||
data-group='{{tabs.effects.group}}'>
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.activeEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.actives
|
||||
}}
|
||||
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.inactives
|
||||
}}
|
||||
</section>
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
<section
|
||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
||||
data-tab='{{tabs.features.id}}'
|
||||
data-group='{{tabs.features.group}}'
|
||||
>
|
||||
<section class='tab {{tabs.features.cssClass}} {{tabs.features.id}}' data-tab='{{tabs.features.id}}'
|
||||
data-group='{{tabs.features.group}}'>
|
||||
<div class="feature-section">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.features.label) type='feature' values=document.system.features hideControls=true}}
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title=tabs.features.label
|
||||
type='feature'
|
||||
collection=document.system.features
|
||||
hideControls=true
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
>
|
||||
<fieldset class="fit-height">
|
||||
<legend>{{localize tabs.notes.label}}</legend>
|
||||
{{log notes}}
|
||||
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
||||
</fieldset>
|
||||
</section>
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
<aside class="adversary-sidebar-sheet">
|
||||
<div class="portrait {{#if (gte source.system.resources.hitPoints.value source.system.resources.hitPoints.maxTotal)}}death-roll{{/if}}">
|
||||
<div
|
||||
class="portrait {{#if (gte source.system.resources.hitPoints.value source.system.resources.hitPoints.maxTotal)}}death-roll{{/if}}">
|
||||
<img src="{{source.img}}" alt="{{source.name}}" data-action='editImage' data-edit="img">
|
||||
<a class="death-roll-btn" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.makeDeathMove"}}" data-action="makeDeathMove"><i class="fas fa-skull death-save" ></i></a>
|
||||
<a class="death-roll-btn" data-tooltip="{{localize " DAGGERHEART.UI.Tooltip.makeDeathMove"}}"
|
||||
data-action="makeDeathMove"><i class="fas fa-skull death-save"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="info-section">
|
||||
<div class="resources-section">
|
||||
<div class="status-bar">
|
||||
<div class='status-value'>
|
||||
<p><input class="bar-input" name="system.resources.hitPoints.value" value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
||||
<p><input class="bar-input" name="system.resources.hitPoints.value"
|
||||
value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
||||
<p>/</p>
|
||||
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar'
|
||||
value='{{source.system.resources.hitPoints.value}}'
|
||||
max='{{source.system.resources.hitPoints.max}}'
|
||||
></progress>
|
||||
<progress class='progress-bar' value='{{source.system.resources.hitPoints.value}}'
|
||||
max='{{source.system.resources.hitPoints.max}}'></progress>
|
||||
<div class="status-label">
|
||||
<h4>HP</h4>
|
||||
</div>
|
||||
|
|
@ -24,15 +24,13 @@
|
|||
</div>
|
||||
<div class="status-bar">
|
||||
<div class='status-value'>
|
||||
<p><input class="bar-input" name="system.resources.stress.value" value="{{source.system.resources.stress.value}}" type="number"></p>
|
||||
<p><input class="bar-input" name="system.resources.stress.value"
|
||||
value="{{source.system.resources.stress.value}}" type="number"></p>
|
||||
<p>/</p>
|
||||
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar stress-color'
|
||||
value='{{source.system.resources.stress.value}}'
|
||||
max='{{source.system.resources.stress.max}}'
|
||||
></progress>
|
||||
<progress class='progress-bar stress-color' value='{{source.system.resources.stress.value}}'
|
||||
max='{{source.system.resources.stress.max}}'></progress>
|
||||
<div class="status-label">
|
||||
<h4>Stress</h4>
|
||||
</div>
|
||||
|
|
@ -81,7 +79,13 @@
|
|||
<side-line-div></side-line-div>
|
||||
</div>
|
||||
<ul class="items-sidebar-list">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=source.system.attack type=source.system.attack.systemPath isSidebar=true}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=document.system.attack
|
||||
type='action'
|
||||
showLabels=true
|
||||
hideDescription=true
|
||||
hideTooltip=true
|
||||
}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="experience-section">
|
||||
|
|
@ -98,7 +102,9 @@
|
|||
</div>
|
||||
<span class="experience-name">{{experience.name}}</span>
|
||||
<div class="controls">
|
||||
<a data-action="toChat" data-type="experience" data-uuid="{{id}}"><i class="fa-regular fa-message"></i></a>
|
||||
<a data-action="sendExpToChat" data-id="{{id}}">
|
||||
<i class="fa-regular fa-message"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
<section
|
||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
||||
data-tab='{{tabs.effects.id}}'
|
||||
data-group='{{tabs.effects.group}}'
|
||||
>
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
||||
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||
data-group='{{tabs.effects.group}}'>
|
||||
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.activeEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.actives
|
||||
}}
|
||||
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.inactives
|
||||
}}
|
||||
</section>
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
<section
|
||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
||||
data-tab='{{tabs.features.id}}'
|
||||
data-group='{{tabs.features.group}}'
|
||||
>
|
||||
<section class='tab {{tabs.features.cssClass}} {{tabs.features.id}}' data-tab='{{tabs.features.id}}'
|
||||
data-group='{{tabs.features.group}}'>
|
||||
<div class="features-sections">
|
||||
{{#each document.system.sheetLists}}
|
||||
{{#if this.values}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=this.title values=this.values}}
|
||||
{{#each document.system.sheetLists as |category|}}
|
||||
{{#if category.values}}
|
||||
|
||||
{{> 'daggerheart.inventory-items'
|
||||
isGlassy=true
|
||||
title=category.title
|
||||
type='feature'
|
||||
collection=category.values
|
||||
}}
|
||||
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,25 +29,25 @@
|
|||
<div class="character-details">
|
||||
<div>
|
||||
{{#if document.system.class.value}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.class.value.id}}">{{document.system.class.value.name}}</span>
|
||||
<span data-action="editDoc" data-item-uuid="{{document.system.class.value.uuid}}">{{document.system.class.value.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'TYPES.Item.class'}}</span>
|
||||
{{/if}}
|
||||
<span class="dot">•</span>
|
||||
{{#if document.system.class.subclass}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.class.subclass.id}}">{{document.system.class.subclass.name}}</span>
|
||||
<span data-action="editDoc" data-item-uuid="{{document.system.class.subclass.uuid}}">{{document.system.class.subclass.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
||||
{{/if}}
|
||||
<span class="dot">•</span>
|
||||
{{#if document.system.community}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.community.id}}">{{document.system.community.name}}</span>
|
||||
<span data-action="editDoc" data-item-uuid="{{document.system.community.uuid}}">{{document.system.community.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.community">{{localize 'TYPES.Item.community'}}</span>
|
||||
{{/if}}
|
||||
<span class="dot">•</span>
|
||||
{{#if document.system.ancestry}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.ancestry.id}}">{{document.system.ancestry.name}}</span>
|
||||
<span data-action="editDoc" data-item-uuid="{{document.system.ancestry.uuid}}">{{document.system.ancestry.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.ancestry">{{localize 'TYPES.Item.ancestry'}}</span>
|
||||
{{/if}}
|
||||
|
|
@ -56,13 +56,13 @@
|
|||
{{#if document.system.multiclass.value}}
|
||||
<div class="multiclass">
|
||||
{{#if document.system.multiclass.value}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.multiclass.value.id}}">{{document.system.multiclass.value.name}}</span>
|
||||
<span data-action="editDoc"data-item-uuid="{{document.system.multiclass.value.uuid}}">{{document.system.multiclass.value.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'DAGGERHEART.GENERAL.multiclass'}}</span>
|
||||
{{/if}}
|
||||
<span class="dot">•</span>
|
||||
{{#if document.system.multiclass.subclass}}
|
||||
<span data-action="editDoc" data-type="Item" data-doc-id="{{document.system.multiclass.subclass.id}}">{{document.system.multiclass.subclass.name}}</span>
|
||||
<span data-action="editDoc" data-item-uuid="{{document.system.multiclass.subclass.uuid}}">{{document.system.multiclass.subclass.name}}</span>
|
||||
{{else}}
|
||||
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -16,28 +16,44 @@
|
|||
</div>
|
||||
|
||||
<div class="items-section">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.weapon') type='weapon' isGlassy=true}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.armor') type='armor' isGlassy=true}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.consumable') type='consumable' isGlassy=true}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.miscellaneous') type='miscellaneous' isGlassy=true}}
|
||||
{{> 'daggerheart.inventory-items' title='TYPES.Item.weapon'
|
||||
type='weapon'
|
||||
collection=document.itemTypes.weapon
|
||||
isGlassy=true}}
|
||||
{{> 'daggerheart.inventory-items' title='TYPES.Item.armor'
|
||||
type='armor'
|
||||
collection=document.itemTypes.armor
|
||||
isGlassy=true}}
|
||||
{{> 'daggerheart.inventory-items' title='TYPES.Item.consumable'
|
||||
type='consumable'
|
||||
collection=document.itemTypes.consumable
|
||||
isGlassy=true}}
|
||||
{{> 'daggerheart.inventory-items' title='TYPES.Item.miscellaneous'
|
||||
type='miscellaneous'
|
||||
collection=document.itemTypes.miscellaneous
|
||||
isGlassy=true}}
|
||||
</div>
|
||||
|
||||
<div class="currency-section">
|
||||
<div class="input">
|
||||
<span>{{localize this.inventory.currency.coins}}</span>
|
||||
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins localize=true toggled=true}}
|
||||
{{formInput systemFields.gold.fields.coins value=source.system.gold.coins enriched=source.system.gold.coins
|
||||
localize=true toggled=true}}
|
||||
</div>
|
||||
<div class="input">
|
||||
<span>{{localize this.inventory.currency.handfulls}}</span>
|
||||
{{formInput systemFields.gold.fields.handfulls value=source.system.gold.handfulls enriched=source.system.gold.handfulls localize=true toggled=true}}
|
||||
{{formInput systemFields.gold.fields.handfulls value=source.system.gold.handfulls
|
||||
enriched=source.system.gold.handfulls localize=true toggled=true}}
|
||||
</div>
|
||||
<div class="input">
|
||||
<span>{{localize this.inventory.currency.bags}}</span>
|
||||
{{formInput systemFields.gold.fields.bags value=source.system.gold.bags enriched=source.system.gold.bags localize=true toggled=true}}
|
||||
{{formInput systemFields.gold.fields.bags value=source.system.gold.bags enriched=source.system.gold.bags
|
||||
localize=true toggled=true}}
|
||||
</div>
|
||||
<div class="input">
|
||||
<span>{{localize this.inventory.currency.chests}}</span>
|
||||
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests enriched=source.system.gold.chests localize=true toggled=true}}
|
||||
{{formInput systemFields.gold.fields.chests value=source.system.gold.chests
|
||||
enriched=source.system.gold.chests localize=true toggled=true}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,28 +10,31 @@
|
|||
<a class="filter-button">
|
||||
<i class="fa-solid fa-filter"></i>
|
||||
</a>
|
||||
<button type="button" class="btn-toggle-view" data-action="toggleLoadoutView" data-value="{{listView}}">
|
||||
<span class="{{ifThen listView 'list-active' ''}} list-icon">
|
||||
<button type="button" class="btn-toggle-view" data-action="toggleLoadoutView" data-value="{{not cardView}}">
|
||||
<span class="{{ifThen cardView '' 'list-active'}} list-icon">
|
||||
<i class="fa-solid fa-bars"></i>
|
||||
</span>
|
||||
<span class="{{ifThen listView '' 'grid-active'}} grid-icon">
|
||||
<span class="{{ifThen cardView 'grid-active' ''}} grid-icon">
|
||||
<i class="fa-solid fa-grip"></i>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="items-section">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs'
|
||||
title=(localize 'DAGGERHEART.GENERAL.Tabs.loadout')
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.Tabs.loadout'
|
||||
type='domainCard'
|
||||
isGlassy=true
|
||||
cardView=(ifThen listView "list" "card")}}
|
||||
cardView=cardView
|
||||
collection=document.system.domainCards.loadout
|
||||
}}
|
||||
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs'
|
||||
title=(localize 'DAGGERHEART.GENERAL.Tabs.vault')
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.Tabs.vault'
|
||||
type='domainCard'
|
||||
isVault=true
|
||||
isGlassy=true
|
||||
cardView=(ifThen listView "list" "card")}}
|
||||
cardView=cardView
|
||||
collection=document.system.domainCards.vault
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -1,22 +1,21 @@
|
|||
<aside class="character-sidebar-sheet">
|
||||
<div class="portrait {{#if isDeath}}death-roll{{/if}}">
|
||||
<img src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<a class="death-roll-btn" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.makeDeathMove"}}" {{#if isDeath}}data-action="makeDeathMove"{{/if}}><i class="fas fa-skull death-save" ></i></a>
|
||||
<a class="death-roll-btn" data-tooltip="DAGGERHEART.UI.Tooltip.makeDeathMove" {{#if
|
||||
isDeath}}data-action="makeDeathMove" {{/if}}><i class="fas fa-skull death-save"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="info-section">
|
||||
<div class="resources-section">
|
||||
<div class="status-bar">
|
||||
<div class='status-value'>
|
||||
<p><input class="bar-input" name="system.resources.hitPoints.value" value="{{document.system.resources.hitPoints.value}}" type="number"></p>
|
||||
<p><input class="bar-input" name="system.resources.hitPoints.value"
|
||||
value="{{document.system.resources.hitPoints.value}}" type="number"></p>
|
||||
<p>/</p>
|
||||
<p class="bar-label">{{document.system.resources.hitPoints.maxTotal}}</p>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar'
|
||||
value='{{document.system.resources.hitPoints.value}}'
|
||||
max='{{document.system.resources.hitPoints.maxTotal}}'
|
||||
></progress>
|
||||
<progress class='progress-bar' value='{{document.system.resources.hitPoints.value}}'
|
||||
max='{{document.system.resources.hitPoints.maxTotal}}'></progress>
|
||||
<div class="status-label">
|
||||
<h4>HP</h4>
|
||||
</div>
|
||||
|
|
@ -24,15 +23,13 @@
|
|||
</div>
|
||||
<div class="status-bar">
|
||||
<div class='status-value'>
|
||||
<p><input class="bar-input" name="system.resources.stress.value" value="{{document.system.resources.stress.value}}" type="number"></p>
|
||||
<p><input class="bar-input" name="system.resources.stress.value"
|
||||
value="{{document.system.resources.stress.value}}" type="number"></p>
|
||||
<p>/</p>
|
||||
<p class="bar-label">{{document.system.resources.stress.maxTotal}}</p>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar stress-color'
|
||||
value='{{document.system.resources.stress.value}}'
|
||||
max='{{document.system.resources.stress.maxTotal}}'
|
||||
></progress>
|
||||
<progress class='progress-bar stress-color' value='{{document.system.resources.stress.value}}'
|
||||
max='{{document.system.resources.stress.maxTotal}}'></progress>
|
||||
<div class="status-label">
|
||||
<h4>Stress</h4>
|
||||
</div>
|
||||
|
|
@ -80,7 +77,12 @@
|
|||
<ul class="items-sidebar-list">
|
||||
{{#each document.items as |item|}}
|
||||
{{#if item.system.equipped}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=item.type isSidebar=true}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=item
|
||||
type=item.type
|
||||
showLabels=true
|
||||
hideDescription=true
|
||||
}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
|
@ -92,12 +94,14 @@
|
|||
<side-line-div></side-line-div>
|
||||
</div>
|
||||
<ul class="items-sidebar-list">
|
||||
{{#each document.items as |item|}}
|
||||
{{#if (eq item.type 'domainCard')}}
|
||||
{{#unless item.system.inVault}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=item.type isSidebar=true}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{#each document.system.domainCards.loadout as |card|}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=card
|
||||
type='domainCard'
|
||||
showLabels=true
|
||||
hideDescription=true
|
||||
}}
|
||||
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -113,9 +117,12 @@
|
|||
<div class="experience-value">
|
||||
+{{experience.total}}
|
||||
</div>
|
||||
<input name="{{concat "system.experiences." id ".name"}}" data-experience={{id}} value="{{experience.name}}" type="text" />
|
||||
<input name="system.experiences.{{id}}.name" data-experience={{id}}
|
||||
value="{{experience.name}}" type="text" />
|
||||
<div class="controls">
|
||||
<a data-action="toChat" data-type="experience" data-uuid="{{id}}"><i class="fa-regular fa-message"></i></a>
|
||||
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
|
||||
<i class="fa-regular fa-message"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
<section
|
||||
class='tab {{tabs.details.cssClass}} {{tabs.details.id}}'
|
||||
data-tab='{{tabs.details.id}}'
|
||||
data-group='{{tabs.details.group}}'
|
||||
>
|
||||
<section class='tab {{tabs.details.cssClass}} {{tabs.details.id}}' data-tab='{{tabs.details.id}}'
|
||||
data-group='{{tabs.details.group}}'>
|
||||
<div class="partner-section">
|
||||
<div class="title">
|
||||
<side-line-div class="invert"></side-line-div>
|
||||
|
|
@ -11,7 +8,14 @@
|
|||
</div>
|
||||
{{#if document.system.partner}}
|
||||
<ul class="item-list">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=document.system.partner type='actor' isSidebar=true isActor=true noTooltip=true}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=document.system.partner
|
||||
type='companion'
|
||||
showLabels=true
|
||||
hideDescription=true
|
||||
isActor=true
|
||||
hideTooltip=true
|
||||
}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<span class="partner-placeholder">{{localize "DAGGERHEART.ACTORS.Companion.noPartner"}}</span>
|
||||
|
|
@ -24,7 +28,13 @@
|
|||
<side-line-div></side-line-div>
|
||||
</div>
|
||||
<ul class="item-list">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=source.system.attack type=source.system.attack.systemPath isSidebar=true isCompanion=true noTooltip=true}}
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=document.system.attack
|
||||
type='action'
|
||||
showLabels=true
|
||||
hideDescription=true
|
||||
hideTooltip=true
|
||||
}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="experience-list">
|
||||
|
|
@ -35,7 +45,8 @@
|
|||
</div>
|
||||
<span class="experience-name">{{experience.name}}</span>
|
||||
<div class="controls">
|
||||
<a data-action="toChat" data-type="experience" data-uuid="{{id}}"><i class="fa-regular fa-message"></i></a>
|
||||
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
|
||||
<i class="fa-regular fa-message"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,17 @@
|
|||
data-tab='{{tabs.effects.id}}'
|
||||
data-group='{{tabs.effects.group}}'
|
||||
>
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.activeEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.actives
|
||||
}}
|
||||
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||
type='effect'
|
||||
isGlassy=true
|
||||
collection=effects.inactives
|
||||
}}
|
||||
</section>
|
||||
|
|
@ -4,6 +4,11 @@
|
|||
data-group='{{tabs.features.group}}'
|
||||
>
|
||||
<div class="feature-section">
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.features.label) type='feature' values=document.system.features hideControls=true }}
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title=tabs.features.label
|
||||
type='feature'
|
||||
collection=document.system.features
|
||||
hideControls=true
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -4,8 +4,16 @@
|
|||
data-group='{{tabs.potentialAdversaries.group}}'
|
||||
>
|
||||
<div class="action-section">
|
||||
{{#each document.system.potentialAdversaries}}
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=this.label type='adversary' isGlassy=true adversaries=this.adversaries}}
|
||||
{{#each document.system.potentialAdversaries as |category categoryId|}}
|
||||
{{> 'daggerheart.inventory-items'
|
||||
title=category.label
|
||||
type='adversary'
|
||||
isGlassy=true
|
||||
isActor=true
|
||||
categoryAdversary=categoryId
|
||||
hideControls=true
|
||||
collection=category.adversaries
|
||||
}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
{{!--
|
||||
Inventory/Domain Card Section
|
||||
|
||||
{{> 'daggerheart.inventory-items' }}
|
||||
|
||||
Parameters:
|
||||
- title {string} : Localization key used for the legend.
|
||||
- collection {array} : Array of items to render.
|
||||
- type {string} : The type of items in the list:
|
||||
- isGlassy {boolean} : If true, applies the 'glassy' class to the fieldset.
|
||||
- cardView {boolean} : If true and type is 'domainCard', renders using domain card layout.
|
||||
- isActor {boolean} : Passed through to inventory-item partials.
|
||||
- canCreate {boolean} : If true, show createDoc anchor on legend
|
||||
- categoryAdversary {string} : Category adversary id.
|
||||
- showLabels {boolean} : If true, show label-tags else show simple tags.
|
||||
- hideTooltip {boolean} : If true, disables the tooltip on the item image.
|
||||
- hideControls {boolean} : If true, hides the controls inside inventory-item partials.
|
||||
- hideDescription {boolean} : If true, hides the item's description.
|
||||
--}}
|
||||
|
||||
<fieldset class="{{#if isGlassy}}glassy{{/if}}">
|
||||
<legend>
|
||||
{{localize title}}
|
||||
{{#if canCreate}}
|
||||
<a data-action="createDoc" data-type="{{type}}">
|
||||
<i class="fa-solid fa-plus icon-button"></i>
|
||||
</a>
|
||||
{{/if }}
|
||||
</legend>
|
||||
{{#if (and cardView (eq type 'domainCard'))}}
|
||||
<ul class="card-list">
|
||||
{{#each collection as |item|}}
|
||||
|
||||
{{> 'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs'
|
||||
item=item
|
||||
type=../type
|
||||
}}
|
||||
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<ul class="items-list">
|
||||
{{#each collection as |item|}}
|
||||
|
||||
{{> 'daggerheart.inventory-item'
|
||||
item=item
|
||||
type=../type
|
||||
hideControls=../hideControls
|
||||
isActor=../isActor
|
||||
categoryAdversary=../categoryAdversary
|
||||
hideTooltip=../hideTooltip
|
||||
showLabels=../showLabels
|
||||
isAction=../isAction
|
||||
}}
|
||||
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</fieldset>
|
||||
183
templates/sheets/global/partials/inventory-item-V2.hbs
Normal file
183
templates/sheets/global/partials/inventory-item-V2.hbs
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
{{!--
|
||||
{{> 'daggerheart.inventory-item' }}
|
||||
|
||||
Parameters:
|
||||
- type {string} : The type of items in the list
|
||||
- isActor {boolean} : Passed through to inventory-item partials.
|
||||
- categoryAdversary {string} : Category adversary id.
|
||||
- hideLabels {boolean} : If true, hide label-tags else show label-tags.
|
||||
- hideTags {boolean} : If true, hide simple-tags else show simple-tags.
|
||||
- hideTooltip {boolean} : If true, disables the tooltip on the item image.
|
||||
- hideControls {boolean} : If true, hides the controls inside inventory-item partials.
|
||||
- hideDescription {boolean} : If true, hides the item's description.
|
||||
--}}
|
||||
|
||||
<li class="inventory-item" {{#if (eq type 'action' ) }}data-action-id="{{item.id}}" {{/if}}
|
||||
data-item-uuid="{{item.uuid}}">
|
||||
{{!-- Image --}}
|
||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}"
|
||||
{{!-- I had to use the {{not}} helper because otherwise the function is called when rendering --}}
|
||||
data-action="{{ifThen (not item.use) (ifThen (not item.toChat) 'editDoc' 'toChat') 'useItem' }}" {{#unless
|
||||
hideTooltip}}data-tooltip="#item#{{item.uuid}}" {{/unless}} />
|
||||
|
||||
{{!-- Name & Tags --}}
|
||||
<div class="item-label">
|
||||
{{!-- Item Name --}}
|
||||
<div class="item-name">{{item.name}}</div>
|
||||
|
||||
{{!-- Weapon Block Start --}}
|
||||
{{#if (eq type 'weapon')}}
|
||||
{{#if (not hideTags)}}
|
||||
<div class="item-tags"></div>
|
||||
{{else if (not hideLabels)}}
|
||||
<div class="item-labels">
|
||||
<div class="label">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
|
||||
<span> - </span>
|
||||
{{item.system.attack.damage.parts.0.value.dice}}
|
||||
{{#if item.system.attack.damage.parts.0.value.bonus}} +
|
||||
{{item.system.attack.damage.parts.0.value.bonus}}
|
||||
{{/if}}
|
||||
{{#with (lookup @root.config.GENERAL.damageTypes item.system.attack.damage.parts.0.type)}}
|
||||
{{#each icon}}<i class="fa-solid {{this}}"></i>{{/each}}
|
||||
{{/with}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{!-- Weapon Block End --}}
|
||||
|
||||
{{!-- Armor Block Start --}}
|
||||
{{#if (eq type 'armor')}}
|
||||
{{#if (not hideTags)}}
|
||||
<div class="item-tags">
|
||||
<div class="tag">{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}: {{item.system.baseScore}}</div>
|
||||
<div class="tag">
|
||||
{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}:
|
||||
{{item.system.baseThresholds.major}} / {{item.system.baseThresholds.severe}}
|
||||
</div>
|
||||
</div>
|
||||
{{else if (not hideLabels)}}
|
||||
<div class="item-labels">
|
||||
<div class="label">
|
||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}: {{item.system.baseScore}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{!-- Armor Block End --}}
|
||||
|
||||
{{!-- Domain Card Block Start --}}
|
||||
{{#if (eq type 'domainCard')}}
|
||||
{{#if (not hideTags)}}
|
||||
<div class="item-tags">
|
||||
<div class="tag">{{localize (concat 'DAGGERHEART.CONFIG.DomainCardTypes.' item.system.type)}}</div>
|
||||
<div class="tag">{{localize (concat 'DAGGERHEART.GENERAL.Domain.' item.system.domain '.label')}}</div>
|
||||
<div class="tag">
|
||||
<span class="recall-label">{{localize "DAGGERHEART.ITEMS.DomainCard.recallCost"}}: </span>
|
||||
<span class="recall-value">{{item.system.recallCost}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{else if (not hideLabels)}}
|
||||
<div class="item-labels">
|
||||
<div class="label">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.DomainCardTypes.' item.system.type)}} -
|
||||
{{localize (concat 'DAGGERHEART.GENERAL.Domain.' item.system.domain '.label')}} -
|
||||
<span class="recall-value">{{item.system.recallCost}}</span>
|
||||
<i class="fa-solid fa-bolt"></i>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{!-- Domain Card Block End --}}
|
||||
|
||||
{{!-- Effect Block Start --}}
|
||||
{{#if (eq type 'effect')}}
|
||||
{{#if (not hideTags)}}
|
||||
<div class="item-tags">
|
||||
<div class="tag">
|
||||
{{localize item.parent.system.metadata.label}}: {{item.parent.name}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{#if item.duration.duration}}
|
||||
{{localize 'DAGGERHEART.EFFECTS.Duration.temporary'}}
|
||||
{{else}}
|
||||
{{localize 'DAGGERHEART.EFFECTS.Duration.passive'}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#each item.statuses as |status|}}
|
||||
<div class="tag">{{localize (concat 'DAGGERHEART.CONFIG.Condition.' status '.name')}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{else if (not hideLabels)}}
|
||||
{{!-- Empty --}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{!-- Effect Block End --}}
|
||||
|
||||
{{!-- Action Block Start --}}
|
||||
{{#if (eq type 'action')}}
|
||||
{{#if (not hideTags)}}
|
||||
<div class="item-tags">
|
||||
<div class="tag">{{localize (concat 'DAGGERHEART.ACTIONS.TYPES.' item.type '.name')}}</div>
|
||||
<div class="tag">{{localize (concat 'DAGGERHEART.CONFIG.ActionType.' item.actionType)}}</div>
|
||||
</div>
|
||||
{{else if (not hideLabels)}}
|
||||
{{!-- Empty --}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{!-- Action Block End --}}
|
||||
</div>
|
||||
|
||||
{{!-- Controls --}}
|
||||
{{#unless hideControls}}
|
||||
<div class="controls">
|
||||
{{#if isActor}}
|
||||
<a data-action="editDoc" data-tooltip="DAGGERHEART.UI.Tooltip.openActorWorld">
|
||||
<i class="fa-solid fa-globe"></i>
|
||||
</a>
|
||||
{{#if (eq type 'adversary')}}
|
||||
<a data-action='deleteAdversary' data-category="{{categoryAdversary}}" data-tooltip="CONTROLS.CommonDelete">
|
||||
<i class='fas fa-trash'></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#if (eq type 'weapon')}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-hands"></i>
|
||||
</a>
|
||||
{{else if (eq type 'armor')}}
|
||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.equipped 'unequip' 'equip' }}">
|
||||
<i class="fa-solid fa-shield"></i>
|
||||
</a>
|
||||
{{else if (eq type 'domainCard')}}
|
||||
<a data-action="toggleVault"
|
||||
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.inVault 'sendToLoadout' 'sendToVault' }}">
|
||||
<i class="fa-solid {{ifThen item.system.inVault 'fa-arrow-up' 'fa-arrow-down'}}"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{!-- I had to use the {{not}} helper because otherwise the function is called when rendering --}}
|
||||
{{#unless (not item.toChat)}}
|
||||
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
|
||||
<i class="fa-regular fa-message"></i>
|
||||
</a>
|
||||
{{/unless}}
|
||||
|
||||
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||
<i class="fa-solid fa-ellipsis-vertical"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<span></span>
|
||||
{{/unless}}
|
||||
|
||||
{{!-- Description --}}
|
||||
{{#unless hideDescription}}
|
||||
<div class="item-description">
|
||||
{{{item.system.description}}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
</li>
|
||||
Loading…
Add table
Add a link
Reference in a new issue