mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Merge branch 'main' into fix/371-Localization-Misses
This commit is contained in:
commit
1c2b5d0b42
84 changed files with 2198 additions and 1670 deletions
|
|
@ -66,7 +66,7 @@ Hooks.once('init', () => {
|
||||||
CONFIG.Token.documentClass = documents.DhToken;
|
CONFIG.Token.documentClass = documents.DhToken;
|
||||||
CONFIG.Token.prototypeSheetClass = applications.sheetConfigs.DhPrototypeTokenConfig;
|
CONFIG.Token.prototypeSheetClass = applications.sheetConfigs.DhPrototypeTokenConfig;
|
||||||
DocumentSheetConfig.unregisterSheet(TokenDocument, 'core', foundry.applications.sheets.TokenConfig);
|
DocumentSheetConfig.unregisterSheet(TokenDocument, 'core', foundry.applications.sheets.TokenConfig);
|
||||||
DocumentSheetConfig.registerSheet(TokenDocument, 'dnd5e', applications.sheetConfigs.DhTokenConfig, {
|
DocumentSheetConfig.registerSheet(TokenDocument, SYSTEM.id, applications.sheetConfigs.DhTokenConfig, {
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
29
lang/en.json
29
lang/en.json
|
|
@ -39,6 +39,9 @@
|
||||||
"multiplier": "Multiplier",
|
"multiplier": "Multiplier",
|
||||||
"resultBased": {
|
"resultBased": {
|
||||||
"label": "Formula based on Hope/Fear result."
|
"label": "Formula based on Hope/Fear result."
|
||||||
|
},
|
||||||
|
"applyTo": {
|
||||||
|
"label": "Targeted Resource"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
|
|
@ -109,15 +112,6 @@
|
||||||
"Character": {
|
"Character": {
|
||||||
"age": "Age",
|
"age": "Age",
|
||||||
"companionFeatures": "Companion Features",
|
"companionFeatures": "Companion Features",
|
||||||
"contextMenu": {
|
|
||||||
"consume": "Consume Item",
|
|
||||||
"equip": "Equip",
|
|
||||||
"sendToChat": "Send To Chat",
|
|
||||||
"toLoadout": "Send to Loadout",
|
|
||||||
"toVault": "Send to Vault",
|
|
||||||
"unequip": "Unequip",
|
|
||||||
"useItem": "Use Item"
|
|
||||||
},
|
|
||||||
"faith": "Faith",
|
"faith": "Faith",
|
||||||
"levelUp": "You can level up",
|
"levelUp": "You can level up",
|
||||||
"pronouns": "Pronouns",
|
"pronouns": "Pronouns",
|
||||||
|
|
@ -209,6 +203,16 @@
|
||||||
"requestingSpotlight": "Requesting The Spotlight",
|
"requestingSpotlight": "Requesting The Spotlight",
|
||||||
"requestSpotlight": "Request The Spotlight"
|
"requestSpotlight": "Request The Spotlight"
|
||||||
},
|
},
|
||||||
|
"ContextMenu": {
|
||||||
|
"disableEffect": "Disable Effect",
|
||||||
|
"enableEffect": "Enable Effect",
|
||||||
|
"equip": "Equip",
|
||||||
|
"sendToChat": "Send To Chat",
|
||||||
|
"toLoadout": "Send to Loadout",
|
||||||
|
"toVault": "Send to Vault",
|
||||||
|
"unequip": "Unequip",
|
||||||
|
"useItem": "Use Item"
|
||||||
|
},
|
||||||
"Countdown": {
|
"Countdown": {
|
||||||
"addCountdown": "Add Countdown",
|
"addCountdown": "Add Countdown",
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
|
|
@ -668,6 +672,10 @@
|
||||||
"armorStack": {
|
"armorStack": {
|
||||||
"name": "Armor Stack",
|
"name": "Armor Stack",
|
||||||
"abbreviation": "AS"
|
"abbreviation": "AS"
|
||||||
|
},
|
||||||
|
"fear": {
|
||||||
|
"name": "Fear",
|
||||||
|
"abbreviation": "FR"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ItemResourceType": {
|
"ItemResourceType": {
|
||||||
|
|
@ -1260,6 +1268,7 @@
|
||||||
},
|
},
|
||||||
"fear": "Fear",
|
"fear": "Fear",
|
||||||
"features": "Features",
|
"features": "Features",
|
||||||
|
"healing": "Healing",
|
||||||
"hitPoints": {
|
"hitPoints": {
|
||||||
"single": "Hit Point",
|
"single": "Hit Point",
|
||||||
"plural": "Hit Points",
|
"plural": "Hit Points",
|
||||||
|
|
@ -1582,6 +1591,8 @@
|
||||||
"featureNotMastery": "This feature is used as something else than a Mastery feature and cannot be used here."
|
"featureNotMastery": "This feature is used as something else than a Mastery feature and cannot be used here."
|
||||||
},
|
},
|
||||||
"Tooltip": {
|
"Tooltip": {
|
||||||
|
"disableEffect": "Disable Effect",
|
||||||
|
"enableEffect": "Enable Effect",
|
||||||
"openItemWorld": "Open Item World",
|
"openItemWorld": "Open Item World",
|
||||||
"openActorWorld": "Open Actor World",
|
"openActorWorld": "Open Actor World",
|
||||||
"sendToChat": "Send to Chat",
|
"sendToChat": "Send to Chat",
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,11 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
|
context.config = CONFIG.DH;
|
||||||
context.title = this.config.title
|
context.title = this.config.title
|
||||||
? this.config.title
|
? this.config.title
|
||||||
: game.i18n.localize('DAGGERHEART.EFFECTS.ApplyLocations.damageRoll.name');
|
: game.i18n.localize('DAGGERHEART.EFFECTS.ApplyLocations.damageRoll.name');
|
||||||
context.extraFormula = this.config.extraFormula;
|
// context.extraFormula = this.config.extraFormula;
|
||||||
context.formula = this.roll.constructFormula(this.config);
|
context.formula = this.roll.constructFormula(this.config);
|
||||||
context.directDamage = this.config.directDamage;
|
context.directDamage = this.config.directDamage;
|
||||||
context.selectedRollMode = this.config.selectedRollMode;
|
context.selectedRollMode = this.config.selectedRollMode;
|
||||||
|
|
@ -55,13 +56,12 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
||||||
label,
|
label,
|
||||||
icon
|
icon
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
static updateRollConfiguration(_event, _, formData) {
|
static updateRollConfiguration(_event, _, formData) {
|
||||||
const { ...rest } = foundry.utils.expandObject(formData.object);
|
const { ...rest } = foundry.utils.expandObject(formData.object);
|
||||||
this.config.extraFormula = rest.extraFormula;
|
foundry.utils.mergeObject(this.config.roll, rest.roll)
|
||||||
this.config.selectedRollMode = rest.selectedRollMode;
|
this.config.selectedRollMode = rest.selectedRollMode;
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
||||||
this.reject = reject;
|
this.reject = reject;
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
|
||||||
const canApplyArmor = damageType.every(t => actor.system.armorApplicableDamageTypes[t] === true);
|
const canApplyArmor = damageType.every(t => actor.system.armorApplicableDamageTypes[t] === true);
|
||||||
const maxArmorMarks = canApplyArmor
|
const maxArmorMarks = canApplyArmor
|
||||||
? Math.min(
|
? Math.min(
|
||||||
actor.system.armorScore - actor.system.armor.system.marks.value,
|
actor.system.armorScore - actor.system.armor.system.marks.value,
|
||||||
actor.system.rules.damageReduction.maxArmorMarked.total
|
actor.system.rules.damageReduction.maxArmorMarked.value
|
||||||
)
|
)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
||||||
context.armorScore = this.actor.system.armorScore;
|
context.armorScore = this.actor.system.armorScore;
|
||||||
context.armorMarks = currentMarks;
|
context.armorMarks = currentMarks;
|
||||||
context.basicMarksUsed =
|
context.basicMarksUsed =
|
||||||
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.total;
|
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.value;
|
||||||
|
|
||||||
const stressReductionStress = this.availableStressReductions
|
const stressReductionStress = this.availableStressReductions
|
||||||
? stressReductions.reduce((acc, red) => acc + red.cost, 0)
|
? stressReductions.reduce((acc, red) => acc + red.cost, 0)
|
||||||
|
|
|
||||||
|
|
@ -113,13 +113,24 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
|
|
||||||
deselectMove(event) {
|
deselectMove(event) {
|
||||||
const button = event.target.closest('.activity-container');
|
const button = event.target.closest('.activity-container');
|
||||||
const move = button.dataset.move;
|
const { move, category } = button.dataset;
|
||||||
this.moveData[button.dataset.category].moves[move].selected = this.moveData[button.dataset.category].moves[move]
|
this.moveData[category].moves[move].selected = this.moveData[category].moves[move].selected
|
||||||
.selected
|
? this.moveData[category].moves[move].selected - 1
|
||||||
? this.moveData[button.dataset.category].moves[move].selected - 1
|
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
|
// On macOS with a single-button mouse (e.g. a laptop trackpad),
|
||||||
|
// right-click is triggered with ctrl+click, which triggers both a
|
||||||
|
// `contextmenu` event and a regular click event. We need to stop
|
||||||
|
// event propagation to prevent the click event from triggering the
|
||||||
|
// `selectMove` function and undoing the change we just made.
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
// Having stopped propagation, we're no longer subject to Foundry's
|
||||||
|
// default `contextmenu` handler, so we also have to prevent the
|
||||||
|
// default behaviour to prevent a context menu from appearing.
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async takeDowntime() {
|
static async takeDowntime() {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
||||||
context.getEffectDetails = this.getEffectDetails.bind(this);
|
context.getEffectDetails = this.getEffectDetails.bind(this);
|
||||||
context.costOptions = this.getCostOptions();
|
context.costOptions = this.getCostOptions();
|
||||||
context.disableOption = this.disableOption.bind(this);
|
context.disableOption = this.disableOption.bind(this);
|
||||||
context.isNPC = this.action.actor && this.action.actor.type !== 'character';
|
context.isNPC = this.action.actor?.isNPC;
|
||||||
context.hasRoll = this.action.hasRoll;
|
context.hasRoll = this.action.hasRoll;
|
||||||
|
|
||||||
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { getDocFromElement } from '../../helpers/utils.mjs';
|
||||||
import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
|
import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
|
||||||
|
|
||||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||||
|
|
@ -9,8 +10,7 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
|
||||||
actions: {
|
actions: {
|
||||||
addCategory: DHEnvironmentSettings.#addCategory,
|
addCategory: DHEnvironmentSettings.#addCategory,
|
||||||
removeCategory: DHEnvironmentSettings.#removeCategory,
|
removeCategory: DHEnvironmentSettings.#removeCategory,
|
||||||
viewAdversary: this.#viewAdversary,
|
deleteAdversary: DHEnvironmentSettings.#deleteAdversary
|
||||||
deleteAdversary: this.#deleteAdversary
|
|
||||||
},
|
},
|
||||||
dragDrop: [
|
dragDrop: [
|
||||||
{ dragSelector: null, dropSelector: '.category-container' },
|
{ 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 });
|
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) {
|
* @type {ApplicationClickAction}
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.adversaryMissing'));
|
* @returns
|
||||||
return;
|
*/
|
||||||
}
|
static async #deleteAdversary(_event, target) {
|
||||||
|
const doc = getDocFromElement(target);
|
||||||
|
const { category } = target.dataset;
|
||||||
|
const path = `system.potentialAdversaries.${category}.adversaries`;
|
||||||
|
|
||||||
adversary.sheet.render({ force: true });
|
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: doc.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: doc.name })
|
||||||
|
});
|
||||||
|
|
||||||
static async #deleteAdversary(event, target) {
|
if (!confirmed) return;
|
||||||
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 adversaries = foundry.utils.getProperty(this.actor, path);
|
||||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
const newAdversaries = adversaries.filter(a => a.uuid !== doc.uuid);
|
||||||
window: {
|
|
||||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
|
||||||
type: game.i18n.localize('TYPES.Actor.adversary'),
|
|
||||||
name: adversary.name
|
|
||||||
})
|
|
||||||
},
|
|
||||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: adversary.name })
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!confirmed) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newAdversaries = property.filter(x => x && (x?.uuid ?? x) !== adversaryKey);
|
|
||||||
await this.actor.update({ [path]: newAdversaries });
|
await this.actor.update({ [path]: newAdversaries });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
||||||
window: { resizable: true },
|
window: { resizable: true },
|
||||||
actions: {
|
actions: {
|
||||||
reactionRoll: AdversarySheet.#reactionRoll,
|
reactionRoll: AdversarySheet.#reactionRoll,
|
||||||
useItem: this.useItem,
|
|
||||||
useAction: this.useItem,
|
|
||||||
toChat: this.toChat
|
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true
|
||||||
|
|
@ -29,7 +26,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'features' }, { id: 'notes' }, { id: 'effects' }],
|
tabs: [{ id: 'features' }, { id: 'effects' }, { id: 'notes' }],
|
||||||
initial: 'features',
|
initial: 'features',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
|
|
@ -42,10 +39,63 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(element) {
|
/**@inheritdoc */
|
||||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
async _preparePartContext(partId, context, options) {
|
||||||
item = this.document.items.get(itemId);
|
context = await super._preparePartContext(partId, context, options);
|
||||||
return item;
|
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -73,42 +123,4 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
||||||
|
|
||||||
this.actor.diceRoll(config);
|
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.value.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,7 +4,7 @@ import { abilities } from '../../../config/actorConfig.mjs';
|
||||||
import DhCharacterlevelUp from '../../levelup/characterLevelup.mjs';
|
import DhCharacterlevelUp from '../../levelup/characterLevelup.mjs';
|
||||||
import DhCharacterCreation from '../../characterCreation/characterCreation.mjs';
|
import DhCharacterCreation from '../../characterCreation/characterCreation.mjs';
|
||||||
import FilterMenu from '../../ux/filter-menu.mjs';
|
import FilterMenu from '../../ux/filter-menu.mjs';
|
||||||
import { itemAbleRollParse } from '../../../helpers/utils.mjs';
|
import { getDocFromElement, itemAbleRollParse } from '../../../helpers/utils.mjs';
|
||||||
|
|
||||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||||
|
|
||||||
|
|
@ -15,7 +15,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
classes: ['character'],
|
classes: ['character'],
|
||||||
position: { width: 850, height: 800 },
|
position: { width: 850, height: 800 },
|
||||||
actions: {
|
actions: {
|
||||||
triggerContextMenu: CharacterSheet.#triggerContextMenu,
|
|
||||||
toggleVault: CharacterSheet.#toggleVault,
|
toggleVault: CharacterSheet.#toggleVault,
|
||||||
rollAttribute: CharacterSheet.#rollAttribute,
|
rollAttribute: CharacterSheet.#rollAttribute,
|
||||||
toggleHope: CharacterSheet.#toggleHope,
|
toggleHope: CharacterSheet.#toggleHope,
|
||||||
|
|
@ -24,11 +23,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
makeDeathMove: CharacterSheet.#makeDeathMove,
|
makeDeathMove: CharacterSheet.#makeDeathMove,
|
||||||
levelManagement: CharacterSheet.#levelManagement,
|
levelManagement: CharacterSheet.#levelManagement,
|
||||||
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
||||||
useItem: this.useItem, //TODO Fix this
|
toggleResourceDice: CharacterSheet.#toggleResourceDice,
|
||||||
useAction: this.useAction,
|
handleResourceDice: CharacterSheet.#handleResourceDice,
|
||||||
toggleResourceDice: this.toggleResourceDice,
|
|
||||||
handleResourceDice: this.handleResourceDice,
|
|
||||||
toChat: this.toChat,
|
|
||||||
useDowntime: this.useDowntime
|
useDowntime: this.useDowntime
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
|
|
@ -42,8 +38,24 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
],
|
],
|
||||||
contextMenus: [
|
contextMenus: [
|
||||||
{
|
{
|
||||||
handler: CharacterSheet._getContextMenuOptions,
|
handler: CharacterSheet.#getDomainCardContextOptions,
|
||||||
selector: '[data-item-id]',
|
selector: '[data-item-uuid][data-type="domainCard"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handler: CharacterSheet.#getEquipamentContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="armor"], [data-item-uuid][data-type="weapon"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handler: CharacterSheet.#getItemContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="miscellaneous"]',
|
||||||
options: {
|
options: {
|
||||||
parentClassHooks: false,
|
parentClassHooks: false,
|
||||||
fixed: true
|
fixed: true
|
||||||
|
|
@ -123,20 +135,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this._createSearchFilter();
|
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 */
|
/* Prepare Context */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -186,124 +184,135 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
case 'sidebar':
|
case 'sidebar':
|
||||||
await this._prepareSidebarContext(context, options);
|
await this._prepareSidebarContext(context, options);
|
||||||
break;
|
break;
|
||||||
|
case 'biography':
|
||||||
|
await this._prepareBiographyContext(context, options);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare render context for the Loadout part.
|
||||||
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
async _prepareLoadoutContext(context, _options) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare render context for the Sidebar part.
|
||||||
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
async _prepareSidebarContext(context, _options) {
|
async _prepareSidebarContext(context, _options) {
|
||||||
context.isDeath = this.document.system.deathMoveViable;
|
context.isDeath = this.document.system.deathMoveViable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare render context for the Biography part.
|
||||||
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _prepareBiographyContext(context, _options) {
|
||||||
|
const { system } = this.document;
|
||||||
|
const { TextEditor } = foundry.applications.ux;
|
||||||
|
|
||||||
|
const paths = {
|
||||||
|
background: 'biography.background',
|
||||||
|
connections: 'biography.connections'
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Context Menu */
|
/* Context Menu */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the set of ContextMenu options.
|
* Get the set of ContextMenu options for DomainCards.
|
||||||
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
* @this {CharacterSheet}
|
* @this {CharacterSheet}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
static _getContextMenuOptions() {
|
static #getDomainCardContextOptions() {
|
||||||
/**
|
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
||||||
* Get the item from the element.
|
const options = [
|
||||||
* @param {HTMLElement} el
|
{
|
||||||
* @returns {foundry.documents.Item?}
|
name: 'toLoadout',
|
||||||
*/
|
icon: 'fa-solid fa-arrow-up',
|
||||||
const getItem = element => {
|
condition: target => getDocFromElement(target).system.inVault,
|
||||||
const listElement = (element.target ?? element).closest('[data-item-id]');
|
callback: target => getDocFromElement(target).update({ 'system.inVault': false })
|
||||||
const itemId = listElement.dataset.itemId;
|
},
|
||||||
|
{
|
||||||
switch (listElement.dataset.type) {
|
name: 'toVault',
|
||||||
case 'effect':
|
icon: 'fa-solid fa-arrow-down',
|
||||||
return this.document.effects.get(itemId);
|
condition: target => !getDocFromElement(target).system.inVault,
|
||||||
default:
|
callback: target => getDocFromElement(target).update({ 'system.inVault': true })
|
||||||
return this.document.items.get(itemId);
|
|
||||||
}
|
}
|
||||||
};
|
].map(option => ({
|
||||||
|
...option,
|
||||||
|
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
||||||
|
icon: `<i class="${option.icon}"></i>`
|
||||||
|
}));
|
||||||
|
|
||||||
return [
|
return [...options, ...this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true })];
|
||||||
{
|
}
|
||||||
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);
|
|
||||||
},
|
|
||||||
callback: (button, event) => CharacterSheet.useItem.call(this, event, button)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.equip',
|
|
||||||
icon: '<i class="fa-solid fa-hands"></i>',
|
|
||||||
condition: el => {
|
|
||||||
const item = getItem(el);
|
|
||||||
return ['weapon', 'armor'].includes(item.type) && !item.system.equipped;
|
|
||||||
},
|
|
||||||
callback: CharacterSheet.#toggleEquipItem.bind(this)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.unequip',
|
|
||||||
icon: '<i class="fa-solid fa-hands"></i>',
|
|
||||||
condition: el => {
|
|
||||||
const item = getItem(el);
|
|
||||||
return ['weapon', 'armor'].includes(item.type) && item.system.equipped;
|
|
||||||
},
|
|
||||||
callback: CharacterSheet.#toggleEquipItem.bind(this)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.toLoadout',
|
|
||||||
icon: '<i class="fa-solid fa-arrow-up"></i>',
|
|
||||||
condition: el => {
|
|
||||||
const item = getItem(el);
|
|
||||||
return ['domainCard'].includes(item.type) && item.system.inVault;
|
|
||||||
},
|
|
||||||
callback: target => getItem(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);
|
|
||||||
return ['domainCard'].includes(item.type) && !item.system.inVault;
|
|
||||||
},
|
|
||||||
callback: target => getItem(target).update({ 'system.inVault': true })
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DAGGERHEART.ACTORS.Character.contextMenu.sendToChat',
|
|
||||||
icon: '<i class="fa-regular fa-message"></i>',
|
|
||||||
callback: CharacterSheet.toChat.bind(this)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CONTROLS.CommonEdit',
|
|
||||||
icon: '<i class="fa-solid fa-pen-to-square"></i>',
|
|
||||||
callback: target => getItem(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();
|
/**
|
||||||
}
|
* Get the set of ContextMenu options for Armors and Weapons.
|
||||||
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
* @this {CharacterSheet}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static #getEquipamentContextOptions() {
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
name: 'equip',
|
||||||
|
icon: 'fa-solid fa-hands',
|
||||||
|
condition: target => !getDocFromElement(target).system.equipped,
|
||||||
|
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'unequip',
|
||||||
|
icon: 'fa-solid fa-hands',
|
||||||
|
condition: target => getDocFromElement(target).system.equipped,
|
||||||
|
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
|
||||||
}
|
}
|
||||||
];
|
].map(option => ({
|
||||||
|
...option,
|
||||||
|
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
||||||
|
icon: `<i class="${option.icon}"></i>`
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [...options, ...this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true })];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the set of ContextMenu options for Consumable and Miscellaneous.
|
||||||
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
* @this {CharacterSheet}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static #getItemContextOptions() {
|
||||||
|
return this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true });
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Filter Tracking */
|
/* Filter Tracking */
|
||||||
|
|
@ -397,7 +406,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.#filteredItems.inventory.search.clear();
|
this.#filteredItems.inventory.search.clear();
|
||||||
|
|
||||||
for (const li of html.querySelectorAll('.inventory-item')) {
|
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);
|
const matchesSearch = !query || foundry.applications.ux.SearchFilter.testQuery(rgx, item.name);
|
||||||
if (matchesSearch) this.#filteredItems.inventory.search.add(item.id);
|
if (matchesSearch) this.#filteredItems.inventory.search.add(item.id);
|
||||||
const { menu } = this.#filteredItems.inventory;
|
const { menu } = this.#filteredItems.inventory;
|
||||||
|
|
@ -417,7 +426,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.#filteredItems.loadout.search.clear();
|
this.#filteredItems.loadout.search.clear();
|
||||||
|
|
||||||
for (const li of html.querySelectorAll('.items-list .inventory-item, .card-list .card-item')) {
|
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);
|
const matchesSearch = !query || foundry.applications.ux.SearchFilter.testQuery(rgx, item.name);
|
||||||
if (matchesSearch) this.#filteredItems.loadout.search.add(item.id);
|
if (matchesSearch) this.#filteredItems.loadout.search.add(item.id);
|
||||||
const { menu } = this.#filteredItems.loadout;
|
const { menu } = this.#filteredItems.loadout;
|
||||||
|
|
@ -468,7 +477,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.#filteredItems.inventory.menu.clear();
|
this.#filteredItems.inventory.menu.clear();
|
||||||
|
|
||||||
for (const li of html.querySelectorAll('.inventory-item')) {
|
for (const li of html.querySelectorAll('.inventory-item')) {
|
||||||
const item = this.document.items.get(li.dataset.itemId);
|
const item = getDocFromElement(li);
|
||||||
|
|
||||||
const matchesMenu =
|
const matchesMenu =
|
||||||
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
||||||
|
|
@ -489,7 +498,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.#filteredItems.loadout.menu.clear();
|
this.#filteredItems.loadout.menu.clear();
|
||||||
|
|
||||||
for (const li of html.querySelectorAll('.items-list .inventory-item, .card-list .card-item')) {
|
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 =
|
const matchesMenu =
|
||||||
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
filters.length === 0 || filters.some(f => foundry.applications.ux.SearchFilter.evaluateFilter(item, f));
|
||||||
|
|
@ -503,22 +512,21 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Application Listener Actions */
|
/* Application Listener Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
async updateItemResource(event) {
|
async updateItemResource(event) {
|
||||||
const item = this.getItem(event.currentTarget);
|
const item = getDocFromElement(event.currentTarget);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
const max = item.system.resource.max ? itemAbleRollParse(item.system.resource.max, this.document, item) : null;
|
const max = item.system.resource.max ? itemAbleRollParse(item.system.resource.max, this.document, item) : null;
|
||||||
const value = max ? Math.min(Number(event.currentTarget.value), max) : event.currentTarget.value;
|
const value = max ? Math.min(Number(event.currentTarget.value), max) : event.currentTarget.value;
|
||||||
await item.update({ 'system.resource.value': value });
|
await item.update({ 'system.resource.value': value });
|
||||||
this.render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateItemQuantity(event) {
|
async updateItemQuantity(event) {
|
||||||
const item = this.getItem(event.currentTarget);
|
const item = getDocFromElement(event.currentTarget);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
await item.update({ 'system.quantity': event.currentTarget.value });
|
await item.update({ 'system.quantity': event.currentTarget.value });
|
||||||
this.render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateArmorMarks(event) {
|
async updateArmorMarks(event) {
|
||||||
|
|
@ -528,7 +536,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
const maxMarks = this.document.system.armorScore;
|
const maxMarks = this.document.system.armorScore;
|
||||||
const value = Math.min(Math.max(Number(event.currentTarget.value), 0), maxMarks);
|
const value = Math.min(Math.max(Number(event.currentTarget.value), 0), maxMarks);
|
||||||
await armor.update({ 'system.marks.value': value });
|
await armor.update({ 'system.marks.value': value });
|
||||||
this.render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -588,13 +595,14 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.document.diceRoll(config);
|
this.document.diceRoll(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: redo toggleEquipItem method
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the equipped state of an item (armor or weapon).
|
* Toggles the equipped state of an item (armor or weapon).
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async #toggleEquipItem(_event, button) {
|
static async #toggleEquipItem(_event, button) {
|
||||||
//TODO: redo this
|
const item = getDocFromElement(button);
|
||||||
const item = this.actor.items.get(button.closest('[data-item-id]')?.dataset.itemId);
|
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
if (item.system.equipped) {
|
if (item.system.equipped) {
|
||||||
await item.update({ 'system.equipped': false });
|
await item.update({ 'system.equipped': false });
|
||||||
|
|
@ -642,64 +650,23 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
* Toggles whether an item is stored in the vault.
|
* Toggles whether an item is stored in the vault.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async #toggleVault(event, button) {
|
static async #toggleVault(_event, button) {
|
||||||
const docId = button.closest('[data-item-id]')?.dataset.itemId;
|
const doc = getDocFromElement(button);
|
||||||
const doc = this.document.items.get(docId);
|
|
||||||
await doc?.update({ 'system.inVault': !doc.system.inVault });
|
await doc?.update({ 'system.inVault': !doc.system.inVault });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Trigger the context menu.
|
|
||||||
* @type {ApplicationClickAction}
|
|
||||||
*/
|
|
||||||
static #triggerContextMenu(event, _) {
|
|
||||||
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 {
|
|
||||||
item.use(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use an action
|
|
||||||
* @type {ApplicationClickAction}
|
|
||||||
*/
|
|
||||||
static async useAction(event, button) {
|
|
||||||
const item = this.getItem(button);
|
|
||||||
if (!item) return;
|
|
||||||
|
|
||||||
const action = item.system.actions.find(x => x.id === button.dataset.actionId);
|
|
||||||
if (!action) return;
|
|
||||||
|
|
||||||
action.use(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the used state of a resource dice.
|
* Toggle the used state of a resource dice.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async toggleResourceDice(event) {
|
static async #toggleResourceDice(event, target) {
|
||||||
const target = event.target.closest('.item-resource');
|
const item = getDocFromElement(target);
|
||||||
const item = this.getItem(event);
|
|
||||||
if (!item) return;
|
const { dice } = event.target.closest('.item-resource').dataset;
|
||||||
|
const diceState = item.system.resource.diceStates[dice];
|
||||||
|
|
||||||
const diceState = item.system.resource.diceStates[target.dataset.dice];
|
|
||||||
await item.update({
|
await item.update({
|
||||||
[`system.resource.diceStates.${target.dataset.dice}.used`]: diceState?.used ? !diceState.used : true
|
[`system.resource.diceStates.${dice}.used`]: diceState ? !diceState.used : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -707,8 +674,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
* Handle the roll values of resource dice.
|
* Handle the roll values of resource dice.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async handleResourceDice(event) {
|
static async #handleResourceDice(_, target) {
|
||||||
const item = this.getItem(event);
|
const item = getDocFromElement(target);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(item, this.document);
|
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(item, this.document);
|
||||||
|
|
@ -720,37 +687,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
});
|
});
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.value.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);
|
|
||||||
if (!item) return;
|
|
||||||
item.toChat(this.document.id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static useDowntime(_, button) {
|
static useDowntime(_, button) {
|
||||||
|
|
@ -760,7 +696,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onDragStart(event) {
|
async _onDragStart(event) {
|
||||||
const item = this.getItem(event);
|
const item = getDocFromElement(event.target);
|
||||||
|
|
||||||
const dragData = {
|
const dragData = {
|
||||||
type: item.documentName,
|
type: item.documentName,
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,7 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['actor', 'companion'],
|
classes: ['actor', 'companion'],
|
||||||
position: { width: 300 },
|
position: { width: 300 },
|
||||||
actions: {
|
actions: {}
|
||||||
viewActor: this.viewActor,
|
|
||||||
useItem: this.useItem,
|
|
||||||
toChat: this.toChat
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
|
|
@ -29,52 +25,4 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
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.value.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.getAction(event) ?? this.document.system.attack;
|
|
||||||
item.toChat(this.document.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
||||||
position: {
|
position: {
|
||||||
width: 500
|
width: 500
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {},
|
||||||
useItem: this.useItem,
|
|
||||||
useAction: this.useItem,
|
|
||||||
toChat: this.toChat
|
|
||||||
},
|
|
||||||
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -36,47 +32,67 @@ export default class DhpEnvironment extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/**@inheritdoc */
|
||||||
|
async _preparePartContext(partId, context, options) {
|
||||||
getItem(element) {
|
context = await super._preparePartContext(partId, context, options);
|
||||||
const itemId = (element.target ?? element).closest('[data-item-id]').dataset.itemId,
|
switch (partId) {
|
||||||
item = this.document.items.get(itemId);
|
case 'header':
|
||||||
return item;
|
await this._prepareHeaderContext(context, options);
|
||||||
|
break;
|
||||||
|
case 'notes':
|
||||||
|
await this._prepareNotesContext(context, options);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
/* Application Clicks Actions */
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Prepare render context for the Biography part.
|
||||||
* @type {ApplicationClickAction}
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
*/
|
*/
|
||||||
async viewAdversary(_, button) {
|
async _prepareNotesContext(context, _options) {
|
||||||
const target = button.closest('[data-item-uuid]');
|
const { system } = this.document;
|
||||||
const adversary = await foundry.utils.fromUuid(target.dataset.itemUuid);
|
const { TextEditor } = foundry.applications.ux;
|
||||||
if (!adversary) {
|
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.adversaryMissing'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
adversary.sheet.render({ force: true });
|
const paths = {
|
||||||
}
|
notes: 'notes'
|
||||||
|
};
|
||||||
|
|
||||||
static async useItem(event, button) {
|
for (const [key, path] of Object.entries(paths)) {
|
||||||
const action = this.getItem(event);
|
const value = foundry.utils.getProperty(system, path);
|
||||||
if (!action) {
|
context[key] = {
|
||||||
await this.viewAdversary(event, button);
|
field: system.schema.getField(path),
|
||||||
} else {
|
value,
|
||||||
action.use(event);
|
enriched: await TextEditor.implementation.enrichHTML(value, {
|
||||||
|
secrets: this.document.isOwner,
|
||||||
|
relativeTo: this.document
|
||||||
|
})
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async toChat(event) {
|
/**
|
||||||
const item = this.getItem(event);
|
* Prepare render context for the Header part.
|
||||||
item.toChat(this.document.id);
|
* @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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
async _onDragStart(event) {
|
async _onDragStart(event) {
|
||||||
const item = event.currentTarget.closest('.inventory-item');
|
const item = event.currentTarget.closest('.inventory-item');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
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} ApplicationClickAction
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} DragDropConfig
|
* @typedef {object} DragDropConfig
|
||||||
|
|
@ -71,11 +76,32 @@ export default function DHApplicationMixin(Base) {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['daggerheart', 'sheet', 'dh-style'],
|
classes: ['daggerheart', 'sheet', 'dh-style'],
|
||||||
actions: {
|
actions: {
|
||||||
|
triggerContextMenu: DHSheetV2.#triggerContextMenu,
|
||||||
createDoc: DHSheetV2.#createDoc,
|
createDoc: DHSheetV2.#createDoc,
|
||||||
editDoc: DHSheetV2.#editDoc,
|
editDoc: DHSheetV2.#editDoc,
|
||||||
deleteDoc: DHSheetV2.#deleteDoc
|
deleteDoc: DHSheetV2.#deleteDoc,
|
||||||
|
toChat: DHSheetV2.#toChat,
|
||||||
|
useItem: DHSheetV2.#useItem,
|
||||||
|
useAction: DHSheetV2.#useAction,
|
||||||
|
toggleEffect: DHSheetV2.#toggleEffect,
|
||||||
|
toggleExtended: DHSheetV2.#toggleExtended,
|
||||||
},
|
},
|
||||||
contextMenus: [],
|
contextMenus: [{
|
||||||
|
handler: DHSheetV2.#getEffectContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="effect"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handler: DHSheetV2.#getActionContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="action"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
|
}
|
||||||
|
}],
|
||||||
dragDrop: [],
|
dragDrop: [],
|
||||||
tagifyConfigs: []
|
tagifyConfigs: []
|
||||||
};
|
};
|
||||||
|
|
@ -99,6 +125,27 @@ export default function DHApplicationMixin(Base) {
|
||||||
this._createTagifyElements(this.options.tagifyConfigs);
|
this._createTagifyElements(this.options.tagifyConfigs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Sync Parts */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/**@inheritdoc */
|
||||||
|
_syncPartState(partId, newElement, priorElement, state) {
|
||||||
|
super._syncPartState(partId, newElement, priorElement, state);
|
||||||
|
for (const el of priorElement.querySelectorAll(".extensible.extended")) {
|
||||||
|
const { actionId, itemUuid } = el.parentElement.dataset;
|
||||||
|
const selector = `${actionId ? `[data-action-id="${actionId}"]` : `[data-item-uuid="${itemUuid}"]`} .extensible`;
|
||||||
|
const newExtensible = newElement.querySelector(selector);
|
||||||
|
|
||||||
|
if (!newExtensible) continue;
|
||||||
|
newExtensible.classList.add("extended");
|
||||||
|
const descriptionElement = newExtensible.querySelector('.invetory-description');
|
||||||
|
if (descriptionElement) {
|
||||||
|
this.#prepareInventoryDescription(newExtensible, descriptionElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Tags */
|
/* Tags */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -162,14 +209,14 @@ export default function DHApplicationMixin(Base) {
|
||||||
* @param {DragEvent} event
|
* @param {DragEvent} event
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_onDragStart(event) {}
|
_onDragStart(event) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle drop event.
|
* Handle drop event.
|
||||||
* @param {DragEvent} event
|
* @param {DragEvent} event
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_onDrop(event) {}
|
_onDrop(event) { }
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Context Menu */
|
/* Context Menu */
|
||||||
|
|
@ -185,12 +232,140 @@ export default function DHApplicationMixin(Base) {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the set of ContextMenu options which should be used for journal entry pages in the sidebar.
|
* Get the set of ContextMenu options for DomainCards.
|
||||||
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]}
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
* @this {CharacterSheet}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
_getEntryContextOptions() {
|
static #getEffectContextOptions() {
|
||||||
return [];
|
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
name: 'disableEffect',
|
||||||
|
icon: 'fa-solid fa-lightbulb',
|
||||||
|
condition: target => !getDocFromElement(target).disabled,
|
||||||
|
callback: target => getDocFromElement(target).update({ disabled: true })
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'enableEffect',
|
||||||
|
icon: 'fa-regular fa-lightbulb',
|
||||||
|
condition: target => getDocFromElement(target).disabled,
|
||||||
|
callback: target => getDocFromElement(target).update({ disabled: false })
|
||||||
|
},
|
||||||
|
].map(option => ({
|
||||||
|
...option,
|
||||||
|
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
|
||||||
|
icon: `<i class="${option.icon}"></i>`
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [...options, ...this._getContextMenuCommonOptions.call(this, { toChat: true })];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the set of ContextMenu options for Actions.
|
||||||
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
* @this {DHSheetV2}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
static #getActionContextOptions() {
|
||||||
|
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
|
||||||
|
const getAction = (target) => {
|
||||||
|
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||||
|
const { actions, attack } = this.document.system;
|
||||||
|
return attack?.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||||
|
};
|
||||||
|
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||||
|
icon: 'fa-solid fa-burst',
|
||||||
|
condition: this.document instanceof foundry.documents.Actor ||
|
||||||
|
(this.document instanceof foundry.documents.Item && this.document.parent),
|
||||||
|
callback: (target, event) => getAction(target).use(event),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
|
||||||
|
icon: 'fa-solid fa-message',
|
||||||
|
callback: (target) => getAction(target).toChat(this.document.id),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CONTROLS.CommonEdit',
|
||||||
|
icon: 'fa-solid fa-pen-to-square',
|
||||||
|
callback: (target) => new DHActionConfig(getAction(target)).render({ force: true })
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CONTROLS.CommonDelete',
|
||||||
|
icon: 'fa-solid fa-trash',
|
||||||
|
condition: (target) => {
|
||||||
|
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||||
|
const { attack } = this.document.system;
|
||||||
|
return attack?.id !== actionId
|
||||||
|
},
|
||||||
|
callback: async (target) => {
|
||||||
|
const action = getAction(target)
|
||||||
|
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||||
|
type: game.i18n.localize(`DAGGERHEART.GENERAL.Action.single`),
|
||||||
|
name: action.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: action.name })
|
||||||
|
});
|
||||||
|
if (!confirmed) return;
|
||||||
|
|
||||||
|
return this.document.update({
|
||||||
|
'system.actions': this.document.system.actions.filter((a) => a.id !== action.id)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].map(option => ({
|
||||||
|
...option,
|
||||||
|
icon: `<i class="${option.icon}"></i>`
|
||||||
|
}));
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the set of ContextMenu options.
|
||||||
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
*/
|
||||||
|
_getContextMenuCommonOptions({ usable = false, toChat = false, deletable = true }) {
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
name: 'CONTROLS.CommonEdit',
|
||||||
|
icon: 'fa-solid fa-pen-to-square',
|
||||||
|
callback: target => getDocFromElement(target).sheet.render({ force: true })
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (usable) options.unshift({
|
||||||
|
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
|
||||||
|
icon: 'fa-solid fa-burst',
|
||||||
|
callback: (target, event) => getDocFromElement(target).use(event),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (toChat) options.unshift({
|
||||||
|
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
|
||||||
|
icon: 'fa-solid fa-message',
|
||||||
|
callback: (target) => getDocFromElement(target).toChat(this.document.id),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (deletable) options.push({
|
||||||
|
name: 'CONTROLS.CommonDelete',
|
||||||
|
icon: 'fa-solid fa-trash',
|
||||||
|
callback: (target, event) => {
|
||||||
|
const doc = getDocFromElement(target);
|
||||||
|
if (event.shiftKey) return doc.delete();
|
||||||
|
else return doc.deleteDialog();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return options.map(option => ({
|
||||||
|
...option,
|
||||||
|
icon: `<i class="${option.icon}"></i>`
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -207,66 +382,229 @@ export default function DHApplicationMixin(Base) {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Prepare Descriptions */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares and enriches an inventory item or action description for display.
|
||||||
|
* @param {HTMLElement} extensibleElement - The parent element containing the description.
|
||||||
|
* @param {HTMLElement} descriptionElement - The element where the enriched description will be rendered.
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async #prepareInventoryDescription(extensibleElement, descriptionElement) {
|
||||||
|
const parent = extensibleElement.closest('[data-item-uuid], [data-action-id]');
|
||||||
|
const { actionId, itemUuid } = parent?.dataset || {};
|
||||||
|
if (!actionId && !itemUuid) return;
|
||||||
|
|
||||||
|
const doc = itemUuid
|
||||||
|
? getDocFromElement(extensibleElement)
|
||||||
|
: this.document.system.attack?.id === actionId
|
||||||
|
? this.document.system.attack
|
||||||
|
: this.document.system.actions?.find(a => a.id === actionId);
|
||||||
|
if (!doc) return;
|
||||||
|
|
||||||
|
const description = doc.system?.description ?? doc.description;
|
||||||
|
const isAction = !!actionId;
|
||||||
|
descriptionElement.innerHTML = await foundry.applications.ux.TextEditor.implementation.enrichHTML(description, {
|
||||||
|
relativeTo: isAction ? doc.parent : doc,
|
||||||
|
rollData: doc.getRollData?.(),
|
||||||
|
secrets: isAction ? doc.parent.isOwner : doc.isOwner
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Application Clicks Actions */
|
/* Application Clicks Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an embedded document.
|
* Create an embedded document.
|
||||||
* @param {PointerEvent} event - The originating click event
|
* @type {ApplicationClickAction}
|
||||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
|
||||||
*/
|
*/
|
||||||
static async #createDoc(event, button) {
|
static async #createDoc(event, target) {
|
||||||
const { documentClass, type } = button.dataset;
|
const { documentClass, type, inVault, disabled } = target.dataset;
|
||||||
const parent = this.document;
|
const parentIsItem = this.document.documentName === 'Item';
|
||||||
|
const parent = parentIsItem && documentClass === 'Item' ? null : this.document;
|
||||||
|
|
||||||
const cls = getDocumentClass(documentClass);
|
if (type === 'action') {
|
||||||
return await cls.createDocuments(
|
const { type: actionType } = await foundry.applications.api.DialogV2.input({
|
||||||
[
|
window: { title: 'Select Action Type' },
|
||||||
{
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
name: cls.defaultName({ type, parent }),
|
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||||
type
|
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||||
|
),
|
||||||
|
ok: {
|
||||||
|
label: game.i18n.format('DOCUMENT.Create', {
|
||||||
|
type: game.i18n.localize('DAGGERHEART.GENERAL.Action.single')
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
],
|
}) ?? {};
|
||||||
{ parent, renderSheet: !event.shiftKey }
|
if (!actionType) return;
|
||||||
);
|
const cls = game.system.api.models.actions.actionsTypes[actionType]
|
||||||
|
const 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
|
||||||
|
});
|
||||||
|
return action;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const cls = getDocumentClass(documentClass);
|
||||||
|
const data = {
|
||||||
|
name: cls.defaultName({ type, parent }),
|
||||||
|
type,
|
||||||
|
}
|
||||||
|
if (inVault) data["system.inVault"] = true;
|
||||||
|
if (disabled) data.disabled = true;
|
||||||
|
|
||||||
|
const doc = await cls.create(data, { parent, renderSheet: !event.shiftKey });
|
||||||
|
if (parentIsItem && type === 'feature') {
|
||||||
|
await this.document.update({
|
||||||
|
'system.features': this.document.system.toObject().features.concat(doc.uuid)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders an embedded document.
|
* Renders an embedded document.
|
||||||
* @param {PointerEvent} event - The originating click event
|
* @type {ApplicationClickAction}
|
||||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
|
||||||
*/
|
*/
|
||||||
static #editDoc(_event, button) {
|
static #editDoc(_event, target) {
|
||||||
const { type, docId } = button.dataset;
|
const doc = getDocFromElement(target);
|
||||||
this.document.getEmbeddedDocument(type, docId, { strict: true }).sheet.render({ force: true });
|
if (doc) return doc.sheet.render({ force: true });
|
||||||
|
|
||||||
|
// TODO: REDO this
|
||||||
|
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.
|
* Delete an embedded document.
|
||||||
* @param {PointerEvent} _event - The originating click event
|
* @type {ApplicationClickAction}
|
||||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
|
||||||
*/
|
*/
|
||||||
static async #deleteDoc(_event, button) {
|
static async #deleteDoc(event, target) {
|
||||||
const { type, docId } = button.dataset;
|
const doc = getDocFromElement(target);
|
||||||
const document = this.document.getEmbeddedDocument(type, docId, { strict: true });
|
|
||||||
const typeName = game.i18n.localize(
|
|
||||||
document.type === 'base' ? `DOCUMENT.${type}` : `TYPES.${type}.${document.type}`
|
|
||||||
);
|
|
||||||
|
|
||||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
if (doc) {
|
||||||
window: {
|
if (event.shiftKey) return doc.delete()
|
||||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
else return await doc.deleteDialog()
|
||||||
type: typeName,
|
}
|
||||||
name: document.name
|
|
||||||
})
|
// TODO: REDO this
|
||||||
},
|
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: document.name })
|
const { actions, attack } = this.document.system;
|
||||||
|
if (attack?.id === actionId) return;
|
||||||
|
const action = actions.find(a => a.id === actionId);
|
||||||
|
|
||||||
|
if (!event.shiftKey) {
|
||||||
|
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||||
|
type: game.i18n.localize(`DAGGERHEART.GENERAL.Action.single`),
|
||||||
|
name: action.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: action.name })
|
||||||
|
});
|
||||||
|
if (!confirmed) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await this.document.update({
|
||||||
|
'system.actions': actions.filter((a) => a.id !== action.id)
|
||||||
});
|
});
|
||||||
if (!confirmed) return;
|
|
||||||
|
|
||||||
await document.delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
if(this.document instanceof foundry.documents.Item && !this.document.parent) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await doc.use(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use a item
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #useAction(event, target) {
|
||||||
|
const doc = getDocFromElement(target);
|
||||||
|
const { actionId } = target.closest('[data-action-id]').dataset;
|
||||||
|
const { actions, attack } = doc.system;
|
||||||
|
const action = attack?.id === actionId ? attack : actions?.find(a => a.id === actionId);
|
||||||
|
await action.use(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle a ActiveEffect
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #toggleEffect(_, target) {
|
||||||
|
const doc = getDocFromElement(target);
|
||||||
|
await doc.update({ disabled: !doc.disabled });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger the context menu.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static #triggerContextMenu(event, _) {
|
||||||
|
return CONFIG.ux.ContextMenu.triggerContextMenu(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the 'extended' class on the .extensible element inside inventory-item-content
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
* @this {DHSheetV2}
|
||||||
|
*/
|
||||||
|
static async #toggleExtended(_, target) {
|
||||||
|
const container = target.closest('.inventory-item');
|
||||||
|
const extensible = container?.querySelector('.extensible');
|
||||||
|
const t = extensible?.classList.toggle('extended');
|
||||||
|
|
||||||
|
const descriptionElement = extensible?.querySelector('.invetory-description');
|
||||||
|
if (t && !!descriptionElement) this.#prepareInventoryDescription(extensible, descriptionElement);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DHSheetV2;
|
return DHSheetV2;
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,24 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
submitOnChange: true
|
submitOnChange: true
|
||||||
},
|
},
|
||||||
actions: {
|
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 }]
|
dragDrop: [{ dragSelector: '.inventory-item[data-type="attack"]', dropSelector: null }]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**@type {typeof DHBaseActorSettings}*/
|
/**@type {typeof DHBaseActorSettings}*/
|
||||||
#settingSheet;
|
#settingSheet;
|
||||||
|
|
||||||
|
|
@ -35,6 +48,10 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
return (this.#settingSheet ??= SheetClass ? new SheetClass({ document: this.document }) : null);
|
return (this.#settingSheet ??= SheetClass ? new SheetClass({ document: this.document }) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Prepare Context */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
|
|
@ -42,6 +59,56 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
return context;
|
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
|
* Open the Actor Setting Sheet
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
@ -50,6 +117,29 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
await this.settingSheet.render({ force: true });
|
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 */
|
/* Application Drag/Drop */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
import { getDocFromElement } from '../../../helpers/utils.mjs';
|
||||||
import DHApplicationMixin from './application-mixin.mjs';
|
import DHApplicationMixin from './application-mixin.mjs';
|
||||||
|
|
||||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
@ -15,16 +15,14 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['item'],
|
classes: ['item'],
|
||||||
position: { width: 600 },
|
position: { width: 600 },
|
||||||
|
window: { resizable: true },
|
||||||
form: {
|
form: {
|
||||||
submitOnChange: true
|
submitOnChange: true
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addAction: DHBaseItemSheet.#addAction,
|
|
||||||
editAction: DHBaseItemSheet.#editAction,
|
|
||||||
removeAction: DHBaseItemSheet.#removeAction,
|
removeAction: DHBaseItemSheet.#removeAction,
|
||||||
addFeature: DHBaseItemSheet.#addFeature,
|
addFeature: DHBaseItemSheet.#addFeature,
|
||||||
editFeature: DHBaseItemSheet.#editFeature,
|
deleteFeature: DHBaseItemSheet.#deleteFeature,
|
||||||
removeFeature: DHBaseItemSheet.#removeFeature,
|
|
||||||
addResource: DHBaseItemSheet.#addResource,
|
addResource: DHBaseItemSheet.#addResource,
|
||||||
removeResource: DHBaseItemSheet.#removeResource
|
removeResource: DHBaseItemSheet.#removeResource
|
||||||
},
|
},
|
||||||
|
|
@ -32,6 +30,16 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
{ dragSelector: null, dropSelector: '.tab.features .drop-section' },
|
{ dragSelector: null, dropSelector: '.tab.features .drop-section' },
|
||||||
{ dragSelector: '.feature-item', dropSelector: null },
|
{ dragSelector: '.feature-item', dropSelector: null },
|
||||||
{ dragSelector: '.action-item', dropSelector: null }
|
{ dragSelector: '.action-item', dropSelector: null }
|
||||||
|
],
|
||||||
|
contextMenus: [
|
||||||
|
{
|
||||||
|
handler: DHBaseItemSheet.#getFeatureContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="feature"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -40,7 +48,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'settings' }, { id: 'actions' }],
|
tabs: [{ id: 'description' }, { id: 'settings' }, { id: 'actions' }, { id: 'effects' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
|
|
@ -51,8 +59,8 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async _preparePartContext(partId, context) {
|
async _preparePartContext(partId, context, options) {
|
||||||
await super._preparePartContext(partId, context);
|
await super._preparePartContext(partId, context, options);
|
||||||
const { TextEditor } = foundry.applications.ux;
|
const { TextEditor } = foundry.applications.ux;
|
||||||
|
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
|
|
@ -64,77 +72,78 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
secrets: this.item.isOwner
|
secrets: this.item.isOwner
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "effects":
|
||||||
|
await this._prepareEffectsContext(context, options)
|
||||||
|
break;
|
||||||
|
case "features":
|
||||||
|
context.isGM = game.user.isGM;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
/* Application Clicks Actions */
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a dialog prompting the user to select an action type.
|
* Prepare render context for the Effect part.
|
||||||
*
|
* @param {ApplicationRenderContext} context
|
||||||
* @returns {Promise<object>} An object containing the selected action type.
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
*/
|
*/
|
||||||
static async selectActionType() {
|
async _prepareEffectsContext(context, _options) {
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(
|
context.effects = {
|
||||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
actives: [],
|
||||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
inactives: [],
|
||||||
),
|
};
|
||||||
title = 'Select Action Type';
|
|
||||||
|
|
||||||
return foundry.applications.api.DialogV2.prompt({
|
for (const effect of this.item.effects) {
|
||||||
window: { title },
|
const list = effect.active ? context.effects.actives : context.effects.inactives;
|
||||||
content,
|
list.push(effect);
|
||||||
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.
|
|
||||||
* @type {ApplicationClickAction}
|
|
||||||
*/
|
|
||||||
static async #addAction(_event, _button) {
|
|
||||||
const actionType = await DHBaseItemSheet.selectActionType();
|
|
||||||
if (!actionType) return;
|
|
||||||
try {
|
|
||||||
const cls =
|
|
||||||
game.system.api.models.actions.actionsTypes[actionType] ??
|
|
||||||
game.system.api.models.actions.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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Context Menu */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit an existing action on the item
|
* Get the set of ContextMenu options for Features.
|
||||||
* @type {ApplicationClickAction}
|
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
|
||||||
|
* @this {DHSheetV2}
|
||||||
|
* @protected
|
||||||
*/
|
*/
|
||||||
static async #editAction(_event, button) {
|
static #getFeatureContextOptions() {
|
||||||
const action = this.document.system.actions[button.dataset.index];
|
const options = this._getContextMenuCommonOptions({ usable: true, toChat: true, deletable: false })
|
||||||
await new DHActionConfig(action).render({ force: true });
|
options.push(
|
||||||
|
{
|
||||||
|
name: 'CONTROLS.CommonDelete',
|
||||||
|
icon: '<i class="fa-solid fa-trash"></i>',
|
||||||
|
callback: async (target) => {
|
||||||
|
const feature = getDocFromElement(target);
|
||||||
|
if (!feature) return;
|
||||||
|
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||||
|
window: {
|
||||||
|
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||||
|
type: game.i18n.localize(`TYPES.Item.feature`),
|
||||||
|
name: feature.name
|
||||||
|
})
|
||||||
|
},
|
||||||
|
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: feature.name })
|
||||||
|
});
|
||||||
|
if (!confirmed) return;
|
||||||
|
await this.document.update({
|
||||||
|
'system.features': this.document.system.toObject().features.filter(uuid => uuid !== feature.uuid)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Application Clicks Actions */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an action from the item.
|
* Remove an action from the item.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
@ -144,16 +153,19 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
const actionIndex = button.closest('[data-index]').dataset.index;
|
const actionIndex = button.closest('[data-index]').dataset.index;
|
||||||
const action = this.document.system.actions[actionIndex];
|
const action = this.document.system.actions[actionIndex];
|
||||||
|
|
||||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
if(!event.shiftKey) {
|
||||||
window: {
|
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
window: {
|
||||||
type: game.i18n.localize(`DAGGERHEART.GENERAL.Action.single`),
|
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||||
name: action.name
|
type: game.i18n.localize(`DAGGERHEART.GENERAL.Action.single`),
|
||||||
})
|
name: action.name
|
||||||
},
|
})
|
||||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: action.name })
|
},
|
||||||
});
|
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: action.name })
|
||||||
if (!confirmed) return;
|
});
|
||||||
|
if (!confirmed) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||||
|
|
@ -164,57 +176,31 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
* Add a new feature to the item, prompting the user for its type.
|
* Add a new feature to the item, prompting the user for its type.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async #addFeature(_event, _button) {
|
static async #addFeature(_, target) {
|
||||||
const feature = await game.items.documentClass.create({
|
const { type } = target.dataset;
|
||||||
|
const cls = foundry.documents.Item.implementation;
|
||||||
|
const feature = await cls.create({
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
|
name: cls.defaultName({ type: 'feature' }),
|
||||||
|
"system.subType": CONFIG.DH.ITEM.featureSubTypes[type]
|
||||||
});
|
});
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid]
|
'system.features': [...this.document.system.features, feature].map(f => f.uuid)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing feature on the item
|
|
||||||
* @type {ApplicationClickAction}
|
|
||||||
*/
|
|
||||||
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.
|
* Remove a feature from the item.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
*/
|
*/
|
||||||
static async #removeFeature(event, button) {
|
static async #deleteFeature(_, target) {
|
||||||
event.stopPropagation();
|
const feature = getDocFromElement(target);
|
||||||
const target = button.closest('.feature-item');
|
if (!feature) return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.featureIsMissing'));
|
||||||
const feature = this.document.system.features.find(x => x && x.id === target.id);
|
await feature.update({ 'system.subType': null });
|
||||||
|
|
||||||
if (feature) {
|
|
||||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
|
||||||
window: {
|
|
||||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
|
||||||
type: game.i18n.localize(`TYPES.Item.feature`),
|
|
||||||
name: feature.name
|
|
||||||
})
|
|
||||||
},
|
|
||||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: feature.name })
|
|
||||||
});
|
|
||||||
if (!confirmed) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.features': this.document.system.features
|
'system.features': this.document.system.features
|
||||||
.filter(feature => feature && feature.id !== target.id)
|
|
||||||
.map(x => x.uuid)
|
.map(x => x.uuid)
|
||||||
|
.filter(uuid => uuid !== feature.uuid)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ export default class AncestrySheet extends DHHeritageSheet {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['ancestry'],
|
classes: ['ancestry'],
|
||||||
actions: {
|
actions: {
|
||||||
addFeature: AncestrySheet.#addFeature,
|
|
||||||
editFeature: AncestrySheet.#editFeature,
|
editFeature: AncestrySheet.#editFeature,
|
||||||
removeFeature: AncestrySheet.#removeFeature
|
removeFeature: AncestrySheet.#removeFeature
|
||||||
},
|
},
|
||||||
|
|
@ -23,23 +22,6 @@ export default class AncestrySheet extends DHHeritageSheet {
|
||||||
/* Application Clicks Actions */
|
/* Application Clicks Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new feature to the item, prompting the user for its type.
|
|
||||||
* @type {ApplicationClickAction}
|
|
||||||
*/
|
|
||||||
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') }),
|
|
||||||
system: {
|
|
||||||
subType: button.dataset.type
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await this.document.update({
|
|
||||||
'system.features': [...this.document.system.features.map(x => x.uuid), feature.uuid]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit an existing feature on the item
|
* Edit an existing feature on the item
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
},
|
},
|
||||||
...super.PARTS
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
|
},
|
||||||
|
...super.PARTS,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,4 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@inheritdoc */
|
|
||||||
async _prepareContext(_options) {
|
|
||||||
const context = await super._prepareContext(_options);
|
|
||||||
|
|
||||||
context.document = context.document.toObject();
|
|
||||||
context.document.effects = this.document.effects.map(effect => {
|
|
||||||
const data = effect.toObject();
|
|
||||||
data.id = effect.id;
|
|
||||||
if (effect.type === 'beastform') data.mandatory = true;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,6 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
actions: {
|
actions: {
|
||||||
removeItemFromCollection: ClassSheet.#removeItemFromCollection,
|
removeItemFromCollection: ClassSheet.#removeItemFromCollection,
|
||||||
removeSuggestedItem: ClassSheet.#removeSuggestedItem,
|
removeSuggestedItem: ClassSheet.#removeSuggestedItem,
|
||||||
viewDoc: ClassSheet.#viewDoc,
|
|
||||||
addFeature: this.addFeature,
|
|
||||||
editFeature: this.editFeature,
|
|
||||||
deleteFeature: this.deleteFeature
|
|
||||||
},
|
},
|
||||||
tagifyConfigs: [
|
tagifyConfigs: [
|
||||||
{
|
{
|
||||||
|
|
@ -46,13 +42,17 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/class/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/class/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }],
|
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }, { id: 'effects' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
|
|
@ -179,59 +179,4 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
const { target } = element.dataset;
|
const { target } = element.dataset;
|
||||||
await this.document.update({ [`system.characterGuide.${target}`]: null });
|
await this.document.update({ [`system.characterGuide.${target}`]: null });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the sheet of a item by UUID.
|
|
||||||
* @param {PointerEvent} _event -
|
|
||||||
* @param {HTMLElement} button
|
|
||||||
*/
|
|
||||||
static async #viewDoc(_event, button) {
|
|
||||||
const doc = await fromUuid(button.dataset.uuid);
|
|
||||||
doc.sheet.render({ force: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
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') }),
|
|
||||||
system: {
|
|
||||||
subType:
|
|
||||||
target.dataset.type === 'hope'
|
|
||||||
? CONFIG.DH.ITEM.featureSubTypes.hope
|
|
||||||
: CONFIG.DH.ITEM.featureSubTypes.class
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await this.document.update({
|
|
||||||
[`system.features`]: [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static async editFeature(_, button) {
|
|
||||||
const target = button.closest('.feature-item');
|
|
||||||
const feature = this.document.system.features.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 feature = this.document.system.features.find(
|
|
||||||
feature => feature && feature.id === target.dataset.featureId
|
|
||||||
);
|
|
||||||
if (feature) {
|
|
||||||
await feature.update({ 'system.subType': null });
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.document.update({
|
|
||||||
[`system.features`]: this.document.system.features
|
|
||||||
.filter(feature => feature && feature.id !== target.dataset.featureId)
|
|
||||||
.map(x => x.uuid)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default class CommunitySheet extends DHHeritageSheet {
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/community/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/community/header.hbs' },
|
||||||
...super.PARTS,
|
...super.PARTS,
|
||||||
feature: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.feature']
|
scrollable: ['.feature']
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ export default class ConsumableSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/consumable/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/consumable/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
|
||||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
|
||||||
import DHBaseItemSheet from '../api/base-item.mjs';
|
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||||
|
|
||||||
export default class FeatureSheet extends DHBaseItemSheet {
|
export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
|
|
@ -7,13 +5,7 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
id: 'daggerheart-feature',
|
id: 'daggerheart-feature',
|
||||||
classes: ['feature'],
|
classes: ['feature'],
|
||||||
position: { height: 600 },
|
actions: {}
|
||||||
window: { resizable: true },
|
|
||||||
actions: {
|
|
||||||
addAction: FeatureSheet.#addAction,
|
|
||||||
editAction: FeatureSheet.#editAction,
|
|
||||||
removeAction: FeatureSheet.#removeAction
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@override */
|
/**@override */
|
||||||
|
|
@ -40,96 +32,4 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
|
|
||||||
/**@inheritdoc */
|
|
||||||
async _prepareContext(_options) {
|
|
||||||
const context = await super._prepareContext(_options);
|
|
||||||
|
|
||||||
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,
|
|
||||||
itemName: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType')
|
|
||||||
}
|
|
||||||
),
|
|
||||||
title = game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType');
|
|
||||||
|
|
||||||
return foundry.applications.api.DialogV2.prompt({
|
|
||||||
window: { title },
|
|
||||||
classes: ['daggerheart', 'dh-style'],
|
|
||||||
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))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ export default class MiscellaneousSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,7 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
||||||
classes: ['subclass'],
|
classes: ['subclass'],
|
||||||
position: { width: 600 },
|
position: { width: 600 },
|
||||||
window: { resizable: false },
|
window: { resizable: false },
|
||||||
actions: {
|
actions: {}
|
||||||
addFeature: this.addFeature,
|
|
||||||
editFeature: this.editFeature,
|
|
||||||
deleteFeature: this.deleteFeature
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@override */
|
/**@override */
|
||||||
|
|
@ -25,64 +21,22 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/subclass/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/subclass/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }],
|
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }, { id: 'effects' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
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') }),
|
|
||||||
system: {
|
|
||||||
subType:
|
|
||||||
target.dataset.type === 'foundation'
|
|
||||||
? CONFIG.DH.ITEM.featureSubTypes.foundation
|
|
||||||
: target.dataset.type === 'specialization'
|
|
||||||
? CONFIG.DH.ITEM.featureSubTypes.specialization
|
|
||||||
: CONFIG.DH.ITEM.featureSubTypes.mastery
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await this.document.update({
|
|
||||||
[`system.features`]: [...this.document.system.features.map(x => x.uuid), feature.uuid]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static async editFeature(_, button) {
|
|
||||||
const feature = this.document.system.features.find(x => x.id === button.dataset.feature);
|
|
||||||
if (!feature) {
|
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.featureIsMissing'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (feature) {
|
|
||||||
await feature.update({ 'system.subType': null });
|
|
||||||
}
|
|
||||||
|
|
||||||
feature.sheet.render(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async deleteFeature(event, target) {
|
|
||||||
event.stopPropagation();
|
|
||||||
const feature = this.document.system.features.find(feature => feature.id === target.dataset.feature);
|
|
||||||
if (feature) {
|
|
||||||
await feature.update({ 'system.subType': null });
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.document.update({
|
|
||||||
[`system.features`]: this.document.system.features
|
|
||||||
.filter(feature => feature && feature.id !== target.dataset.feature)
|
|
||||||
.map(x => x.uuid)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async _onDragStart(event) {
|
async _onDragStart(event) {
|
||||||
const featureItem = event.currentTarget.closest('.drop-section');
|
const featureItem = event.currentTarget.closest('.drop-section');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@ export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
},
|
},
|
||||||
...super.PARTS
|
effects: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
scrollable: ['.effects']
|
||||||
|
},
|
||||||
|
...super.PARTS,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.attackTargetDoesNotExist'));
|
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.attackTargetDoesNotExist'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.canvas.pan(token);
|
game.canvas.pan(token);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -207,15 +206,24 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
if (!confirm) return;
|
if (!confirm) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targets.length === 0)
|
if (targets.length === 0)
|
||||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||||
for (let target of targets) {
|
|
||||||
let damage = message.system.roll.total;
|
|
||||||
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true)
|
|
||||||
damage = Math.ceil(damage * (CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1));
|
|
||||||
|
|
||||||
target.actor.takeDamage(damage, message.system.damage.damageType);
|
for (let target of targets) {
|
||||||
|
let damages = foundry.utils.deepClone(message.system.damage?.roll ?? message.system.roll);
|
||||||
|
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true) {
|
||||||
|
const mod = CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1;
|
||||||
|
Object.entries(damages).forEach(([k,v]) => {
|
||||||
|
v.total = 0;
|
||||||
|
v.parts.forEach(part => {
|
||||||
|
part.total = Math.ceil(part.total * mod);
|
||||||
|
v.total += part.total;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
target.actor.takeDamage(damages);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -224,10 +232,10 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
const targets = Array.from(game.user.targets);
|
const targets = Array.from(game.user.targets);
|
||||||
|
|
||||||
if (targets.length === 0)
|
if (targets.length === 0)
|
||||||
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||||
|
|
||||||
for (var target of targets) {
|
for (var target of targets) {
|
||||||
target.actor.takeHealing([{ value: message.system.roll.total, type: message.system.roll.type }]);
|
target.actor.takeHealing(message.system.roll);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ export default class DHContextMenu extends foundry.applications.ux.ContextMenu {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const { clientX, clientY } = event;
|
const { clientX, clientY } = event;
|
||||||
const selector = '[data-item-id]';
|
const selector = '[data-item-uuid]';
|
||||||
const target = event.target.closest(selector) ?? event.currentTarget.closest(selector);
|
const target = event.target.closest(selector) ?? event.currentTarget.closest(selector);
|
||||||
target?.dispatchEvent(
|
target?.dispatchEvent(
|
||||||
new PointerEvent('contextmenu', {
|
new PointerEvent('contextmenu', {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,11 @@ export const healingTypes = {
|
||||||
id: 'armorStack',
|
id: 'armorStack',
|
||||||
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorStack.abbreviation'
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorStack.abbreviation'
|
||||||
|
},
|
||||||
|
fear: {
|
||||||
|
id: 'fear',
|
||||||
|
label: 'DAGGERHEART.CONFIG.HealingType.fear.name',
|
||||||
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.fear.abbreviation'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,32 @@ export class DHDamageField extends fields.SchemaField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DHDamageData extends foundry.abstract.DataModel {
|
export class DHResourceData extends foundry.abstract.DataModel {
|
||||||
/** @override */
|
/** @override */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
|
applyTo: new fields.StringField({
|
||||||
|
choices: CONFIG.DH.GENERAL.healingTypes,
|
||||||
|
required: true,
|
||||||
|
blank: false,
|
||||||
|
initial: CONFIG.DH.GENERAL.healingTypes.hitPoints.id,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.applyTo.label'
|
||||||
|
}),
|
||||||
|
resultBased: new fields.BooleanField({
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
||||||
|
}),
|
||||||
|
value: new fields.EmbeddedDataField(DHActionDiceData),
|
||||||
|
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DHDamageData extends DHResourceData {
|
||||||
|
/** @override */
|
||||||
|
static defineSchema() {
|
||||||
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
||||||
type: new fields.SetField(
|
type: new fields.SetField(
|
||||||
new fields.StringField({
|
new fields.StringField({
|
||||||
|
|
@ -109,16 +131,9 @@ export class DHDamageData extends foundry.abstract.DataModel {
|
||||||
required: true
|
required: true
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
label: 'Type',
|
label: 'Type'
|
||||||
initial: 'physical'
|
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
resultBased: new fields.BooleanField({
|
}
|
||||||
initial: false,
|
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
|
||||||
}),
|
|
||||||
value: new fields.EmbeddedDataField(DHActionDiceData),
|
|
||||||
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { DHActionDiceData, DHActionRollData, DHDamageField } from './actionDice.mjs';
|
import { DHActionDiceData, DHActionRollData, DHDamageData, DHDamageField, DHResourceData } from './actionDice.mjs';
|
||||||
import DhpActor from '../../documents/actor.mjs';
|
import DhpActor from '../../documents/actor.mjs';
|
||||||
import D20RollDialog from '../../applications/dialogs/d20RollDialog.mjs';
|
import D20RollDialog from '../../applications/dialogs/d20RollDialog.mjs';
|
||||||
|
|
||||||
|
|
@ -96,21 +96,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
onSave: new fields.BooleanField({ initial: false })
|
onSave: new fields.BooleanField({ initial: false })
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
healing: new fields.SchemaField({
|
healing: new fields.EmbeddedDataField(DHResourceData),
|
||||||
type: new fields.StringField({
|
|
||||||
choices: CONFIG.DH.GENERAL.healingTypes,
|
|
||||||
required: true,
|
|
||||||
blank: false,
|
|
||||||
initial: CONFIG.DH.GENERAL.healingTypes.hitPoints.id,
|
|
||||||
label: 'Healing'
|
|
||||||
}),
|
|
||||||
resultBased: new fields.BooleanField({
|
|
||||||
initial: false,
|
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
|
||||||
}),
|
|
||||||
value: new fields.EmbeddedDataField(DHActionDiceData),
|
|
||||||
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
|
||||||
}),
|
|
||||||
beastform: new fields.SchemaField({
|
beastform: new fields.SchemaField({
|
||||||
tierAccess: new fields.SchemaField({
|
tierAccess: new fields.SchemaField({
|
||||||
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
||||||
|
|
@ -156,7 +142,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
static getSourceConfig(parent) {
|
static getSourceConfig(parent) {
|
||||||
const updateSource = {};
|
const updateSource = {};
|
||||||
updateSource.img ??= parent?.img ?? parent?.system?.img;
|
updateSource.img ??= parent?.img ?? parent?.system?.img;
|
||||||
if (parent?.type === 'weapon') {
|
if (parent?.type === 'weapon' && this === game.system.api.models.actions.actionsTypes.attack) {
|
||||||
updateSource['damage'] = { includeBase: true };
|
updateSource['damage'] = { includeBase: true };
|
||||||
updateSource['range'] = parent?.system?.attack?.range;
|
updateSource['range'] = parent?.system?.attack?.range;
|
||||||
updateSource['roll'] = {
|
updateSource['roll'] = {
|
||||||
|
|
@ -177,6 +163,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
getRollData(data = {}) {
|
getRollData(data = {}) {
|
||||||
|
if(!this.actor) return null;
|
||||||
const actorData = this.actor.getRollData(false);
|
const actorData = this.actor.getRollData(false);
|
||||||
|
|
||||||
// Add Roll results to RollDatas
|
// Add Roll results to RollDatas
|
||||||
|
|
@ -191,6 +178,8 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async use(event, ...args) {
|
async use(event, ...args) {
|
||||||
|
if(!this.actor) throw new Error("An Action can't be used outside of an Actor context.");
|
||||||
|
|
||||||
const isFastForward = event.shiftKey || (!this.hasRoll && !this.hasSave);
|
const isFastForward = event.shiftKey || (!this.hasRoll && !this.hasSave);
|
||||||
// Prepare base Config
|
// Prepare base Config
|
||||||
const initConfig = this.initActionConfig(event);
|
const initConfig = this.initActionConfig(event);
|
||||||
|
|
@ -227,7 +216,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.preUseAction`, this, config) === false) return;
|
if (Hooks.call(`${CONFIG.DH.id}.preUseAction`, this, config) === false) return;
|
||||||
|
|
||||||
// Display configuration window if necessary
|
// Display configuration window if necessary
|
||||||
// if (config.dialog?.configure && this.requireConfigurationDialog(config)) {
|
|
||||||
if (this.requireConfigurationDialog(config)) {
|
if (this.requireConfigurationDialog(config)) {
|
||||||
config = await D20RollDialog.configure(null, config);
|
config = await D20RollDialog.configure(null, config);
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { setsEqual } from '../../helpers/utils.mjs';
|
||||||
import DHBaseAction from './baseAction.mjs';
|
import DHBaseAction from './baseAction.mjs';
|
||||||
|
|
||||||
export default class DHDamageAction extends DHBaseAction {
|
export default class DHDamageAction extends DHBaseAction {
|
||||||
|
|
@ -18,28 +19,40 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
return formulaValue;
|
return formulaValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formatFormulas(formulas, systemData) {
|
||||||
|
const formattedFormulas = [];
|
||||||
|
formulas.forEach(formula => {
|
||||||
|
if (isNaN(formula.formula)) formula.formula = Roll.replaceFormulaData(formula.formula, this.getRollData(systemData));
|
||||||
|
const same = formattedFormulas.find(f => setsEqual(f.damageTypes, formula.damageTypes) && f.applyTo === formula.applyTo);
|
||||||
|
if(same)
|
||||||
|
same.formula += ` + ${formula.formula}`;
|
||||||
|
else
|
||||||
|
formattedFormulas.push(formula);
|
||||||
|
})
|
||||||
|
return formattedFormulas;
|
||||||
|
}
|
||||||
|
|
||||||
async rollDamage(event, data) {
|
async rollDamage(event, data) {
|
||||||
const systemData = data.system ?? data;
|
const systemData = data.system ?? data;
|
||||||
let formula = this.damage.parts.map(p => this.getFormulaValue(p, data).getFormula(this.actor)).join(' + '),
|
|
||||||
damageTypes = [...new Set(this.damage.parts.reduce((a, c) => a.concat([...c.type]), []))];
|
let formulas = this.damage.parts.map(p => ({
|
||||||
|
formula: this.getFormulaValue(p, data).getFormula(this.actor),
|
||||||
|
damageTypes: p.applyTo === 'hitPoints' && !p.type.size ? new Set(['physical']) : p.type,
|
||||||
|
applyTo: p.applyTo
|
||||||
|
}));
|
||||||
|
|
||||||
damageTypes = !damageTypes.length ? ['physical'] : damageTypes;
|
if(!formulas.length) return;
|
||||||
|
|
||||||
if (!formula || formula == '') return;
|
formulas = this.formatFormulas(formulas, systemData);
|
||||||
let roll = { formula: formula, total: formula },
|
|
||||||
bonusDamage = [];
|
|
||||||
|
|
||||||
if (isNaN(formula)) formula = Roll.replaceFormulaData(formula, this.getRollData(systemData));
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
title: game.i18n.format('DAGGERHEART.UI.Chat.damageRoll.title', { damage: this.name }),
|
title: game.i18n.format('DAGGERHEART.UI.Chat.damageRoll.title', { damage: this.name }),
|
||||||
roll: { formula },
|
roll: formulas,
|
||||||
targets: systemData.targets.filter(t => t.hit) ?? data.targets,
|
targets: systemData.targets.filter(t => t.hit) ?? data.targets,
|
||||||
hasSave: this.hasSave,
|
hasSave: this.hasSave,
|
||||||
isCritical: systemData.roll?.isCritical ?? false,
|
isCritical: systemData.roll?.isCritical ?? false,
|
||||||
source: systemData.source,
|
source: systemData.source,
|
||||||
data: this.getRollData(),
|
data: this.getRollData(),
|
||||||
damageTypes,
|
|
||||||
event
|
event
|
||||||
};
|
};
|
||||||
if (this.hasSave) config.onSave = this.save.damageMod;
|
if (this.hasSave) config.onSave = this.save.damageMod;
|
||||||
|
|
@ -50,10 +63,6 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
config.directDamage = true;
|
config.directDamage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
return CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get modifiers() {
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,25 +15,25 @@ export default class DHHealingAction extends DHBaseAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollHealing(event, data) {
|
async rollHealing(event, data) {
|
||||||
let formulaValue = this.getFormulaValue(data),
|
const systemData = data.system ?? data;
|
||||||
formula = formulaValue.getFormula(this.actor);
|
let formulas = [{
|
||||||
|
formula: this.getFormulaValue(data).getFormula(this.actor),
|
||||||
if (!formula || formula == '') return;
|
applyTo: this.healing.applyTo
|
||||||
let roll = { formula: formula, total: formula },
|
}];
|
||||||
bonusDamage = [];
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
title: game.i18n.format('DAGGERHEART.UI.Chat.healingRoll.title', {
|
title: game.i18n.format('DAGGERHEART.UI.Chat.healingRoll.title', {
|
||||||
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.type].label)
|
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.applyTo].label)
|
||||||
}),
|
}),
|
||||||
roll: { formula },
|
roll: formulas,
|
||||||
targets: (data.system?.targets ?? data.targets).filter(t => t.hit),
|
targets: (data.system?.targets ?? data.targets).filter(t => t.hit),
|
||||||
messageType: 'healing',
|
messageType: 'healing',
|
||||||
type: this.healing.type,
|
source: systemData.source,
|
||||||
|
data: this.getRollData(),
|
||||||
event
|
event
|
||||||
};
|
};
|
||||||
|
|
||||||
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
return CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
get chatTemplate() {
|
get chatTemplate() {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
scars: new fields.TypedObjectField(
|
scars: new fields.TypedObjectField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
name: new fields.StringField({}),
|
name: new fields.StringField({}),
|
||||||
description: new fields.HTMLField()
|
description: new fields.StringField()
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
biography: new fields.SchemaField({
|
biography: new fields.SchemaField({
|
||||||
|
|
@ -170,11 +170,10 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
rules: new fields.SchemaField({
|
rules: new fields.SchemaField({
|
||||||
damageReduction: new fields.SchemaField({
|
damageReduction: new fields.SchemaField({
|
||||||
maxArmorMarked: new fields.SchemaField({
|
maxArmorMarked: new fields.SchemaField({
|
||||||
value: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
value: new fields.NumberField({
|
||||||
bonus: new fields.NumberField({
|
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
initial: 0,
|
initial: 1,
|
||||||
label: 'DAGGERHEART.GENERAL.Rules.damageReduction.maxArmorMarkedBonus'
|
label: 'DAGGERHEART.GENERAL.Rules.damageReduction.maxArmorMarkedBonus'
|
||||||
}),
|
}),
|
||||||
stressExtra: new fields.NumberField({
|
stressExtra: new fields.NumberField({
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ export default class DhCompanion extends BaseDataActor {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
label: 'TYPES.Actor.companion',
|
label: 'TYPES.Actor.companion',
|
||||||
type: 'companion',
|
type: 'companion',
|
||||||
|
isNPC: false,
|
||||||
settingSheet: DHCompanionSettings
|
settingSheet: DHCompanionSettings
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,28 +140,22 @@ export default class D20Roll extends DHRoll {
|
||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
|
||||||
if (config.evaluate !== false) await roll.evaluate();
|
|
||||||
|
|
||||||
this.postEvaluate(roll, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
static postEvaluate(roll, config = {}) {
|
static postEvaluate(roll, config = {}) {
|
||||||
super.postEvaluate(roll, config);
|
const data = super.postEvaluate(roll, config);
|
||||||
if (config.targets?.length) {
|
if (config.targets?.length) {
|
||||||
config.targets.forEach(target => {
|
config.targets.forEach(target => {
|
||||||
const difficulty = config.roll.difficulty ?? target.difficulty ?? target.evasion;
|
const difficulty = config.roll.difficulty ?? target.difficulty ?? target.evasion;
|
||||||
target.hit = this.isCritical || roll.total >= difficulty;
|
target.hit = this.isCritical || roll.total >= difficulty;
|
||||||
});
|
});
|
||||||
} else if (config.roll.difficulty)
|
} else if (config.roll.difficulty)
|
||||||
config.roll.success = roll.isCritical || roll.total >= config.roll.difficulty;
|
data.success = roll.isCritical || roll.total >= config.roll.difficulty;
|
||||||
config.roll.advantage = {
|
data.advantage = {
|
||||||
type: config.roll.advantage,
|
type: config.roll.advantage,
|
||||||
dice: roll.dAdvantage?.denomination,
|
dice: roll.dAdvantage?.denomination,
|
||||||
value: roll.dAdvantage?.total
|
value: roll.dAdvantage?.total
|
||||||
};
|
};
|
||||||
config.roll.isCritical = roll.isCritical;
|
data.isCritical = roll.isCritical;
|
||||||
config.roll.extra = roll.dice
|
data.extra = roll.dice
|
||||||
.filter(d => !roll.baseTerms.includes(d))
|
.filter(d => !roll.baseTerms.includes(d))
|
||||||
.map(d => {
|
.map(d => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -169,7 +163,8 @@ export default class D20Roll extends DHRoll {
|
||||||
value: d.total
|
value: d.total
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
data.modifierTotal = this.calculateTotalModifiers(roll);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFormula() {
|
resetFormula() {
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,24 @@ export default class DamageRoll extends DHRoll {
|
||||||
|
|
||||||
static DefaultDialog = DamageDialog;
|
static DefaultDialog = DamageDialog;
|
||||||
|
|
||||||
static async postEvaluate(roll, config = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
super.postEvaluate(roll, config);
|
if ( config.evaluate !== false ) {
|
||||||
config.roll.type = config.type;
|
for ( const roll of config.roll ) await roll.roll.evaluate();
|
||||||
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
}
|
||||||
|
roll._evaluated = true;
|
||||||
|
const parts = config.roll.map(r => this.postEvaluate(r));
|
||||||
|
config.roll = this.unifyDamageRoll(parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
static postEvaluate(roll, config = {}) {
|
||||||
|
return {
|
||||||
|
...roll,
|
||||||
|
...super.postEvaluate(roll.roll, config),
|
||||||
|
damageTypes: [...(roll.damageTypes ?? [])],
|
||||||
|
roll: roll.roll,
|
||||||
|
type: config.type,
|
||||||
|
modifierTotal: this.calculateTotalModifiers(roll.roll)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async buildPost(roll, config, message) {
|
static async buildPost(roll, config, message) {
|
||||||
|
|
@ -24,12 +38,50 @@ export default class DamageRoll extends DHRoll {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applyBaseBonus() {
|
static unifyDamageRoll(rolls) {
|
||||||
|
const unified = {};
|
||||||
|
rolls.forEach(r => {
|
||||||
|
const resource = unified[r.applyTo] ?? { formula: '', total: 0, parts: [] };
|
||||||
|
resource.formula += `${resource.formula !== '' ? ' + ' : ''}${r.formula}`;
|
||||||
|
resource.total += r.total;
|
||||||
|
resource.parts.push(r);
|
||||||
|
unified[r.applyTo] = resource;
|
||||||
|
})
|
||||||
|
return unified;
|
||||||
|
}
|
||||||
|
|
||||||
|
static formatGlobal(rolls) {
|
||||||
|
let formula, total;
|
||||||
|
const applyTo = new Set(rolls.flatMap(r => r.applyTo));
|
||||||
|
if(applyTo.size > 1) {
|
||||||
|
const data = {};
|
||||||
|
rolls.forEach(r => {
|
||||||
|
if(data[r.applyTo]) {
|
||||||
|
data[r.applyTo].formula += ` + ${r.formula}` ;
|
||||||
|
data[r.applyTo].total += r.total ;
|
||||||
|
} else {
|
||||||
|
data[r.applyTo] = {
|
||||||
|
formula: r.formula,
|
||||||
|
total: r.total
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
formula = Object.entries(data).reduce((a, [k,v]) => a + ` ${k}: ${v.formula}`, '');
|
||||||
|
total = Object.entries(data).reduce((a, [k,v]) => a + ` ${k}: ${v.total}`, '');
|
||||||
|
} else {
|
||||||
|
formula = rolls.map(r => r.formula).join(' + ');
|
||||||
|
total = rolls.reduce((a,c) => a + c.total, 0)
|
||||||
|
}
|
||||||
|
return {formula, total}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyBaseBonus(part) {
|
||||||
const modifiers = [],
|
const modifiers = [],
|
||||||
type = this.options.messageType ?? 'damage';
|
type = this.options.messageType ?? 'damage',
|
||||||
|
options = part ?? this.options;
|
||||||
|
|
||||||
modifiers.push(...this.getBonus(`${type}`, `${type.capitalize()} Bonus`));
|
modifiers.push(...this.getBonus(`${type}`, `${type.capitalize()} Bonus`));
|
||||||
this.options.damageTypes?.forEach(t => {
|
options.damageTypes?.forEach(t => {
|
||||||
modifiers.push(...this.getBonus(`${type}.${t}`, `${t.capitalize()} ${type.capitalize()} Bonus`));
|
modifiers.push(...this.getBonus(`${type}.${t}`, `${t.capitalize()} ${type.capitalize()} Bonus`));
|
||||||
});
|
});
|
||||||
const weapons = ['primaryWeapon', 'secondaryWeapon'];
|
const weapons = ['primaryWeapon', 'secondaryWeapon'];
|
||||||
|
|
@ -42,13 +94,36 @@ export default class DamageRoll extends DHRoll {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructFormula(config) {
|
constructFormula(config) {
|
||||||
super.constructFormula(config);
|
this.options.roll.forEach( part => {
|
||||||
|
part.roll = new Roll(part.formula);
|
||||||
|
this.constructFormulaPart(config, part)
|
||||||
|
})
|
||||||
|
return this.options.roll;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.isCritical) {
|
constructFormulaPart(config, part) {
|
||||||
const tmpRoll = new Roll(this._formula)._evaluateSync({ maximize: true }),
|
part.roll.terms = Roll.parse(part.roll.formula, config.data);
|
||||||
criticalBonus = tmpRoll.total - this.constructor.calculateTotalModifiers(tmpRoll);
|
|
||||||
this.terms.push(...this.formatModifier(criticalBonus));
|
if(part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||||
|
part.modifiers = this.applyBaseBonus(part);
|
||||||
|
this.addModifiers(part);
|
||||||
|
part.modifiers?.forEach(m => {
|
||||||
|
part.roll.terms.push(...this.formatModifier(m.value));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return (this._formula = this.constructor.getFormula(this.terms));
|
|
||||||
|
if (part.extraFormula) {
|
||||||
|
part.roll.terms.push(
|
||||||
|
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||||
|
...this.constructor.parse(part.extraFormula, this.options.data)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.isCritical && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||||
|
const tmpRoll = Roll.fromTerms(part.roll.terms)._evaluateSync({ maximize: true }),
|
||||||
|
criticalBonus = tmpRoll.total - this.constructor.calculateTotalModifiers(tmpRoll);
|
||||||
|
part.roll.terms.push(...this.formatModifier(criticalBonus));
|
||||||
|
}
|
||||||
|
return (part.roll._formula = this.constructor.getFormula(part.roll.terms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export default class DHRoll extends Roll {
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
if (config.evaluate !== false) await roll.evaluate();
|
if (config.evaluate !== false) await roll.evaluate();
|
||||||
this.postEvaluate(roll, config);
|
config.roll = this.postEvaluate(roll, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async buildPost(roll, config, message) {
|
static async buildPost(roll, config, message) {
|
||||||
|
|
@ -57,25 +57,26 @@ export default class DHRoll extends Roll {
|
||||||
|
|
||||||
// Create Chat Message
|
// Create Chat Message
|
||||||
if (config.source?.message) {
|
if (config.source?.message) {
|
||||||
|
if(Object.values(config.roll)?.length) {
|
||||||
|
const pool = foundry.dice.terms.PoolTerm.fromRolls(Object.values(config.roll).flatMap(r => r.parts.map(p => p.roll)));
|
||||||
|
roll = Roll.fromTerms([pool]);
|
||||||
|
}
|
||||||
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
|
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
|
||||||
} else {
|
} else
|
||||||
config.message = await this.toMessage(roll, config);
|
config.message = await this.toMessage(roll, config);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static postEvaluate(roll, config = {}) {
|
static postEvaluate(roll, config = {}) {
|
||||||
if (!config.roll) config.roll = {};
|
return {
|
||||||
config.roll.total = roll.total;
|
total: roll.total,
|
||||||
config.roll.formula = roll.formula;
|
formula: roll.formula,
|
||||||
config.roll.dice = [];
|
dice: roll.dice.map(d => ({
|
||||||
roll.dice.forEach(d => {
|
|
||||||
config.roll.dice.push({
|
|
||||||
dice: d.denomination,
|
dice: d.denomination,
|
||||||
total: d.total,
|
total: d.total,
|
||||||
formula: d.formula,
|
formula: d.formula,
|
||||||
results: d.results
|
results: d.results
|
||||||
});
|
}))
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async toMessage(roll, config) {
|
static async toMessage(roll, config) {
|
||||||
|
|
@ -118,8 +119,9 @@ export default class DHRoll extends Roll {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
addModifiers() {
|
addModifiers(roll) {
|
||||||
this.options.roll.modifiers?.forEach(m => {
|
roll = roll ?? this.options.roll;
|
||||||
|
roll.modifiers?.forEach(m => {
|
||||||
this.terms.push(...this.formatModifier(m.value));
|
this.terms.push(...this.formatModifier(m.value));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,21 +161,21 @@ export default class DualityRoll extends D20Roll {
|
||||||
}
|
}
|
||||||
|
|
||||||
static postEvaluate(roll, config = {}) {
|
static postEvaluate(roll, config = {}) {
|
||||||
super.postEvaluate(roll, config);
|
const data = super.postEvaluate(roll, config);
|
||||||
|
|
||||||
config.roll.hope = {
|
data.hope = {
|
||||||
dice: roll.dHope.denomination,
|
dice: roll.dHope.denomination,
|
||||||
value: roll.dHope.total
|
value: roll.dHope.total
|
||||||
};
|
};
|
||||||
config.roll.fear = {
|
data.fear = {
|
||||||
dice: roll.dFear.denomination,
|
dice: roll.dFear.denomination,
|
||||||
value: roll.dFear.total
|
value: roll.dFear.total
|
||||||
};
|
};
|
||||||
config.roll.rally = {
|
data.rally = {
|
||||||
dice: roll.dRally?.denomination,
|
dice: roll.dRally?.denomination,
|
||||||
value: roll.dRally?.total
|
value: roll.dRally?.total
|
||||||
};
|
};
|
||||||
config.roll.result = {
|
data.result = {
|
||||||
duality: roll.withHope ? 1 : roll.withFear ? -1 : 0,
|
duality: roll.withHope ? 1 : roll.withFear ? -1 : 0,
|
||||||
total: roll.dHope.total + roll.dFear.total,
|
total: roll.dHope.total + roll.dFear.total,
|
||||||
label: roll.totalLabel
|
label: roll.totalLabel
|
||||||
|
|
@ -184,6 +184,8 @@ export default class DualityRoll extends D20Roll {
|
||||||
if(roll._rallyIndex && roll.data?.parent)
|
if(roll._rallyIndex && roll.data?.parent)
|
||||||
roll.data.parent.deleteEmbeddedDocuments('ActiveEffect', [roll._rallyIndex]);
|
roll.data.parent.deleteEmbeddedDocuments('ActiveEffect', [roll._rallyIndex]);
|
||||||
|
|
||||||
setDiceSoNiceForDualityRoll(roll, config.roll.advantage.type);
|
setDiceSoNiceForDualityRoll(roll, data.advantage.type);
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,59 +391,70 @@ export default class DhpActor extends Actor {
|
||||||
return canUseArmor || canUseStress;
|
return canUseArmor || canUseStress;
|
||||||
}
|
}
|
||||||
|
|
||||||
async takeDamage(baseDamage, type) {
|
async takeDamage(damages) {
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, baseDamage, type) === false) return null;
|
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, damages) === false) return null;
|
||||||
|
|
||||||
if (this.type === 'companion') {
|
if (this.type === 'companion') {
|
||||||
await this.modifyResource([{ value: 1, key: 'stress' }]);
|
await this.modifyResource([{ value: 1, key: 'stress' }]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = !Array.isArray(type) ? [type] : type;
|
const updates = [];
|
||||||
|
|
||||||
const hpDamage = this.calculateDamage(baseDamage, type);
|
Object.entries(damages).forEach(([key, damage]) => {
|
||||||
|
damage.parts.forEach(part => {
|
||||||
|
if(part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
|
||||||
|
part.total = this.calculateDamage(part.total, part.damageTypes);
|
||||||
|
const update = updates.find(u => u.key === key);
|
||||||
|
if(update) {
|
||||||
|
update.value += part.total;
|
||||||
|
update.damageTypes.add(...new Set(part.damageTypes));
|
||||||
|
} else updates.push({ value: part.total, key, damageTypes: new Set(part.damageTypes) })
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
if (!hpDamage) return;
|
if (Hooks.call(`${CONFIG.DH.id}.postCalculateDamage`, this, damages) === false) return null;
|
||||||
|
|
||||||
const updates = [{ value: hpDamage, type: 'hitPoints' }];
|
if(!updates.length) return;
|
||||||
|
|
||||||
if (this.type === 'character' && this.system.armor && this.#canReduceDamage(hpDamage, type)) {
|
const hpDamage = updates.find(u => u.key === CONFIG.DH.GENERAL.healingTypes.hitPoints.id);
|
||||||
const armorStackResult = await this.owner.query('armorStack', {
|
if(hpDamage) {
|
||||||
actorId: this.uuid,
|
hpDamage.value = this.convertDamageToThreshold(hpDamage.value);
|
||||||
damage: hpDamage,
|
if (this.type === 'character' && this.system.armor && this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)) {
|
||||||
type: type
|
const armorStackResult = await this.owner.query('armorStack', {
|
||||||
});
|
actorId: this.uuid,
|
||||||
if (armorStackResult) {
|
damage: hpDamage.value,
|
||||||
const { modifiedDamage, armorSpent, stressSpent } = armorStackResult;
|
type: [...hpDamage.damageTypes]
|
||||||
updates.find(u => u.type === 'hitPoints').value = modifiedDamage;
|
});
|
||||||
updates.push(
|
if (armorStackResult) {
|
||||||
...(armorSpent ? [{ value: armorSpent, key: 'armorStack' }] : []),
|
const { modifiedDamage, armorSpent, stressSpent } = armorStackResult;
|
||||||
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
|
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
|
||||||
);
|
updates.push(
|
||||||
|
...(armorSpent ? [{ value: armorSpent, key: 'armorStack' }] : []),
|
||||||
|
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updates.forEach( u =>
|
||||||
|
u.value = u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value
|
||||||
|
);
|
||||||
|
|
||||||
await this.modifyResource(updates);
|
await this.modifyResource(updates);
|
||||||
|
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, damage, type) === false) return null;
|
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, damages) === false) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateDamage(baseDamage, type) {
|
calculateDamage(baseDamage, type) {
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.preCalculateDamage`, this, baseDamage, type) === false) return null;
|
|
||||||
|
|
||||||
/* if(this.system.resistance[type]?.immunity) return 0;
|
|
||||||
if(this.system.resistance[type]?.resistance) baseDamage = Math.ceil(baseDamage / 2); */
|
|
||||||
if (this.canResist(type, 'immunity')) return 0;
|
if (this.canResist(type, 'immunity')) return 0;
|
||||||
if (this.canResist(type, 'resistance')) baseDamage = Math.ceil(baseDamage / 2);
|
if (this.canResist(type, 'resistance')) baseDamage = Math.ceil(baseDamage / 2);
|
||||||
|
|
||||||
// const flatReduction = this.system.resistance[type].reduction;
|
|
||||||
const flatReduction = this.getDamageTypeReduction(type);
|
const flatReduction = this.getDamageTypeReduction(type);
|
||||||
const damage = Math.max(baseDamage - (flatReduction ?? 0), 0);
|
const damage = Math.max(baseDamage - (flatReduction ?? 0), 0);
|
||||||
const hpDamage = this.convertDamageToThreshold(damage);
|
|
||||||
|
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.postCalculateDamage`, this, baseDamage, type) === false) return null;
|
return damage;
|
||||||
|
|
||||||
return hpDamage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
canResist(type, resistance) {
|
canResist(type, resistance) {
|
||||||
|
|
@ -461,8 +472,13 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
async takeHealing(resources) {
|
async takeHealing(resources) {
|
||||||
resources.forEach(r => (r.value *= -1));
|
const updates = Object.entries(resources).map(([key, value]) => (
|
||||||
await this.modifyResource(resources);
|
{
|
||||||
|
key: key,
|
||||||
|
value: !(key === 'fear' || this.system?.resources?.[key]?.isReversed === false) ? value.total * -1 : value.total
|
||||||
|
}
|
||||||
|
))
|
||||||
|
await this.modifyResource(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
async modifyResource(resources) {
|
async modifyResource(resources) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export default class DHToken extends TokenDocument {
|
||||||
});
|
});
|
||||||
bars.sort((a, b) => a.label.compare(b.label));
|
bars.sort((a, b) => a.label.compare(b.label));
|
||||||
|
|
||||||
const invalidAttributes = ['gold', 'levelData', 'actions', 'rules.damageReduction.maxArmorMarked.value'];
|
const invalidAttributes = ['gold', 'levelData', 'actions'];
|
||||||
const values = attributes.value.reduce((acc, v) => {
|
const values = attributes.value.reduce((acc, v) => {
|
||||||
const a = v.join('.');
|
const a = v.join('.');
|
||||||
if (invalidAttributes.some(x => a.startsWith(x))) return acc;
|
if (invalidAttributes.some(x => a.startsWith(x))) return acc;
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ export default class RegisterHandlebarsHelpers {
|
||||||
times: this.times,
|
times: this.times,
|
||||||
damageFormula: this.damageFormula,
|
damageFormula: this.damageFormula,
|
||||||
damageSymbols: this.damageSymbols,
|
damageSymbols: this.damageSymbols,
|
||||||
rollParsed: this.rollParsed
|
rollParsed: this.rollParsed,
|
||||||
|
hasProperty: foundry.utils.hasProperty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static add(a, b) {
|
static add(a, b) {
|
||||||
const aNum = Number.parseInt(a);
|
const aNum = Number.parseInt(a);
|
||||||
const bNum = Number.parseInt(b);
|
const bNum = Number.parseInt(b);
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,18 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const itemAbleRollParse = (value, actor, item) => {
|
export const itemAbleRollParse = (value, actor, item) => {
|
||||||
if (!value) return value;
|
if (!value) return value;
|
||||||
|
|
||||||
|
|
@ -311,3 +323,15 @@ export const itemAbleRollParse = (value, actor, item) => {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const arraysEqual = (a, b) =>
|
||||||
|
a.length === b.length &&
|
||||||
|
[...new Set([...a, ...b])].every(
|
||||||
|
v => a.filter(e => e === v).length === b.filter(e => e === v).length
|
||||||
|
);
|
||||||
|
|
||||||
|
export const setsEqual = (a, b) =>
|
||||||
|
a.size === b.size &&
|
||||||
|
[...a].every(
|
||||||
|
value => b.has(value)
|
||||||
|
);
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
export const preloadHandlebarsTemplates = async function () {
|
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([
|
return foundry.applications.handlebars.loadTemplates([
|
||||||
'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs',
|
'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs',
|
|
||||||
'systems/daggerheart/templates/sheets/global/partials/action-item.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/action-item.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs',
|
|
||||||
'systems/daggerheart/templates/sheets/global/partials/item-resource.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/item-resource.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/resource-section.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/resource-section.hbs',
|
||||||
'systems/daggerheart/templates/components/card-preview.hbs',
|
'systems/daggerheart/templates/components/card-preview.hbs',
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,15 @@
|
||||||
|
|
||||||
color: light-dark(@dark, @beige);
|
color: light-dark(@dark, @beige);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.damage-formula {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.damage-details {
|
||||||
|
font-style: italic;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
height: 34px;
|
height: 34px;
|
||||||
.tags {
|
.tags {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
margin: 5px;
|
margin: 4px;
|
||||||
height: inherit;
|
height: inherit;
|
||||||
.tag {
|
.tag {
|
||||||
padding: 0.3rem 0.5rem;
|
padding: 0.3rem 0.5rem;
|
||||||
|
|
|
||||||
|
|
@ -12,87 +12,155 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appTheme({}, {
|
||||||
|
.inventory-item-header .img-portait .roll-img {
|
||||||
|
filter: invert(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
.application.daggerheart.dh-style {
|
.application.daggerheart.dh-style {
|
||||||
.inventory-item {
|
.inventory-item {
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 40px 1fr 60px;
|
|
||||||
gap: 10px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
list-style-type: none;
|
||||||
|
|
||||||
.item-img {
|
&:hover {
|
||||||
height: 40px;
|
.inventory-item-header .img-portait {
|
||||||
width: 40px;
|
.roll-img {
|
||||||
border-radius: 3px;
|
opacity: 1;
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
object-fit: cover;
|
|
||||||
|
|
||||||
&.actor-img {
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-label-wrapper {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-label {
|
|
||||||
font-family: @font-body;
|
|
||||||
align-self: center;
|
|
||||||
|
|
||||||
&.fullWidth {
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-name {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-tags,
|
|
||||||
.item-labels {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
|
|
||||||
.tag {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 3px 5px;
|
|
||||||
font-size: 12px;
|
|
||||||
|
|
||||||
background: light-dark(@dark-15, @beige-15);
|
|
||||||
border: 1px solid light-dark(@dark, @beige);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
}
|
||||||
|
.item-img {
|
||||||
.label {
|
opacity: 0;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 12px;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.controls {
|
.inventory-item-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: end;
|
gap: 10px;
|
||||||
gap: 8px;
|
cursor: pointer;
|
||||||
|
|
||||||
a {
|
.img-portait {
|
||||||
text-align: center;
|
flex: 0 0 40px;
|
||||||
|
height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&.unequipped {
|
.item-img,
|
||||||
opacity: 0.4;
|
.roll-img {
|
||||||
|
position: absolute;
|
||||||
|
transition: opacity 300ms ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roll-img {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-label {
|
||||||
|
flex: 1;
|
||||||
|
font-family: @font-body;
|
||||||
|
align-self: center;
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-tags,
|
||||||
|
.item-labels {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.tag,
|
||||||
|
.label {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
padding: 3px 5px;
|
||||||
|
background: light-dark(@dark-15, @beige-15);
|
||||||
|
border: 1px solid light-dark(@dark, @beige);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-resource {
|
||||||
|
flex: 0 0 60px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
.controls {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.inventory-item-content {
|
||||||
|
> *:not(:last-child) {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
&.extensible {
|
||||||
|
max-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: max-height 0.5s ease-in-out;
|
||||||
|
&.extended {
|
||||||
|
max-height: 500px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item-resources {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
.item-dice-resource {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 26px;
|
||||||
|
|
||||||
|
label,
|
||||||
|
i {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
color: light-dark(white, black);
|
||||||
|
filter: drop-shadow(0 0 1px light-dark(@dark-blue, @golden));
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
|
||||||
|
brightness(96%) contrast(95%);
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
text-shadow: 0 0 3px white;
|
||||||
|
filter: drop-shadow(0 1px white);
|
||||||
|
color: black;
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-item {
|
.card-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 120px;
|
height: 120px;
|
||||||
|
|
@ -212,6 +280,7 @@
|
||||||
|
|
||||||
input {
|
input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-dice-resource {
|
.item-dice-resource {
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.damage-resource {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dice-total {
|
.dice-total {
|
||||||
|
|
|
||||||
12
system.json
12
system.json
|
|
@ -35,6 +35,12 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Po0lp"
|
"name": "Po0lp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "JoaquinP",
|
||||||
|
"url": "https://github.com/joaquinpereyra98",
|
||||||
|
"email": "joaquinpereyra98@gmail.com",
|
||||||
|
"discord": "joaquinp98"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"esmodules": ["build/daggerheart.js"],
|
"esmodules": ["build/daggerheart.js"],
|
||||||
|
|
@ -178,14 +184,14 @@
|
||||||
"documentTypes": {
|
"documentTypes": {
|
||||||
"Actor": {
|
"Actor": {
|
||||||
"character": {
|
"character": {
|
||||||
"htmlFields": ["story", "description", "scars.*.description"]
|
"htmlFields": ["biography.background", "biography.connections"]
|
||||||
},
|
},
|
||||||
"companion": {},
|
"companion": {},
|
||||||
"adversary": {
|
"adversary": {
|
||||||
"htmlFields": ["description", "motivesAndTactics"]
|
"htmlFields": ["notes", "description"]
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"htmlFields": ["description", "impulses"]
|
"htmlFields": ["notes", "description"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,12 @@
|
||||||
{{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
|
{{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." index ".type") localize=true}}
|
<div class="nest-inputs">
|
||||||
|
{{formField ../fields.applyTo value=dmg.applyTo name=(concat ../path "damage.parts." realIndex ".applyTo") localize=true}}
|
||||||
|
{{#if (eq dmg.applyTo 'hitPoints')}}
|
||||||
|
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." index ".type") localize=true}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
{{#if ../horde}}
|
{{#if ../horde}}
|
||||||
<fieldset class="one-column">
|
<fieldset class="one-column">
|
||||||
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
|
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
|
||||||
|
|
@ -56,7 +61,12 @@
|
||||||
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
<div class="nest-inputs">
|
||||||
|
{{formField ../../fields.applyTo value=dmg.applyTo name=(concat "damage.parts." realIndex ".applyTo") localize=true}}
|
||||||
|
{{#if (eq dmg.applyTo 'hitPoints')}}
|
||||||
|
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,41 @@
|
||||||
|
|
||||||
<fieldset class="action-category">
|
<fieldset class="one-column">
|
||||||
<legend class="action-category-label" data-action="toggleSection" data-section="effects">
|
<legend>
|
||||||
<div>Healing</div>
|
{{localize "DAGGERHEART.GENERAL.healing"}}
|
||||||
</legend>
|
</legend>
|
||||||
<div class="action-category-data open">
|
{{#if (and (not @root.isNPC) @root.hasRoll)}}
|
||||||
<fieldset>
|
{{formField fields.resultBased value=source.resultBased name="healing.resultBased" localize=true classes="checkbox"}}
|
||||||
{{formField fields.type value=source.type name="healing.type" localize=true}}
|
{{/if}}
|
||||||
{{#if (and (not @root.isNPC) @root.hasRoll)}}
|
{{#if (and (not @root.isNPC) @root.hasRoll source.resultBased)}}
|
||||||
{{formField fields.resultBased value=source.resultBased name="healing.resultBased" localize=true}}
|
<div class="nest-inputs">
|
||||||
{{/if}}
|
<fieldset class="one-column">
|
||||||
{{#if (and (not @root.isNPC) @root.hasRoll source.resultBased)}}
|
<legend>
|
||||||
<fieldset>
|
<div>With Hope</div>
|
||||||
<legend>
|
</legend>
|
||||||
<div>With Hope</div>
|
|
||||||
</legend>
|
|
||||||
{{> formula fields=fields.value.fields source=source.value target="value"}}
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<legend>
|
|
||||||
<div>With Fear</div>
|
|
||||||
</legend>
|
|
||||||
{{> formula fields=fields.valueAlt.fields source=source.valueAlt target="valueAlt"}}
|
|
||||||
</fieldset>
|
|
||||||
{{else}}
|
|
||||||
{{> formula fields=fields.value.fields source=source.value target="value"}}
|
{{> formula fields=fields.value.fields source=source.value target="value"}}
|
||||||
{{/if}}
|
</fieldset>
|
||||||
</fieldset>
|
<fieldset class="one-column">
|
||||||
</div>
|
<legend>
|
||||||
|
<div>With Fear</div>
|
||||||
|
</legend>
|
||||||
|
{{> formula fields=fields.valueAlt.fields source=source.valueAlt target="valueAlt"}}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
{{> formula fields=fields.value.fields source=source.value target="value"}}
|
||||||
|
{{/if}}
|
||||||
|
{{formField fields.applyTo value=source.type name="healing.applyTo" localize=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{#*inline "formula"}}
|
{{#*inline "formula"}}
|
||||||
<div class="multi-display">
|
{{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat "healing." target ".custom.enabled") classes="checkbox"}}
|
||||||
{{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat "healing." target ".custom.enabled")}}
|
{{#if source.custom.enabled}}
|
||||||
{{#if source.custom.enabled}}
|
{{formField fields.custom.fields.formula value=source.custom.formula name=(concat "healing." target ".custom.formula") localize=true}}
|
||||||
{{formField fields.custom.fields.formula value=source.custom.formula name=(concat "healing." target ".custom.formula") localize=true}}
|
{{else}}
|
||||||
{{else}}
|
<div class="nest-inputs">
|
||||||
{{formField fields.multiplier value=source.multiplier name=(concat "healing." target ".multiplier") localize=true}}
|
{{formField fields.multiplier value=source.multiplier name=(concat "healing." target ".multiplier") localize=true}}
|
||||||
{{formField fields.dice value=source.dice name=(concat "healing." target ".dice")}}
|
{{formField fields.dice value=source.dice name=(concat "healing." target ".dice")}}
|
||||||
{{formField fields.bonus value=source.bonus name=(concat "healing." target ".bonus") localize=true}}
|
{{formField fields.bonus value=source.bonus name=(concat "healing." target ".bonus") localize=true}}
|
||||||
{{/if}}
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
@ -2,10 +2,26 @@
|
||||||
<header class="dialog-header">
|
<header class="dialog-header">
|
||||||
<h1>{{title}}</h1>
|
<h1>{{title}}</h1>
|
||||||
</header>
|
</header>
|
||||||
<span class="formula-label"><b>Formula:</b> {{@root.formula}}</span>
|
{{#each @root.formula}}
|
||||||
<div class="form-group">
|
<div class="damage-formula">
|
||||||
<input type="text" value="{{extraFormula}}" name="extraFormula" placeholder="Situational Bonus">
|
<span class="damage-resource"><b>Formula:</b> {{roll.formula}}</span>
|
||||||
</div>
|
<span class="damage-details">
|
||||||
|
{{#with (lookup @root.config.GENERAL.healingTypes applyTo)}}
|
||||||
|
{{localize label}}
|
||||||
|
{{/with}}
|
||||||
|
{{#if damageTypes}}
|
||||||
|
{{#each damageTypes as | type | }}
|
||||||
|
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||||
|
<i class="fa-solid {{icon}}"></i>
|
||||||
|
{{/with}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" value="{{extraFormula}}" name="roll.{{ @index }}.extraFormula" placeholder="Situational Bonus">
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
<div class="damage-section-controls">
|
<div class="damage-section-controls">
|
||||||
{{#if directDamage}}
|
{{#if directDamage}}
|
||||||
<select class="roll-mode-select" name="selectedRollMode">
|
<select class="roll-mode-select" name="selectedRollMode">
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
<span>{{feature.name}}</span>
|
<span>{{feature.name}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<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="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-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,33 @@
|
||||||
<section
|
<section class='tab {{tabs.adversaries.cssClass}} {{tabs.adversaries.id}}' data-tab='{{tabs.adversaries.id}}'
|
||||||
class='tab {{tabs.adversaries.cssClass}} {{tabs.adversaries.id}}'
|
data-group='{{tabs.adversaries.group}}'>
|
||||||
data-tab='{{tabs.adversaries.id}}'
|
|
||||||
data-group='{{tabs.adversaries.group}}'
|
|
||||||
>
|
|
||||||
<button type="button" class="add-action-btn" data-action="addCategory">
|
<button type="button" class="add-action-btn" data-action="addCategory">
|
||||||
New Category
|
New Category
|
||||||
</button>
|
</button>
|
||||||
{{#each document.system.potentialAdversaries as |category id|}}
|
{{#each document.system.potentialAdversaries as |category categoryId|}}
|
||||||
<fieldset class="category-container" data-potential-adversary="{{id}}">
|
<fieldset class="category-container" data-potential-adversary="{{categoryId}}">
|
||||||
<legend>{{category.label}}</legend>
|
<legend>{{category.label}}</legend>
|
||||||
<div class="category-name">
|
<div class="category-name">
|
||||||
<input type="text" name="{{concat "system.potentialAdversaries." @key ".label" }}" value="{{category.label}}" />
|
<input type="text" name="system.potentialAdversaries.{{categoryId}}.label"
|
||||||
<a data-action="removeCategory" data-category-id={{id}} data-tooltip='{{localize "CONTROLS.CommonDelete"}}'>
|
value="{{category.label}}" />
|
||||||
<i class="fa-solid fa-trash"></i>
|
<a data-action="removeCategory" data-category-id={{categoryId}} data-tooltip='{{localize "CONTROLS.CommonDelete"}}'>
|
||||||
</a>
|
<i class="fa-solid fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="adversaries-container">
|
||||||
|
{{#each category.adversaries as |adversary|}}
|
||||||
|
<div class="adversary-container">
|
||||||
|
{{> 'daggerheart.inventory-item'
|
||||||
|
item=adversary
|
||||||
|
type='adversary'
|
||||||
|
isActor=true
|
||||||
|
categoryAdversary=categoryId
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="adversaries-container">
|
{{/each}}
|
||||||
{{#each category.adversaries as |adversary|}}
|
</div>
|
||||||
<div class="adversary-container">
|
<div class="adversaries-dragger">
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' isActor=true categoryAdversary=@../key}}
|
Drop Actors here
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
</fieldset>
|
||||||
</div>
|
|
||||||
<div class="adversaries-dragger">
|
|
||||||
Drop Actors here
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
<span>{{feature.name}}</span>
|
<span>{{feature.name}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<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="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-type="Item" data-doc-id="{{feature.id}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,20 @@
|
||||||
<section
|
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
data-group='{{tabs.effects.group}}'>
|
||||||
data-tab='{{tabs.effects.id}}'
|
{{> 'daggerheart.inventory-items'
|
||||||
data-group='{{tabs.effects.group}}'
|
title='DAGGERHEART.GENERAL.activeEffects'
|
||||||
>
|
type='effect'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
isGlassy=true
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
collection=effects.actives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||||
|
type='effect'
|
||||||
|
isGlassy=true
|
||||||
|
collection=effects.inactives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
<section
|
<section class='tab {{tabs.features.cssClass}} {{tabs.features.id}}' data-tab='{{tabs.features.id}}'
|
||||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
data-group='{{tabs.features.group}}'>
|
||||||
data-tab='{{tabs.features.id}}'
|
|
||||||
data-group='{{tabs.features.group}}'
|
|
||||||
>
|
|
||||||
<div class="feature-section">
|
<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
|
||||||
|
canCreate=true
|
||||||
|
showActions=true
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<line-div></line-div>
|
<line-div></line-div>
|
||||||
<div class="adversary-info">
|
<div class="adversary-info">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<i>{{{source.system.description}}}</i>
|
<i>{{{description}}}</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="motives-and-tatics">
|
<div class="motives-and-tatics">
|
||||||
<b>{{localize 'DAGGERHEART.ACTORS.Adversary.FIELDS.motivesAndTactics.label'}}: </b>{{{source.system.motivesAndTactics}}}
|
<b>{{localize 'DAGGERHEART.ACTORS.Adversary.FIELDS.motivesAndTactics.label'}}: </b>{{{source.system.motivesAndTactics}}}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
>
|
>
|
||||||
<fieldset class="fit-height">
|
<fieldset class="fit-height">
|
||||||
<legend>{{localize tabs.notes.label}}</legend>
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
{{formInput systemFields.notes value=document.system.notes enriched=document.system.notes localize=true toggled=true}}
|
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,111 +1,118 @@
|
||||||
<aside class="adversary-sidebar-sheet">
|
<aside class="adversary-sidebar-sheet">
|
||||||
<div class="portrait {{#if (and source.system.resources.hitPoints.max (gte source.system.resources.hitPoints.value source.system.resources.hitPoints.max))}}death-roll{{/if}}">
|
<div class="portrait {{#if (and source.system.resources.hitPoints.max (gte source.system.resources.hitPoints.value source.system.resources.hitPoints.max))}}death-roll{{/if}}">
|
||||||
<img src="{{source.img}}" alt="{{source.name}}" data-action='editImage' data-edit="img">
|
<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>
|
||||||
|
|
||||||
<div class="info-section">
|
<div class="info-section">
|
||||||
<div class="resources-section">
|
<div class="resources-section">
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<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>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
||||||
</div>
|
</div>
|
||||||
<progress
|
<progress class='progress-bar' value='{{source.system.resources.hitPoints.value}}'
|
||||||
class='progress-bar'
|
max='{{source.system.resources.hitPoints.max}}'></progress>
|
||||||
value='{{source.system.resources.hitPoints.value}}'
|
|
||||||
max='{{source.system.resources.hitPoints.max}}'
|
|
||||||
></progress>
|
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>HP</h4>
|
<h4>{{localize 'DAGGERHEART.GENERAL.attack.hitPoints.short'}}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<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>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
||||||
</div>
|
</div>
|
||||||
<progress
|
<progress class='progress-bar stress-color' value='{{source.system.resources.stress.value}}'
|
||||||
class='progress-bar stress-color'
|
max='{{source.system.resources.stress.max}}'></progress>
|
||||||
value='{{source.system.resources.stress.value}}'
|
|
||||||
max='{{source.system.resources.stress.max}}'
|
|
||||||
></progress>
|
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>Stress</h4>
|
<h4>{{localize 'DAGGERHEART.GENERAL.stress'}}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-section">
|
<div class="status-section">
|
||||||
<div class="threshold-section">
|
<div class="threshold-section">
|
||||||
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.minor"}}</h4>
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.minor"}}</h4>
|
||||||
<h4 class="threshold-value">{{document.system.damageThresholds.major}}</h4>
|
<h4 class="threshold-value">{{document.system.damageThresholds.major}}</h4>
|
||||||
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.major"}}</h4>
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.major"}}</h4>
|
||||||
<h4 class="threshold-value">{{document.system.damageThresholds.severe}}</h4>
|
<h4 class="threshold-value">{{document.system.damageThresholds.severe}}</h4>
|
||||||
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.severe"}}</h4>
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.severe"}}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-section">
|
<div class="status-section">
|
||||||
<div class="status-number">
|
<div class="status-number">
|
||||||
<div class='status-value armor-slots'>
|
<div class='status-value armor-slots'>
|
||||||
{{#if source.system.difficulty}}
|
{{#if source.system.difficulty}}
|
||||||
<p>{{source.system.difficulty}}</p>
|
<p>{{source.system.difficulty}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p>-</p>
|
<p>-</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>Difficulty</h4>
|
<h4>{{localize DAGGERHEART.GENERAL.difficulty}}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-number">
|
<div class="status-number">
|
||||||
<div class='status-value armor-slots'>
|
<div class='status-value armor-slots'>
|
||||||
{{#if source.system.attack.target.amount}}
|
{{#if source.system.attack.target.amount}}
|
||||||
<p>{{source.system.attack.target.amount}}</p>
|
<p>{{source.system.attack.target.amount}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p>-</p>
|
<p>-</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>Attack</h4>
|
<h4>{{localize "DAGGERHEART.GENERAL.attack"}}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="attack-section">
|
<div class="attack-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
<h3>Attack</h3>
|
<h3>{{localize "DAGGERHEART.GENERAL.attack"}}</h3>
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="items-sidebar-list">
|
<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'
|
||||||
|
hideTags=true
|
||||||
|
hideDescription=true
|
||||||
|
hideTooltip=true
|
||||||
|
hideResources=true
|
||||||
|
noExtensible=true
|
||||||
|
}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="experience-section">
|
<div class="experience-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
<h3>Experience</h3>
|
<h3>{{localize DAGGERHEART.GENERAL.experience.plural}}</h3>
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<div class="experience-list">
|
<div class="experience-list">
|
||||||
{{#each source.system.experiences as |experience id|}}
|
{{#each source.system.experiences as |experience id|}}
|
||||||
<div class="experience-row">
|
<div class="experience-row">
|
||||||
<div class="experience-value">
|
<div class="experience-value">
|
||||||
+{{experience.value}}
|
+{{experience.value}}
|
||||||
</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>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="experience-name">{{experience.name}}</span>
|
||||||
|
<div class="controls">
|
||||||
|
<a data-action="sendExpToChat" data-id="{{id}}">
|
||||||
|
<i class="fa-regular fa-message"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<line-div></line-div>
|
<line-div></line-div>
|
||||||
<div class="reaction-section">
|
<div class="reaction-section">
|
||||||
<button data-action="reactionRoll">Reaction Test</button>
|
<button data-action="reactionRoll">{{localize DAGGERHEART.GENERAL.Roll.reaction}}</button>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
@ -26,11 +26,11 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize 'DAGGERHEART.ACTORS.Character.story.backgroundTitle'}}</legend>
|
<legend>{{localize 'DAGGERHEART.ACTORS.Character.story.backgroundTitle'}}</legend>
|
||||||
{{formInput systemFields.biography.fields.background value=source.system.biography.background enriched=source.system.biography.background localize=true toggled=true}}
|
{{formInput background.field value=background.value enriched=background.enriched toggled=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize 'DAGGERHEART.ACTORS.Character.story.connectionsTitle'}}</legend>
|
<legend>{{localize 'DAGGERHEART.ACTORS.Character.story.connectionsTitle'}}</legend>
|
||||||
{{formInput systemFields.biography.fields.connections value=source.system.biography.connections enriched=source.system.biography.connections localize=true toggled=true}}
|
{{formInput connections.field value=connections.value enriched=connections.enriched toggled=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,8 +1,21 @@
|
||||||
<section
|
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
data-group='{{tabs.effects.group}}'>
|
||||||
data-tab='{{tabs.effects.id}}'
|
|
||||||
data-group='{{tabs.effects.group}}'
|
{{> 'daggerheart.inventory-items'
|
||||||
>
|
title='DAGGERHEART.GENERAL.activeEffects'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
type='effect'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
isGlassy=true
|
||||||
|
collection=effects.actives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||||
|
type='effect'
|
||||||
|
isGlassy=true
|
||||||
|
collection=effects.inactives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,13 +1,25 @@
|
||||||
<section
|
<section class='tab {{tabs.features.cssClass}} {{tabs.features.id}}' data-tab='{{tabs.features.id}}'
|
||||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
data-group='{{tabs.features.group}}'>
|
||||||
data-tab='{{tabs.features.id}}'
|
|
||||||
data-group='{{tabs.features.group}}'
|
|
||||||
>
|
|
||||||
<div class="features-sections">
|
<div class="features-sections">
|
||||||
{{#each document.system.sheetLists}}
|
{{#each document.system.sheetLists as |category|}}
|
||||||
{{#if this.values}}
|
{{#if (eq category.type 'feature' )}}
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=this.title values=this.values}}
|
{{> 'daggerheart.inventory-items'
|
||||||
{{/if}}
|
title=category.title
|
||||||
|
type='feature'
|
||||||
|
collection=category.values
|
||||||
|
canCreate=true
|
||||||
|
showActions=true
|
||||||
|
}}
|
||||||
|
{{else if category.values}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title=category.title
|
||||||
|
type='feature'
|
||||||
|
collection=category.values
|
||||||
|
canCreate=false
|
||||||
|
showActions=true
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -29,25 +29,25 @@
|
||||||
<div class="character-details">
|
<div class="character-details">
|
||||||
<div>
|
<div>
|
||||||
{{#if document.system.class.value}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'TYPES.Item.class'}}</span>
|
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'TYPES.Item.class'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="dot">•</span>
|
<span class="dot">•</span>
|
||||||
{{#if document.system.class.subclass}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="dot">•</span>
|
<span class="dot">•</span>
|
||||||
{{#if document.system.community}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.community">{{localize 'TYPES.Item.community'}}</span>
|
<span data-action="openPack" data-key="daggerheart.community">{{localize 'TYPES.Item.community'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="dot">•</span>
|
<span class="dot">•</span>
|
||||||
{{#if document.system.ancestry}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.ancestry">{{localize 'TYPES.Item.ancestry'}}</span>
|
<span data-action="openPack" data-key="daggerheart.ancestry">{{localize 'TYPES.Item.ancestry'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -56,13 +56,13 @@
|
||||||
{{#if document.system.multiclass.value}}
|
{{#if document.system.multiclass.value}}
|
||||||
<div class="multiclass">
|
<div class="multiclass">
|
||||||
{{#if document.system.multiclass.value}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'DAGGERHEART.GENERAL.multiclass'}}</span>
|
<span data-action="openPack" data-key="daggerheart.classes">{{localize 'DAGGERHEART.GENERAL.multiclass'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="dot">•</span>
|
<span class="dot">•</span>
|
||||||
{{#if document.system.multiclass.subclass}}
|
{{#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}}
|
{{else}}
|
||||||
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
<span data-action="openPack" data-key="daggerheart.subclass">{{localize 'TYPES.Item.subclass'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
<section
|
<section class='tab {{tabs.inventory.cssClass}} {{tabs.inventory.id}}' data-tab='{{tabs.inventory.id}}'
|
||||||
class='tab {{tabs.inventory.cssClass}} {{tabs.inventory.id}}'
|
data-group='{{tabs.inventory.group}}'>
|
||||||
data-tab='{{tabs.inventory.id}}'
|
|
||||||
data-group='{{tabs.inventory.group}}'
|
|
||||||
>
|
|
||||||
<div class="search-section">
|
<div class="search-section">
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
|
|
@ -14,31 +11,61 @@
|
||||||
<i class="fa-solid fa-filter"></i>
|
<i class="fa-solid fa-filter"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="items-section">
|
<div class="items-section">
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.weapon') type='weapon' isGlassy=true}}
|
{{> 'daggerheart.inventory-items'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.armor') type='armor' isGlassy=true}}
|
title='TYPES.Item.weapon'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.consumable') type='consumable' isGlassy=true}}
|
type='weapon'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'TYPES.Item.miscellaneous') type='miscellaneous' isGlassy=true}}
|
collection=document.itemTypes.weapon
|
||||||
|
isGlassy=true
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='TYPES.Item.armor'
|
||||||
|
type='armor'
|
||||||
|
collection=document.itemTypes.armor
|
||||||
|
isGlassy=true
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='TYPES.Item.consumable'
|
||||||
|
type='consumable'
|
||||||
|
collection=document.itemTypes.consumable
|
||||||
|
isGlassy=true
|
||||||
|
canCreate=true
|
||||||
|
}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='TYPES.Item.miscellaneous'
|
||||||
|
type='miscellaneous'
|
||||||
|
collection=document.itemTypes.miscellaneous
|
||||||
|
isGlassy=true
|
||||||
|
canCreate=true
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="currency-section">
|
<div class="currency-section">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<span>{{localize this.inventory.currency.coins}}</span>
|
<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>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<span>{{localize this.inventory.currency.handfulls}}</span>
|
<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>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<span>{{localize this.inventory.currency.bags}}</span>
|
<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>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<span>{{localize this.inventory.currency.chests}}</span>
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -10,28 +10,33 @@
|
||||||
<a class="filter-button">
|
<a class="filter-button">
|
||||||
<i class="fa-solid fa-filter"></i>
|
<i class="fa-solid fa-filter"></i>
|
||||||
</a>
|
</a>
|
||||||
<button type="button" class="btn-toggle-view" data-action="toggleLoadoutView" data-value="{{listView}}">
|
<button type="button" class="btn-toggle-view" data-action="toggleLoadoutView" data-value="{{not cardView}}">
|
||||||
<span class="{{ifThen listView 'list-active' ''}} list-icon">
|
<span class="{{ifThen cardView '' 'list-active'}} list-icon">
|
||||||
<i class="fa-solid fa-bars"></i>
|
<i class="fa-solid fa-bars"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="{{ifThen listView '' 'grid-active'}} grid-icon">
|
<span class="{{ifThen cardView 'grid-active' ''}} grid-icon">
|
||||||
<i class="fa-solid fa-grip"></i>
|
<i class="fa-solid fa-grip"></i>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="items-section">
|
<div class="items-section">
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs'
|
{{> 'daggerheart.inventory-items'
|
||||||
title=(localize 'DAGGERHEART.GENERAL.Tabs.loadout')
|
title='DAGGERHEART.GENERAL.Tabs.loadout'
|
||||||
type='domainCard'
|
type='domainCard'
|
||||||
isGlassy=true
|
isGlassy=true
|
||||||
cardView=(ifThen listView "list" "card")}}
|
cardView=cardView
|
||||||
|
collection=document.system.domainCards.loadout
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs'
|
canCreate=true
|
||||||
title=(localize 'DAGGERHEART.GENERAL.Tabs.vault')
|
}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='DAGGERHEART.GENERAL.Tabs.vault'
|
||||||
type='domainCard'
|
type='domainCard'
|
||||||
isVault=true
|
|
||||||
isGlassy=true
|
isGlassy=true
|
||||||
cardView=(ifThen listView "list" "card")}}
|
cardView=cardView
|
||||||
|
collection=document.system.domainCards.vault
|
||||||
|
canCreate=true
|
||||||
|
inVault=true
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
<aside class="character-sidebar-sheet">
|
<aside class="character-sidebar-sheet">
|
||||||
<div class="portrait {{#if isDeath}}death-roll{{/if}}">
|
<div class="portrait {{#if isDeath}}death-roll{{/if}}">
|
||||||
<img src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
<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>
|
||||||
|
|
||||||
<div class="info-section">
|
<div class="info-section">
|
||||||
<div class="resources-section">
|
<div class="resources-section">
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<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>/</p>
|
||||||
<p class="bar-label">{{document.system.resources.hitPoints.max}}</p>
|
<p class="bar-label">{{document.system.resources.hitPoints.max}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,11 +22,12 @@
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>HP</h4>
|
<h4>HP</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
<div class='status-value'>
|
<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>/</p>
|
||||||
<p class="bar-label">{{document.system.resources.stress.max}}</p>
|
<p class="bar-label">{{document.system.resources.stress.max}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -87,51 +90,65 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="equipment-section">
|
<div class="equipment-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
<h3>Equipment</h3>
|
<h3>Equipment</h3>
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="items-sidebar-list">
|
<ul class="items-sidebar-list">
|
||||||
{{#each document.items as |item|}}
|
{{#each document.items as |item|}}
|
||||||
{{#if item.system.equipped}}
|
{{#if item.system.equipped}}
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=item.type isSidebar=true}}
|
{{> 'daggerheart.inventory-item'
|
||||||
{{/if}}
|
item=item
|
||||||
|
type=item.type
|
||||||
|
hideTags=true
|
||||||
|
hideDescription=true
|
||||||
|
hideResources=true
|
||||||
|
noExtensible=true
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="loadout-section">
|
<div class="loadout-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
<h3>Loadout</h3>
|
<h3>Loadout</h3>
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="items-sidebar-list">
|
<ul class="items-sidebar-list">
|
||||||
{{#each document.items as |item|}}
|
{{#each document.system.domainCards.loadout as |card|}}
|
||||||
{{#if (eq item.type 'domainCard')}}
|
{{> 'daggerheart.inventory-item'
|
||||||
{{#unless item.system.inVault}}
|
item=card
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=item.type isSidebar=true}}
|
type='domainCard'
|
||||||
{{/unless}}
|
hideTags=true
|
||||||
{{/if}}
|
hideDescription=true
|
||||||
|
hideResources=true
|
||||||
|
noExtensible=true
|
||||||
|
}}
|
||||||
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="experience-section">
|
<div class="experience-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
<h3>Experience</h3>
|
<h3>Experience</h3>
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<div class="experience-list">
|
<div class="experience-list">
|
||||||
{{#each document.system.experiences as |experience id|}}
|
{{#each document.system.experiences as |experience id|}}
|
||||||
<div class="experience-row">
|
<div class="experience-row">
|
||||||
<div class="experience-value">
|
<div class="experience-value">
|
||||||
+{{experience.value}}
|
+{{experience.total}}
|
||||||
</div>
|
|
||||||
<input name="{{concat "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>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<input name="system.experiences.{{id}}.name" data-experience={{id}}
|
||||||
|
value="{{experience.name}}" type="text" />
|
||||||
|
<div class="controls">
|
||||||
|
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
|
||||||
|
<i class="fa-regular fa-message"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
<section
|
<section class='tab {{tabs.details.cssClass}} {{tabs.details.id}}' data-tab='{{tabs.details.id}}'
|
||||||
class='tab {{tabs.details.cssClass}} {{tabs.details.id}}'
|
data-group='{{tabs.details.group}}'>
|
||||||
data-tab='{{tabs.details.id}}'
|
|
||||||
data-group='{{tabs.details.group}}'
|
|
||||||
>
|
|
||||||
<div class="partner-section">
|
<div class="partner-section">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<side-line-div class="invert"></side-line-div>
|
<side-line-div class="invert"></side-line-div>
|
||||||
|
|
@ -10,11 +7,18 @@
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
{{#if document.system.partner}}
|
{{#if document.system.partner}}
|
||||||
<ul class="item-list">
|
<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'
|
||||||
</ul>
|
item=document.system.partner
|
||||||
|
type='companion'
|
||||||
|
hideTags=true
|
||||||
|
hideDescription=true
|
||||||
|
isActor=true
|
||||||
|
hideTooltip=true
|
||||||
|
}}
|
||||||
|
</ul>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="partner-placeholder">{{localize "DAGGERHEART.ACTORS.Companion.noPartner"}}</span>
|
<span class="partner-placeholder">{{localize "DAGGERHEART.ACTORS.Companion.noPartner"}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="attack-section">
|
<div class="attack-section">
|
||||||
|
|
@ -24,7 +28,13 @@
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="item-list">
|
<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'
|
||||||
|
hideTags=true
|
||||||
|
hideDescription=true
|
||||||
|
hideTooltip=true
|
||||||
|
}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="experience-list">
|
<div class="experience-list">
|
||||||
|
|
@ -34,15 +44,16 @@
|
||||||
<side-line-div></side-line-div>
|
<side-line-div></side-line-div>
|
||||||
</div>
|
</div>
|
||||||
{{#each source.system.experiences as |experience id|}}
|
{{#each source.system.experiences as |experience id|}}
|
||||||
<div class="experience-row">
|
<div class="experience-row">
|
||||||
<div class="experience-value">
|
<div class="experience-value">
|
||||||
+{{experience.value}}
|
+{{experience.value}}
|
||||||
</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>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="experience-name">{{experience.name}}</span>
|
||||||
|
<div class="controls">
|
||||||
|
<a data-action="sendExpToChat" data-type="experience" data-id="{{id}}">
|
||||||
|
<i class="fa-regular fa-message"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,8 +1,20 @@
|
||||||
<section
|
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
data-group='{{tabs.effects.group}}'>
|
||||||
data-tab='{{tabs.effects.id}}'
|
{{> 'daggerheart.inventory-items'
|
||||||
data-group='{{tabs.effects.group}}'
|
title='DAGGERHEART.GENERAL.activeEffects'
|
||||||
>
|
type='effect'
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.activeEffects') type='effect'}}
|
isGlassy=true
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.GENERAL.inactiveEffects') type='effect'}}
|
collection=effects.actives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||||
|
type='effect'
|
||||||
|
isGlassy=true
|
||||||
|
collection=effects.inactives
|
||||||
|
canCreate=true
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
data-group='{{tabs.features.group}}'
|
data-group='{{tabs.features.group}}'
|
||||||
>
|
>
|
||||||
<div class="feature-section">
|
<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
|
||||||
|
canCreate=true
|
||||||
|
showActions=true
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<line-div></line-div>
|
<line-div></line-div>
|
||||||
<div class="environment-info">
|
<div class="environment-info">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<i>{{{source.system.description}}}</i>
|
<i>{{{description}}}</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="impulses">
|
<div class="impulses">
|
||||||
<b>{{localize 'DAGGERHEART.ACTORS.Environment.FIELDS.impulses.label'}}: </b>{{{source.system.impulses}}}
|
<b>{{localize 'DAGGERHEART.ACTORS.Environment.FIELDS.impulses.label'}}: </b>{{{source.system.impulses}}}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
>
|
>
|
||||||
<fieldset class="fit-height">
|
<fieldset class="fit-height">
|
||||||
<legend>{{localize tabs.notes.label}}</legend>
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
{{formInput systemFields.notes value=document.system.notes enriched=document.system.notes localize=true toggled=true}}
|
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -4,8 +4,17 @@
|
||||||
data-group='{{tabs.potentialAdversaries.group}}'
|
data-group='{{tabs.potentialAdversaries.group}}'
|
||||||
>
|
>
|
||||||
<div class="action-section">
|
<div class="action-section">
|
||||||
{{#each document.system.potentialAdversaries}}
|
{{#each document.system.potentialAdversaries as |category categoryId|}}
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=this.label type='adversary' isGlassy=true adversaries=this.adversaries}}
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title=category.label
|
||||||
|
type='adversary'
|
||||||
|
isGlassy=true
|
||||||
|
isActor=true
|
||||||
|
categoryAdversary=categoryId
|
||||||
|
hideControls=true
|
||||||
|
collection=category.adversaries
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,34 +1,22 @@
|
||||||
<li class="card-item" data-item-id="{{item.id}}" data-item-id="{{item.id}}">
|
<li class="card-item" data-item-uuid="{{item.uuid}}">
|
||||||
<img src="{{item.img}}" data-action="useItem" class="card-img" />
|
<img src="{{item.img}}" data-action="useItem" class="card-img" />
|
||||||
<div class="card-label">
|
<div class="card-label">
|
||||||
<div class="menu {{#if item.system.resource}}resource-menu{{/if}} {{#if (eq item.system.resource.type 'diceValue')}}dice-menu{{/if}}">
|
<div
|
||||||
|
class="menu {{#if item.system.resource}}resource-menu{{/if}} {{#if (eq item.system.resource.type 'diceValue')}}dice-menu{{/if}}">
|
||||||
{{#if item.system.resource}}
|
{{#if item.system.resource}}
|
||||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{#if (eq type 'weapon')}}
|
<a data-action="toggleVault"
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.system.inVault 'sendToLoadout' 'sendToVault' }}">
|
||||||
<i class="fa-solid fa-hands"></i>
|
<i class="fa-solid {{ifThen item.system.inVault 'fa-arrow-up' 'fa-arrow-down'}}"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
|
||||||
{{#if (eq type 'armor')}}
|
<i class="fa-regular fa-message"></i>
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
</a>
|
||||||
<i class="fa-solid fa-shield"></i>
|
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||||
</a>
|
<i class="fa-solid fa-ellipsis-vertical"></i>
|
||||||
{{/if}}
|
</a>
|
||||||
{{#if (eq type 'domainCard')}}
|
|
||||||
{{#unless item.system.inVault}}
|
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToVault'}}">
|
|
||||||
<i class="fa-solid fa-arrow-down"></i>
|
|
||||||
</a>
|
|
||||||
{{else}}
|
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToLoadout'}}">
|
|
||||||
<i class="fa-solid fa-arrow-up"></i>
|
|
||||||
</a>
|
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
|
||||||
<a data-action="toChat" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToChat'}}"><i class="fa-regular fa-message"></i></a>
|
|
||||||
<a data-action="triggerContextMenu" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.moreOptions'}}"><i class="fa-solid fa-ellipsis-vertical"></i></a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-name">{{item.name}}</div>
|
<div class="card-name">{{item.name}}</div>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,18 @@
|
||||||
<li class='feature-item' data-feature-id='{{feature.id}}'>
|
<li class='feature-item' data-item-uuid='{{feature.uuid}}'>
|
||||||
<div class='feature-line'>
|
<div class='feature-line'>
|
||||||
<img class='image' src='{{feature.img}}' />
|
<img class='image' src='{{feature.img}}' />
|
||||||
<h4>
|
<h4>
|
||||||
{{feature.name}}
|
{{feature.name}}
|
||||||
</h4>
|
</h4>
|
||||||
{{#unless hideContrals}}
|
{{#unless hideContrals}}
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
<a
|
<a class='effect-control' data-action='editDoc' data-tooltip="DAGGERHEART.UI.Tooltip.openItemWorld">
|
||||||
class='effect-control'
|
<i class="fa-solid fa-globe"></i>
|
||||||
data-action='editFeature'
|
</a>
|
||||||
data-feature='{{feature._id}}'
|
<a class='effect-control' data-action='deleteFeature' data-tooltip="CONTROLS.CommonDelete">
|
||||||
data-type='{{type}}'
|
<i class='fas fa-trash'></i>
|
||||||
data-tooltip='{{localize "DAGGERHEART.UI.Tooltip.openItemWorld"}}'
|
</a>
|
||||||
>
|
</div>
|
||||||
<i class="fa-solid fa-globe"></i>
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
class='effect-control'
|
|
||||||
data-action='deleteFeature'
|
|
||||||
data-feature='{{feature._id}}'
|
|
||||||
data-type='{{type}}'
|
|
||||||
data-tooltip='{{localize "CONTROLS.CommonDelete"}}'
|
|
||||||
>
|
|
||||||
<i class='fas fa-trash'></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
{{!--
|
||||||
|
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
|
||||||
|
- inVault {boolean} : If true, the domainCard is created with inVault=true
|
||||||
|
- disabled {boolean}: If true, the ActiveEffect is created with disabled=true;
|
||||||
|
- 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.
|
||||||
|
- hideResources {boolean} : If true, hides the item's resources.
|
||||||
|
- showActions {boolean} : If true show feature's actions.
|
||||||
|
--}}
|
||||||
|
|
||||||
|
<fieldset class="{{#if isGlassy}}glassy{{/if}}">
|
||||||
|
<legend>
|
||||||
|
{{localize title}}
|
||||||
|
{{#if canCreate}}
|
||||||
|
<a data-action="createDoc" data-document-class="{{ifThen (eq type 'effect') 'ActiveEffect' 'Item' }}"
|
||||||
|
data-type="{{ifThen (eq type 'effect') 'base' type}}"
|
||||||
|
{{#if inVault}}data-in-vault="{{inVault}}"{{/if}}
|
||||||
|
{{#if disabled}} data-disabled="{{disabled}}"{{/if}}
|
||||||
|
data-tooltip="{{localize 'DOCUMENT.Create' 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='domainCard'
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{/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
|
||||||
|
hideResources=../hideResources
|
||||||
|
showActions=../showActions
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
<fieldset class="{{#if isGlassy}}glassy{{/if}}">
|
|
||||||
<legend>{{title}}</legend>
|
|
||||||
<ul class="items-list">
|
|
||||||
{{#unless (eq cardView 'card') }}
|
|
||||||
{{#if (or (eq type 'domainCard') (eq type 'armor') (eq type 'consumable') (eq type 'miscellaneous') (eq type 'weapon'))}}
|
|
||||||
{{#each document.items as |item|}}
|
|
||||||
{{#if (eq item.type ../type)}}
|
|
||||||
{{#unless (and (eq ../type 'domainCard') (or (and item.system.inVault (not ../isVault)) (and (not item.system.inVault) ../isVault)))}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=../type}}
|
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
|
||||||
{{/each}}
|
|
||||||
{{else}}
|
|
||||||
{{#if (eq type 'effect')}}
|
|
||||||
{{#each document.effects as |effect|}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=effect type=../type}}
|
|
||||||
{{/each}}
|
|
||||||
{{else}}
|
|
||||||
{{#each values}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=this type=../type hideControls=../hideControls featureType=true }}
|
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
{{#each adversaries as |adversary|}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' hideControls=true isActor=true categoryAdversary=@../key}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{/unless}}
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
{{#if (and (eq cardView 'card') (eq type 'domainCard'))}}
|
|
||||||
<ul class="card-list">
|
|
||||||
{{#if isVault}}
|
|
||||||
{{#each document.system.domainCards.vault as |card|}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs' item=card type=../type}}
|
|
||||||
{{/each}}
|
|
||||||
{{else}}
|
|
||||||
{{#each document.system.domainCards.loadout as |card|}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs' item=card type=../type}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
</ul>
|
|
||||||
{{/if}}
|
|
||||||
</fieldset>
|
|
||||||
239
templates/sheets/global/partials/inventory-item-V2.hbs
Normal file
239
templates/sheets/global/partials/inventory-item-V2.hbs
Normal file
|
|
@ -0,0 +1,239 @@
|
||||||
|
{{!--
|
||||||
|
{{> '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.
|
||||||
|
- noExtensible {boolean} : If true, the inventory-item-content would be collapsable/extendible else it always be showed
|
||||||
|
- 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.
|
||||||
|
- hideResources {boolean} : If true, hides the item's resources.
|
||||||
|
- showActions {boolean} : If true show feature's actions.
|
||||||
|
--}}
|
||||||
|
|
||||||
|
<li class="inventory-item" {{#if (eq type 'action' )}}data-action-id="{{item.id}}" {{/if}}
|
||||||
|
data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
|
||||||
|
<div class="inventory-item-header" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
|
||||||
|
{{!-- Image --}}
|
||||||
|
<div class="img-portait"
|
||||||
|
data-action='{{ifThen (hasProperty item "use") "useItem" (ifThen (hasProperty item "toChat") "toChat" "editDoc") }}'
|
||||||
|
{{#unless hideTooltip}}data-tooltip="#item#{{item.uuid}}" {{/unless}}>
|
||||||
|
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" />
|
||||||
|
<img class="roll-img" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt="d20">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!-- Name & Tags --}}
|
||||||
|
<div class="item-label {{#if hideResources}}fullWidth{{/if}}">
|
||||||
|
|
||||||
|
{{!-- Item Name --}}
|
||||||
|
<div class="item-name">{{item.name}}</div>
|
||||||
|
|
||||||
|
{{!-- Weapon Block Start --}}
|
||||||
|
{{#if (eq type 'weapon')}}
|
||||||
|
{{#if (not hideTags)}}
|
||||||
|
<div class="item-tags">
|
||||||
|
<div class="tag">
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
{{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}}
|
||||||
|
(
|
||||||
|
{{#each item.system.attack.damage.parts.0.type as |type|}}
|
||||||
|
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' type '.abbreviation')}}
|
||||||
|
{{#unless @last}}|{{/unless}}
|
||||||
|
{{/each}}
|
||||||
|
)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else if (not hideLabels)}}
|
||||||
|
<div class="item-labels">
|
||||||
|
<div class="label">
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}}
|
||||||
|
{{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>
|
||||||
|
|
||||||
|
{{!-- Simple Resource --}}
|
||||||
|
{{#if (and (not hideResources) (eq item.system.resource.type 'simple'))}}
|
||||||
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
|
{{/if}}
|
||||||
|
{{#if (and (not hideResources) item.system.quantity)}}
|
||||||
|
<div class="item-resource">
|
||||||
|
<input type="number" class="inventory-item-quantity" value="{{item.system.quantity}}" step="1" />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{!-- 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>
|
||||||
|
{{else if (eq type 'effect')}}
|
||||||
|
<a data-action="toggleEffect"
|
||||||
|
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.disabled 'enableEffect' 'disableEffect' }}">
|
||||||
|
<i class="{{ifThen item.disabled 'fa-regular fa-lightbulb' 'fa-solid fa-lightbulb'}}"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (hasProperty item "toChat")}}
|
||||||
|
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
|
||||||
|
<i class="fa-regular fa-message"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
|
||||||
|
<i class="fa-solid fa-ellipsis-vertical"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/unless}}
|
||||||
|
</div>
|
||||||
|
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}">
|
||||||
|
{{!-- Description --}}
|
||||||
|
{{#unless hideDescription}}
|
||||||
|
<div class="invetory-description"></div>
|
||||||
|
{{/unless}}
|
||||||
|
{{!-- Dice Resource --}}
|
||||||
|
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}
|
||||||
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
|
{{/if}}
|
||||||
|
{{!-- Actions Buttons --}}
|
||||||
|
{{#if (and showActions (eq item.type 'feature'))}}
|
||||||
|
<div class="item-buttons">
|
||||||
|
{{#each item.system.actions as | action |}}
|
||||||
|
<button type="button" data-action="useAction" data-action-id="{{action.id}}">
|
||||||
|
{{action.name}}
|
||||||
|
</button>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
@ -1,197 +0,0 @@
|
||||||
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
|
|
||||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
|
|
||||||
<div class="item-label-wrapper">
|
|
||||||
<div class="item-label {{#unless (and (not isSidebar) (or (eq item.system.resource.type 'simple') item.system.quantity))}}fullWidth{{/unless}}">
|
|
||||||
{{#if isCompanion}}
|
|
||||||
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
|
||||||
{{else}}
|
|
||||||
<div class="item-name">{{item.name}}</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'weapon')}}
|
|
||||||
<div class="item-tags">
|
|
||||||
{{#if isSidebar}}
|
|
||||||
<div class="item-labels">
|
|
||||||
<div class="label">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}}
|
|
||||||
{{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}}
|
|
||||||
{{#each item.system.attack.damage.parts.0.type as | type | }}
|
|
||||||
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
|
||||||
<i class="fa-solid {{icon}}"></i>
|
|
||||||
{{/with}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{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}}
|
|
||||||
(
|
|
||||||
{{#each item.system.attack.damage.parts.0.type}}
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' this '.abbreviation')}}
|
|
||||||
{{/each}}
|
|
||||||
)
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'armor')}}
|
|
||||||
{{#if isSidebar}}
|
|
||||||
<div class="item-labels">
|
|
||||||
<div class="label">
|
|
||||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
|
||||||
{{item.system.baseScore}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<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}}
|
|
||||||
<span>/</span>
|
|
||||||
{{item.system.baseThresholds.severe}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'domainCard')}}
|
|
||||||
{{#if isSidebar}}
|
|
||||||
<div class="item-labels">
|
|
||||||
<div class="label">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.DomainCardTypes.' item.system.type)}}
|
|
||||||
<span> - </span>
|
|
||||||
{{localize (concat 'DAGGERHEART.GENERAL.Domain.' item.system.domain '.label')}}
|
|
||||||
<span> - </span>
|
|
||||||
<span class="recall-value">{{item.system.recallCost}}</span>
|
|
||||||
<i class="fa-solid fa-bolt"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<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>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'effect')}}
|
|
||||||
<div class="item-tags">
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'TYPES.Item.' item.parent.type)}}
|
|
||||||
<span>: </span>
|
|
||||||
{{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>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'action')}}
|
|
||||||
<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>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{#if (and (not isSidebar) (eq item.system.resource.type 'simple'))}}
|
|
||||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if (and (not isSidebar) item.system.quantity)}}
|
|
||||||
<div class="item-resource">
|
|
||||||
<input type="number" class="inventory-item-quantity" value="{{item.system.quantity}}" step="1" />
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{#unless hideControls}}
|
|
||||||
{{#if isActor}}
|
|
||||||
<div class="controls">
|
|
||||||
{{#if (eq type 'actor')}}
|
|
||||||
<a data-action="viewActor" data-potential-adversary="{{categoryAdversary}}" data-adversary="{{item.uuid}}" data-tooltip='{{localize "DAGGERHEART.UI.Tooltip.openActorWorld"}}'>
|
|
||||||
<i class="fa-solid fa-globe"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'adversary')}}
|
|
||||||
<a data-action="viewAdversary" data-potential-adversary="{{categoryAdversary}}" data-adversary="{{item.uuid}}" data-tooltip='{{localize "DAGGERHEART.UI.Tooltip.openActorWorld"}}'>
|
|
||||||
<i class="fa-solid fa-globe"></i>
|
|
||||||
</a>
|
|
||||||
<a data-action='deleteAdversary' data-potential-adversary="{{categoryAdversary}}" data-adversary="{{item.uuid}}" data-tooltip='{{localize "CONTROLS.CommonDelete"}}'>
|
|
||||||
<i class='fas fa-trash'></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="controls">
|
|
||||||
{{#if (eq type 'weapon')}}
|
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
|
||||||
<i class="fa-solid fa-hands"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'armor')}}
|
|
||||||
<a class="{{#unless item.system.equipped}}unequipped{{/unless}}" data-action="toggleEquipItem" data-tooltip="{{#unless item.system.equipped}}{{localize 'DAGGERHEART.UI.Tooltip.equip'}}{{else}}{{localize 'DAGGERHEART.UI.Tooltip.unequip'}}{{/unless}}">
|
|
||||||
<i class="fa-solid fa-shield"></i>
|
|
||||||
</a>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'domainCard')}}
|
|
||||||
{{#unless item.system.inVault}}
|
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToVault'}}">
|
|
||||||
<i class="fa-solid fa-arrow-down"></i>
|
|
||||||
</a>
|
|
||||||
{{else}}
|
|
||||||
<a data-action="toggleVault" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToLoadout'}}">
|
|
||||||
<i class="fa-solid fa-arrow-up"></i>
|
|
||||||
</a>
|
|
||||||
{{/unless}}
|
|
||||||
|
|
||||||
{{/if}}
|
|
||||||
<a data-action="toChat" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.sendToChat'}}"><i class="fa-regular fa-message"></i></a>
|
|
||||||
<a data-action="triggerContextMenu" data-tooltip="{{localize 'DAGGERHEART.UI.Tooltip.moreOptions'}}"><i class="fa-solid fa-ellipsis-vertical"></i></a>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
<span></span>
|
|
||||||
{{/unless}}
|
|
||||||
<div class="item-description">{{#unless isSidebar}}{{{item.system.description}}}{{/unless}}</div>
|
|
||||||
{{#if (and (not isSidebar) (eq item.system.resource.type 'diceValue'))}}
|
|
||||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
|
||||||
{{/if}}
|
|
||||||
{{#if featureType}}
|
|
||||||
<div class="item-buttons">
|
|
||||||
{{#each item.system.actions as | action |}}
|
|
||||||
<button type="button" data-action="useAction" data-action-id="{{action.id}}">{{action.name}}</button>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</li>
|
|
||||||
|
|
@ -3,22 +3,11 @@
|
||||||
data-tab='{{tabs.actions.id}}'
|
data-tab='{{tabs.actions.id}}'
|
||||||
data-group='{{tabs.actions.group}}'
|
data-group='{{tabs.actions.group}}'
|
||||||
>
|
>
|
||||||
<fieldset class="one-column">
|
|
||||||
<legend>{{localize "DAGGERHEART.GENERAL.Action.plural"}} <a><i class="fa-solid fa-plus icon-button" data-action="addAction"></i></a></legend>
|
{{> 'daggerheart.inventory-items'
|
||||||
<div class="actions-list">
|
title='DAGGERHEART.GENERAL.Action.plural'
|
||||||
{{#each document.system.actions as |action index|}}
|
collection=document.system.actions
|
||||||
<div class="action-item"
|
type='action'
|
||||||
data-action="editAction"
|
canCreate=true
|
||||||
data-index="{{index}}"
|
}}
|
||||||
data-tooltip="{{concat "#item#" @root.document.uuid "#action#" action.id}}"
|
|
||||||
>
|
|
||||||
<img class="image" src="{{action.img}}" />
|
|
||||||
<span>{{action.name}}</span>
|
|
||||||
<div class="controls">
|
|
||||||
<a data-action="removeAction"><i class="fa-solid fa-trash"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,26 +1,21 @@
|
||||||
<section
|
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
|
||||||
class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}'
|
data-group='{{tabs.effects.group}}'>
|
||||||
data-tab='{{tabs.effects.id}}'
|
|
||||||
data-group='{{tabs.effects.group}}'
|
{{> 'daggerheart.inventory-items'
|
||||||
>
|
title='DAGGERHEART.GENERAL.activeEffects'
|
||||||
<fieldset class="one-column">
|
type='effect'
|
||||||
<legend>
|
isGlassy=true
|
||||||
{{localize "DAGGERHEART.GENERAL.Effect.plural"}}
|
collection=effects.actives
|
||||||
<a data-action="createDoc" data-document-class="ActiveEffect" data-type="base">
|
canCreate=true
|
||||||
<i class="fa-solid fa-plus icon-button"></i>
|
hideResources=true
|
||||||
</a>
|
}}
|
||||||
</legend>
|
|
||||||
<div class="effects-list">
|
{{> 'daggerheart.inventory-items'
|
||||||
{{#each document.effects as |effect|}}
|
title='DAGGERHEART.GENERAL.inactiveEffects'
|
||||||
<div class="effect-item">
|
type='effect'
|
||||||
<img class="image" src="{{effect.img}}" />
|
isGlassy=true
|
||||||
<span>{{effect.name}}</span>
|
collection=effects.inactives
|
||||||
<div class="controls">
|
canCreate=true
|
||||||
<a data-action="editDoc" data-type="ActiveEffect" data-doc-id="{{effect.id}}"><i class="fa-solid fa-pen-to-square"></i></a>
|
hideResources=true
|
||||||
<a data-action="deleteDoc" data-type="ActiveEffect" data-doc-id="{{effect.id}}" {{disabled effect.mandatory}}><i class="fa-solid fa-trash icon-button {{disabled effect.mandatory}}"></i></a>
|
}}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<section
|
|
||||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
|
||||||
data-tab='{{tabs.features.id}}'
|
|
||||||
data-group='{{tabs.features.group}}'
|
|
||||||
>
|
|
||||||
<fieldset>
|
|
||||||
<legend>{{localize "DAGGERHEART.GENERAL.Tabs.features"}}</legend>
|
|
||||||
<div class="feature-list">
|
|
||||||
{{#each source.system.abilities as |feature key|}}
|
|
||||||
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' feature=feature}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,23 +1,11 @@
|
||||||
<section
|
<section class='tab {{tabs.features.cssClass}} {{tabs.features.id}}' data-tab='{{tabs.features.id}}'
|
||||||
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
|
data-group='{{tabs.features.group}}'>
|
||||||
data-tab='{{tabs.features.id}}'
|
{{> 'daggerheart.inventory-items'
|
||||||
data-group='{{tabs.features.group}}'
|
title='DAGGERHEART.GENERAL.features'
|
||||||
>
|
type='feature'
|
||||||
<fieldset class="one-column drop-section">
|
isGlassy=true
|
||||||
<legend>{{localize "DAGGERHEART.GENERAL.features"}} <a><i data-action="addFeature" class="fa-solid fa-plus icon-button"></i></a></legend>
|
collection=document.system.features
|
||||||
<div class="features-list">
|
canCreate=(or document.parent isGM)
|
||||||
{{#each document.system.features as |feature|}}
|
showActions=false
|
||||||
<div class="feature-item"
|
}}
|
||||||
data-action="editFeature"
|
|
||||||
id="{{feature.id}}"
|
|
||||||
>
|
|
||||||
<img class="image" src="{{feature.img}}" data-tooltip="{{concat "#item#" feature.uuid}}" />
|
|
||||||
<span>{{feature.name}}</span>
|
|
||||||
<div class="controls">
|
|
||||||
<a data-action="removeFeature" id="{{feature.id}}"><i class="fa-solid fa-trash"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedPrimaryWeaponTitle"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedPrimaryWeaponTitle"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#if document.system.characterGuide.suggestedPrimaryWeapon}}
|
{{#if document.system.characterGuide.suggestedPrimaryWeapon}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{document.system.characterGuide.suggestedPrimaryWeapon.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{document.system.characterGuide.suggestedPrimaryWeapon.uuid}}">
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
|
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedSecondaryWeaponTitle"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedSecondaryWeaponTitle"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#if document.system.characterGuide.suggestedSecondaryWeapon}}
|
{{#if document.system.characterGuide.suggestedSecondaryWeapon}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{system.system.characterGuide.suggestedSecondaryWeapon.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{system.system.characterGuide.suggestedSecondaryWeapon.uuid}}">
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
|
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedArmorTitle"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedArmorTitle"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#if document.system.characterGuide.suggestedArmor}}
|
{{#if document.system.characterGuide.suggestedArmor}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{document.system.characterGuide.suggestedArmor.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{document.system.characterGuide.suggestedArmor.uuid}}">
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedArmor.name}}</span>
|
<span>{{document.system.characterGuide.suggestedArmor.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.GENERAL.take"}}</legend>
|
<legend>{{localize "DAGGERHEART.GENERAL.take"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#each source.system.inventory.take}}
|
{{#each source.system.inventory.take}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{this.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
|
||||||
<img class="image" src="{{this.img}}" />
|
<img class="image" src="{{this.img}}" />
|
||||||
<span>{{this.name}}</span>
|
<span>{{this.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.thenChoose"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.thenChoose"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#each source.system.inventory.choiceA}}
|
{{#each source.system.inventory.choiceA}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{this.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
|
||||||
<img class="image" src="{{this.img}}" />
|
<img class="image" src="{{this.img}}" />
|
||||||
<span>{{this.name}}</span>
|
<span>{{this.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.andEither"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.andEither"}}</legend>
|
||||||
<div class="drop-section-body list-items">
|
<div class="drop-section-body list-items">
|
||||||
{{#each source.system.inventory.choiceB}}
|
{{#each source.system.inventory.choiceB}}
|
||||||
<div class="suggested-item item-line" data-action="viewDoc" data-uuid="{{this.uuid}}">
|
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
|
||||||
<img class="image" src="{{this.img}}" />
|
<img class="image" src="{{this.img}}" />
|
||||||
<span>{{this.name}}</span>
|
<span>{{this.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,31 @@
|
||||||
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
||||||
<div class="dice-flavor">{{title}}</div>
|
<div class="dice-flavor">{{title}}</div>
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="dice-formula">{{roll.formula}}</div>
|
{{#each roll as | resource index | }}
|
||||||
<div class="dice-tooltip">
|
<div class="dice-formula">{{resource.formula}}</div>
|
||||||
<div class="wrapper">
|
<div class="dice-tooltip">
|
||||||
<section class="tooltip-part">
|
<div class="wrapper">
|
||||||
{{#each roll.dice}}
|
{{#each resource.parts}}
|
||||||
<div class="dice">
|
<section class="tooltip-part">
|
||||||
<header class="part-header flexrow">
|
<div class="dice">
|
||||||
<span class="part-formula">{{formula}}</span>
|
<header class="part-header flexrow">
|
||||||
<span class="part-total">{{total}}</span>
|
<span class="part-formula">{{formula}}</span>
|
||||||
</header>
|
<span class="part-total">{{total}}</span>
|
||||||
<ol class="dice-rolls">
|
</header>
|
||||||
{{#each results}}
|
<ol class="dice-rolls">
|
||||||
<li class="roll die {{../denomination}} min">{{result}}</li>
|
{{#each dice}}
|
||||||
{{/each}}
|
{{#each results}}
|
||||||
</ol>
|
<li class="roll die {{../dice}} min">{{result}}</li>
|
||||||
</div>
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</section>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="dice-total">{{resource.total}}</div>
|
||||||
<div class="dice-total">{{roll.total}}</div>
|
{{/each}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<button class="healing-button"><span>{{localize "DAGGERHEART.UI.Chat.healingRoll.heal"}}</span></button>
|
<button class="healing-button"><span>{{localize "DAGGERHEART.UI.Chat.healingRoll.heal"}}</span></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,33 @@
|
||||||
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
||||||
{{#unless noTitle}}<div class="dice-flavor">{{damage.title}}</div>{{/unless}}
|
{{#unless noTitle}}<div class="dice-flavor">{{damage.title}}</div>{{/unless}}
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="dice-formula">{{damage.roll.formula}}</div>
|
{{#each damage.roll as | roll index | }}
|
||||||
<div class="dice-tooltip">
|
<div class="dice-flavor">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}}</div>
|
||||||
<div class="wrapper">
|
<div class="dice-formula">{{roll.formula}}</div>
|
||||||
<section class="tooltip-part">
|
<div class="dice-tooltip">
|
||||||
{{#each damage.roll.dice}}
|
<div class="wrapper">
|
||||||
<div class="dice">
|
{{#each roll.parts}}
|
||||||
<header class="part-header flexrow">
|
<section class="tooltip-part">
|
||||||
<span class="part-formula">{{formula}}</span>
|
<div class="dice">
|
||||||
<span class="part-total">{{total}}</span>
|
<header class="part-header flexrow">
|
||||||
</header>
|
<span class="part-formula">{{formula}}</span>
|
||||||
<ol class="dice-rolls">
|
<span class="part-total">{{total}}</span>
|
||||||
{{#each results}}
|
</header>
|
||||||
<li class="roll die {{../dice}} min">{{result}}</li>
|
<ol class="dice-rolls">
|
||||||
{{/each}}
|
{{#each dice}}
|
||||||
</ol>
|
{{#each results}}
|
||||||
</div>
|
<li class="roll die {{../dice}} min">{{result}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if damage.roll.modifierTotal}}<div class="duality-modifier">{{#if (gt damage.roll.modifierTotal 0)}}+{{/if}}{{damage.roll.modifierTotal}}</div>{{/if}}
|
{{/each}}
|
||||||
<div class="duality-result">Total: {{damage.roll.total}}</div>
|
</ol>
|
||||||
</section>
|
</div>
|
||||||
|
{{#if modifierTotal}}<div class="duality-modifier">{{#if (gt modifierTotal 0)}}+{{/if}}{{modifierTotal}}</div>{{/if}}
|
||||||
|
<div class="duality-result">Total: {{total}}</div>
|
||||||
|
</section>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="dice-total">{{roll.total}}</div>
|
||||||
<div class="dice-total">{{damage.roll.total}}</div>
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue