Compare commits

..

No commits in common. "c57266e5966008199a915bffaef99cb3e97f4c63" and "1f4241437eecf210f51abec23e26f877e20866d7" have entirely different histories.

67 changed files with 353 additions and 1311 deletions

View file

@ -1,5 +1,3 @@
[*]
indent_size = 4
indent_style = spaces
[*.yml]
indent_size = 2

View file

@ -1,42 +0,0 @@
name: Project CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24.x]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Cache NPM Deps
id: cache-npm
uses: actions/cache@v3
with:
path: node_modules/
key: npm-${{ hashFiles('package-lock.json') }}
- name: Install NPM Deps
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci
- name: Lint
run: npm run lint

View file

@ -361,7 +361,7 @@ Hooks.on(CONFIG.DH.HOOKS.hooksConfig.groupRollStart, async data => {
const updateActorsRangeDependentEffects = async token => {
if (!token) return;
const rangeMeasurement = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.variantRules

View file

@ -1,14 +0,0 @@
import globals from 'globals';
import { defineConfig } from 'eslint/config';
import prettier from 'eslint-plugin-prettier';
export default defineConfig([
{ files: ['**/*.{js,mjs,cjs}'], languageOptions: { globals: globals.browser } },
{ plugins: { prettier } },
{
files: ['**/*.{js,mjs,cjs}'],
rules: {
'prettier/prettier': 'error'
}
}
]);

View file

@ -118,9 +118,7 @@
"deleteTriggerTitle": "Delete Trigger",
"deleteTriggerContent": "Are you sure you want to delete the {trigger} trigger?",
"advantageState": "Advantage State",
"damageOnSave": "Damage on Save",
"useDefaultItemValues": "Use default Item values",
"itemDamageIsUsed": "Item Damage Is Used"
"damageOnSave": "Damage on Save"
},
"RollField": {
"diceRolling": {
@ -135,7 +133,7 @@
"attackModifier": "Attack Modifier",
"attackName": "Attack Name",
"criticalThreshold": "Critical Threshold",
"includeBase": { "label": "Use Item Damage" },
"includeBase": { "label": "Include Item Damage" },
"groupAttack": { "label": "Group Attack" },
"multiplier": "Multiplier",
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",
@ -3241,7 +3239,6 @@
"Tooltip": {
"disableEffect": "Disable Effect",
"enableEffect": "Enable Effect",
"edit": "Edit",
"openItemWorld": "Open Item World",
"openActorWorld": "Open Actor World",
"sendToChat": "Send to Chat",

View file

@ -259,9 +259,8 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
const resetValue = increasing
? 0
: feature.system.resource.max
? new Roll(Roll.replaceFormulaData(feature.system.resource.max, this.actor)).evaluateSync().total
? Roll.replaceFormulaData(feature.system.resource.max, this.actor)
: 0;
await feature.update({ 'system.resource.value': resetValue });
}

View file

@ -28,8 +28,10 @@ export default class DHActionConfig extends DHActionBaseConfig {
game.system.api.data.activeEffects.BaseEffect.getDefaultObject({ transfer: false })
]);
if (areaIndex !== undefined) data.area[areaIndex].effects.push(created[0]._id);
else data.effects.push({ _id: created[0]._id });
if (areaIndex !== undefined)
data.area[areaIndex].effects.push(created[0]._id);
else
data.effects.push({ _id: created[0]._id });
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
this.action.item.effects.get(created[0]._id).sheet.render(true);
}
@ -55,14 +57,14 @@ export default class DHActionConfig extends DHActionBaseConfig {
static removeEffect(event, button) {
if (!this.action.effects) return;
const { areaIndex, index } = button.dataset;
let effectId = null;
const { areaIndex, index } = button.dataset;
let effectId = null;
if (areaIndex !== undefined) {
effectId = this.action.area[areaIndex].effects[index];
const data = this.action.toObject();
data.area[areaIndex].effects.splice(index, 1);
this.constructor.updateForm.call(this, null, null, { object: foundry.utils.flattenObject(data) });
} else {
} else {
effectId = this.action.effects[index]._id;
this.constructor.removeElement.call(this, event, button);
}

View file

@ -40,8 +40,10 @@ export default class DHActionSettingsConfig extends DHActionBaseConfig {
this.sheetUpdate(data, effectData);
this.effects = [...this.effects, effectData];
if (areaIndex !== undefined) data.area[areaIndex].effects.push(effectData.id);
else data.effects.push({ _id: effectData.id });
if(areaIndex !== undefined)
data.area[areaIndex].effects.push(effectData.id);
else
data.effects.push({ _id: effectData.id });
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}
@ -60,6 +62,7 @@ export default class DHActionSettingsConfig extends DHActionBaseConfig {
this.constructor.removeElement.call(this, event, button);
}
this.sheetUpdate(
this.action.toObject(),
this.effects.find(x => x.id === effectId),

View file

@ -12,6 +12,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
static DEFAULT_OPTIONS = {
classes: ['character'],
position: { width: 850, height: 800 },
/* Foundry adds disabled to all buttons and inputs if editPermission is missing. This is not desired. */
editPermission: CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
actions: {
toggleVault: CharacterSheet.#toggleVault,
rollAttribute: CharacterSheet.#rollAttribute,
@ -66,7 +68,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
},
{
handler: CharacterSheet.#getEquipmentContextOptions,
handler: CharacterSheet.#getEquipamentContextOptions,
selector: '[data-item-uuid][data-type="armor"], [data-item-uuid][data-type="weapon"]',
options: {
parentClassHooks: false,
@ -168,16 +170,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
return applicationOptions;
}
/** @inheritdoc */
_toggleDisabled(disabled) {
// Overriden to only disable text inputs by default.
// Everything else is done by checking @root.editable in the sheet
const form = this.form;
for (const input of form.querySelectorAll('input:not([type=search]), .editor.prosemirror')) {
input.disabled = disabled;
}
}
/** @inheritDoc */
async _onRender(context, options) {
await super._onRender(context, options);
@ -323,11 +315,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
const options = [
{
label: 'toLoadout',
name: 'toLoadout',
icon: 'fa-solid fa-arrow-up',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc?.isOwner && doc.system.inVault;
return doc && doc.system.inVault;
},
callback: async target => {
const doc = await getDocFromElement(target);
@ -337,11 +329,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
},
{
label: 'recall',
name: 'recall',
icon: 'fa-solid fa-bolt-lightning',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc?.isOwner && doc.system.inVault;
return doc && doc.system.inVault;
},
callback: async (target, event) => {
const doc = await getDocFromElement(target);
@ -376,17 +368,17 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
},
{
label: 'toVault',
name: 'toVault',
icon: 'fa-solid fa-arrow-down',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc?.isOwner && !doc.system.inVault;
return doc && !doc.system.inVault;
},
callback: async target => (await getDocFromElement(target)).update({ 'system.inVault': true })
}
].map(option => ({
...option,
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
icon: `<i class="${option.icon}"></i>`
}));
@ -399,29 +391,29 @@ export default class CharacterSheet extends DHBaseActorSheet {
* @this {CharacterSheet}
* @protected
*/
static #getEquipmentContextOptions() {
static #getEquipamentContextOptions() {
const options = [
{
label: 'equip',
name: 'equip',
icon: 'fa-solid fa-hands',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc.isOwner && doc && !doc.system.equipped;
return doc && !doc.system.equipped;
},
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
},
{
label: 'unequip',
name: 'unequip',
icon: 'fa-solid fa-hands',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc.isOwner && doc && doc.system.equipped;
return doc && doc.system.equipped;
},
callback: (target, event) => CharacterSheet.#toggleEquipItem.call(this, event, target)
}
].map(option => ({
...option,
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
icon: `<i class="${option.icon}"></i>`
}));

View file

@ -418,18 +418,18 @@ export default function DHApplicationMixin(Base) {
/**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */
const options = [
{
label: 'disableEffect',
name: 'disableEffect',
icon: 'fa-solid fa-lightbulb',
visible: element => {
condition: element => {
const target = element.closest('[data-item-uuid]');
return !target.dataset.disabled && target.dataset.itemType !== 'beastform';
},
callback: async target => (await getDocFromElement(target)).update({ disabled: true })
},
{
label: 'enableEffect',
name: 'enableEffect',
icon: 'fa-regular fa-lightbulb',
visible: element => {
condition: element => {
const target = element.closest('[data-item-uuid]');
return target.dataset.disabled && target.dataset.itemType !== 'beastform';
},
@ -437,7 +437,7 @@ export default function DHApplicationMixin(Base) {
}
].map(option => ({
...option,
label: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.label}`,
name: `DAGGERHEART.APPLICATIONS.ContextMenu.${option.name}`,
icon: `<i class="${option.icon}"></i>`
}));
@ -468,14 +468,14 @@ export default function DHApplicationMixin(Base) {
_getContextMenuCommonOptions({ usable = false, toChat = false, deletable = true }) {
const options = [
{
label: 'CONTROLS.CommonEdit',
name: 'CONTROLS.CommonEdit',
icon: 'fa-solid fa-pen-to-square',
visible: target => {
condition: target => {
const { dataset } = target.closest('[data-item-uuid]');
const doc = getDocFromElementSync(target);
return (
(!dataset.noCompendiumEdit && !doc) ||
(doc?.isOwner && (!doc?.hasOwnProperty('systemPath') || doc?.inCollection))
(doc && (!doc?.hasOwnProperty('systemPath') || doc?.inCollection))
);
},
callback: async target => (await getDocFromElement(target)).sheet.render({ force: true })
@ -484,14 +484,14 @@ export default function DHApplicationMixin(Base) {
if (usable) {
options.unshift({
label: 'DAGGERHEART.GENERAL.damage',
name: 'DAGGERHEART.GENERAL.damage',
icon: 'fa-solid fa-explosion',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
const hasDamage =
return (
!foundry.utils.isEmpty(doc?.system?.attack?.damage.parts) ||
!foundry.utils.isEmpty(doc?.damage?.parts);
return doc?.isOwner && hasDamage;
!foundry.utils.isEmpty(doc?.damage?.parts)
);
},
callback: async (target, event) => {
const doc = await getDocFromElement(target),
@ -507,11 +507,11 @@ export default function DHApplicationMixin(Base) {
});
options.unshift({
label: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
icon: 'fa-solid fa-burst',
visible: target => {
condition: target => {
const doc = getDocFromElementSync(target);
return doc?.isOwner && !(doc.type === 'domainCard' && doc.system.inVault);
return doc && !(doc.type === 'domainCard' && doc.system.inVault);
},
callback: async (target, event) => (await getDocFromElement(target)).use(event)
});
@ -519,19 +519,18 @@ export default function DHApplicationMixin(Base) {
if (toChat)
options.push({
label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
icon: 'fa-solid fa-message',
callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid)
});
if (deletable)
options.push({
label: 'CONTROLS.CommonDelete',
name: 'CONTROLS.CommonDelete',
icon: 'fa-solid fa-trash',
visible: element => {
condition: element => {
const target = element.closest('[data-item-uuid]');
const doc = getDocFromElementSync(target);
return doc?.isOwner && target.dataset.itemType !== 'beastform';
return target.dataset.itemType !== 'beastform';
},
callback: async (target, event) => {
const doc = await getDocFromElement(target);

View file

@ -31,7 +31,7 @@ export default class FeatureSheet extends DHBaseItemSheet {
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}
};
//Might be wrong location but testing out if here is okay.
//Might be wrong location but testing out if here is okay.
/**@override */
async _prepareContext(options) {
const context = await super._prepareContext(options);

View file

@ -48,9 +48,9 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
const options = super._getEntryContextOptions();
options.push(
{
label: 'DAGGERHEART.UI.Sidebar.actorDirectory.duplicateToNewTier',
name: 'DAGGERHEART.UI.Sidebar.actorDirectory.duplicateToNewTier',
icon: `<i class="fa-solid fa-arrow-trend-up" inert></i>`,
visible: li => {
condition: li => {
const actor = game.actors.get(li.dataset.entryId);
return actor?.type === 'adversary' && actor.system.type !== 'social';
},
@ -92,9 +92,9 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
}
},
{
label: 'DAGGERHEART.UI.Sidebar.actorDirectory.activateParty',
name: 'DAGGERHEART.UI.Sidebar.actorDirectory.activateParty',
icon: `<i class="fa-regular fa-square"></i>`,
visible: li => {
condition: li => {
const actor = game.actors.get(li.dataset.entryId);
return actor && actor.type === 'party' && !actor.system.active;
},

View file

@ -103,10 +103,23 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
_getEntryContextOptions() {
return [
...super._getEntryContextOptions(),
// {
// name: 'Reroll',
// icon: '<i class="fa-solid fa-dice"></i>',
// condition: li => {
// const message = game.messages.get(li.dataset.messageId);
// return (game.user.isGM || message.isAuthor) && message.rolls.length > 0;
// },
// callback: li => {
// const message = game.messages.get(li.dataset.messageId);
// new game.system.api.applications.dialogs.RerollDialog(message).render({ force: true });
// }
// },
{
label: 'DAGGERHEART.UI.ChatLog.rerollDamage',
name: game.i18n.localize('DAGGERHEART.UI.ChatLog.rerollDamage'),
icon: '<i class="fa-solid fa-dice"></i>',
visible: li => {
condition: li => {
const message = game.messages.get(li.dataset.messageId);
const hasRolledDamage = message.system.hasDamage
? Object.keys(message.system.damage).length > 0

View file

@ -84,15 +84,15 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
_getCombatContextOptions() {
return [
{
label: 'COMBAT.ClearMovementHistories',
name: 'COMBAT.ClearMovementHistories',
icon: '<i class="fa-solid fa-shoe-prints"></i>',
visible: () => game.user.isGM && this.viewed?.combatants.size > 0,
condition: () => game.user.isGM && this.viewed?.combatants.size > 0,
callback: () => this.viewed.clearMovementHistories()
},
{
label: 'COMBAT.Delete',
name: 'COMBAT.Delete',
icon: '<i class="fa-solid fa-trash"></i>',
visible: () => game.user.isGM && !!this.viewed,
condition: () => game.user.isGM && !!this.viewed,
callback: () => this.viewed.endCombat()
}
];

View file

@ -100,11 +100,7 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
const { line, rectangle, inFront, cone } = CONFIG.DH.GENERAL.templateTypes;
const usedAngle =
type === cone.id
? (angle ?? CONFIG.MeasuredTemplate.defaults.angle)
: type === inFront.id
? '180'
: undefined;
type === cone.id ? (angle ?? CONFIG.MeasuredTemplate.defaults.angle) : type === inFront.id ? '180' : undefined;
const { grid, distance } = CONFIG.Scene.documentClass.schema.fields.grid.fields;
const sceneGridSize = canvas.scene?.grid.size ?? grid.size.initial;
@ -113,8 +109,7 @@ export default class DhRegionLayer extends foundry.canvas.layers.RegionLayer {
const rangeNumber = Number(range);
const settings = canvas.scene?.rangeSettings;
const baseDistance =
(!Number.isNaN(rangeNumber) ? rangeNumber : settings ? settings[range] : 0) * dimensionConstant;
const baseDistance = (!Number.isNaN(rangeNumber) ? rangeNumber : (settings ? settings[range] : 0)) * dimensionConstant;
const length = baseDistance;
const radius = length;

View file

@ -121,4 +121,4 @@ export const areaTypes = {
id: 'placed',
label: 'Placed Area'
}
};
};

View file

@ -1124,4 +1124,4 @@ export const simpleDispositions = {
id: 1,
label: 'TOKEN.DISPOSITION.FRIENDLY'
}
};
};

View file

@ -75,17 +75,12 @@ export const typeConfig = {
{
key: 'type',
label: 'DAGGERHEART.GENERAL.type',
format: type => (type ? `TYPES.Item.${type}` : '-')
format: type => type ? `TYPES.Item.${type}` : '-'
},
{
key: 'system.secondary',
label: 'DAGGERHEART.UI.ItemBrowser.subtype',
format: isSecondary =>
isSecondary
? 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.short'
: isSecondary === false
? 'DAGGERHEART.ITEMS.Weapon.primaryWeapon.short'
: '-'
format: isSecondary => (isSecondary ? 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.short' : isSecondary === false ? 'DAGGERHEART.ITEMS.Weapon.primaryWeapon.short' : '-')
},
{
key: 'system.tier',
@ -265,12 +260,12 @@ export const typeConfig = {
{
key: 'system.type',
label: 'DAGGERHEART.GENERAL.type',
format: type => (type ? `DAGGERHEART.CONFIG.DomainCardTypes.${type}` : '-')
format: type => type ? `DAGGERHEART.CONFIG.DomainCardTypes.${type}` : '-'
},
{
key: 'system.domain',
label: 'DAGGERHEART.GENERAL.Domain.single',
format: domain => (domain ? CONFIG.DH.DOMAIN.allDomains()[domain].label : '-')
format: domain => domain ? CONFIG.DH.DOMAIN.allDomains()[domain].label : '-'
},
{
key: 'system.level',

View file

@ -42,7 +42,7 @@ export const gameSettings = {
SpotlightRequestQueue: 'SpotlightRequestQueue',
CompendiumBrowserSettings: 'CompendiumBrowserSettings',
SpotlightTracker: 'SpotlightTracker',
ActiveParty: 'ActiveParty'
ActiveParty: 'ActiveParty',
};
export const actionAutomationChoices = {

View file

@ -13,7 +13,7 @@ export default class DHAttackAction extends DHDamageAction {
if (!!this.item?.system?.attack) {
if (this.damage.includeBase) {
const baseDamage = this.getParentDamage();
this.damage.parts.hitPoints = new DHDamageData(baseDamage);
this.damage.parts.unshift(new DHDamageData(baseDamage));
}
if (this.roll.useDefault) {
this.roll.trait = this.item.system.attack.roll.trait;

View file

@ -110,11 +110,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return this._id;
}
/** Returns true if the current user is the owner of the containing item */
get isOwner() {
return this.item?.isOwner ?? true;
}
/**
* Return Item the action is attached too.
*/
@ -148,12 +143,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
: null;
}
/** Returns true if the action is usable */
get usable() {
const actor = this.actor;
return this.isOwner && actor?.type === 'character';
}
static getRollType(parent) {
return 'trait';
}

View file

@ -94,12 +94,9 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
},
{ nullable: true, initial: null }
),
targetDispositions: new fields.SetField(
new fields.NumberField({
choices: CONFIG.DH.GENERAL.simpleDispositions
}),
{ label: 'Affected Dispositions' }
)
targetDispositions: new fields.SetField(new fields.NumberField({
choices: CONFIG.DH.GENERAL.simpleDispositions,
}), { label: 'Affected Dispositions' }),
};
}

View file

@ -20,7 +20,7 @@ export default class DhCharacter extends DhCreature {
settingSheet: DHCharacterSettings,
isNPC: false,
hasInventory: true,
quantifiable: ['loot', 'consumable']
quantifiable: ["loot", "consumable"]
});
}
@ -302,7 +302,7 @@ export default class DhCharacter extends DhCreature {
choices: CONFIG.DH.GENERAL.dieFaces,
initial: null,
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
})
}),
})
})
};
@ -449,7 +449,7 @@ export default class DhCharacter extends DhCreature {
/* All items are valid on characters */
isItemValid() {
return true;
return true;
}
/** @inheritDoc */

View file

@ -78,7 +78,7 @@ export default class DhCompanion extends DhCreature {
choices: CONFIG.DH.GENERAL.dieFaces,
initial: null,
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
})
}),
})
}),
attack: new ActionField({

View file

@ -9,7 +9,7 @@ export default class DhParty extends BaseDataActor {
static get metadata() {
return foundry.utils.mergeObject(super.metadata, {
hasInventory: true,
quantifiable: ['weapon', 'armor', 'loot', 'consumable']
quantifiable: ["weapon", "armor", "loot", "consumable"]
});
}

View file

@ -11,7 +11,7 @@ export default class DHAbilityUse extends foundry.abstract.TypeDataModel {
actor: new fields.StringField(),
item: new fields.StringField(),
action: new fields.StringField()
})
}),
};
}

View file

@ -33,8 +33,8 @@ export default class AreaField extends fields.ArrayField {
initial: CONFIG.DH.GENERAL.range.veryClose.id,
label: 'DAGGERHEART.ACTIONS.Config.area.size'
}),
effects: new fields.ArrayField(new fields.DocumentIdField())
effects: new fields.ArrayField(new fields.DocumentIdField()),
});
super(element, options, context);
}
}
}

View file

@ -40,7 +40,9 @@ export default class DHSummonField extends fields.ArrayField {
const roll = new Roll(itemAbleRollParse(summon.count, this.actor, this.item));
await roll.evaluate();
const count = roll.total;
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active) rolls.push(roll);
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active)
rolls.push(roll);
const actor = await DHSummonField.getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */

View file

@ -287,7 +287,7 @@ export function ActionMixin(Base) {
source: {
actor: this.actor.uuid,
item: this.item.id,
action: this.id
action: this.id,
},
itemOrigin: this.item,
description: this.description || (this.item instanceof Item ? this.item.system.description : '')

View file

@ -108,8 +108,6 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
}
get actionsList() {
// No actions on non-characters
if (this.actor && this.actor.type !== 'character') return [];
return this.actions;
}

View file

@ -99,9 +99,7 @@ export default class DHWeapon extends AttachableItem {
/* -------------------------------------------- */
get actionsList() {
// No actions on non-characters
if (this.actor && this.actor.type !== 'character') return [];
return [this.attack, ...super.actionsList];
return [this.attack, ...this.actions];
}
get customActions() {

View file

@ -1 +1 @@
export { default as applyActiveEffect } from './applyActiveEffect.mjs';
export { default as applyActiveEffect } from './applyActiveEffect.mjs';

View file

@ -1,40 +1,38 @@
export default class DhApplyActiveEffect extends CONFIG.RegionBehavior.dataModels.applyActiveEffect {
static async #getApplicableEffects(token) {
const effects = await Promise.all(this.effects.map(foundry.utils.fromUuid));
return effects.filter(
effect => !effect.system.targetDispositions.size || effect.system.targetDispositions.has(token.disposition)
);
return effects.filter(effect => !effect.system.targetDispositions.size || effect.system.targetDispositions.has(token.disposition));
}
static async #onTokenEnter(event) {
if (!event.user.isSelf) return;
const { token, movement } = event.data;
if ( !event.user.isSelf ) return;
const {token, movement} = event.data;
const actor = token.actor;
if (!actor) return;
if ( !actor ) return;
const resumeMovement = movement ? token.pauseMovement() : undefined;
const effects = await DhApplyActiveEffect.#getApplicableEffects.bind(this)(event.data.token);
const toCreate = [];
for (const effect of effects) {
const data = effect.toObject();
delete data._id;
if (effect.compendium) {
data._stats.duplicateSource = null;
data._stats.compendiumSource = effect.uuid;
} else {
data._stats.duplicateSource = effect.uuid;
data._stats.compendiumSource = null;
}
data._stats.exportSource = null;
data.origin = this.parent.uuid;
toCreate.push(data);
for ( const effect of effects ) {
const data = effect.toObject();
delete data._id;
if ( effect.compendium ) {
data._stats.duplicateSource = null;
data._stats.compendiumSource = effect.uuid;
} else {
data._stats.duplicateSource = effect.uuid;
data._stats.compendiumSource = null;
}
if (toCreate.length) await actor.createEmbeddedDocuments('ActiveEffect', toCreate);
data._stats.exportSource = null;
data.origin = this.parent.uuid;
toCreate.push(data);
}
if ( toCreate.length ) await actor.createEmbeddedDocuments("ActiveEffect", toCreate);
await resumeMovement?.();
}
/** @override */
static events = {
...CONFIG.RegionBehavior.dataModels.applyActiveEffect.events,
[CONST.REGION_EVENTS.TOKEN_ENTER]: this.#onTokenEnter
};
}
/** @override */
static events = {
...CONFIG.RegionBehavior.dataModels.applyActiveEffect.events,
[CONST.REGION_EVENTS.TOKEN_ENTER]: this.#onTokenEnter,
};
}

View file

@ -11,9 +11,7 @@ export default class DualityRoll extends D20Roll {
this.rallyChoices = this.setRallyChoices();
this.guaranteedCritical = options.guaranteedCritical;
const advantageFaces = data.rules?.roll?.defaultAdvantageDice
? Number.parseInt(data.rules.roll.defaultAdvantageDice)
: 6;
const advantageFaces = data.rules?.roll?.defaultAdvantageDice ? Number.parseInt(data.rules.roll.defaultAdvantageDice) : 6
this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces;
}

View file

@ -200,6 +200,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
static effectSafeEval(expression) {
let result;
try {
// eslint-disable-next-line no-new-func
const evl = new Function('sandbox', `with (sandbox) { return ${expression}}`);
result = evl(Roll.MATH_PROXY);
} catch (err) {

View file

@ -602,7 +602,7 @@ export default class DhpActor extends Actor {
rollData.system = this.system.getRollData();
rollData.prof = this.system.proficiency ?? 1;
rollData.cast = this.system.spellcastModifier ?? 1;
return rollData;
}

View file

@ -137,7 +137,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
element.addEventListener('click', this.onApplyEffect.bind(this))
);
html.querySelectorAll('.action-areas').forEach(element =>
html.querySelectorAll('.action-areas').forEach(element =>
element.addEventListener('click', this.onCreateAreas.bind(this))
);
@ -254,9 +254,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
}
async onCreateAreas(event) {
const createArea = async selectedArea => {
const createArea = async (selectedArea) => {
const effects = selectedArea.effects.map(effect => this.system.action.item.effects.get(effect).uuid);
const { shape: type, size: range } = selectedArea;
const { shape: type, size: range } = selectedArea;
const shapeData = CONFIG.Canvas.layers.regions.layerClass.getTemplateShape({ type, range });
await canvas.regions.placeRegion(
@ -264,15 +264,13 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
name: selectedArea.name,
shapes: [shapeData],
restriction: { enabled: false, type: 'move', priority: 0 },
behaviors: [
{
name: game.i18n.localize('TYPES.RegionBehavior.applyActiveEffect'),
type: 'applyActiveEffect',
system: {
effects: effects
}
behaviors: [{
name: game.i18n.localize('TYPES.RegionBehavior.applyActiveEffect'),
type: 'applyActiveEffect',
system: {
effects: effects
}
],
}],
displayMeasurements: true,
locked: false,
ownership: { default: CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE },
@ -280,17 +278,18 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
},
{ create: true }
);
};
}
if (this.system.action.area.length === 1) createArea(this.system.action.area[0]);
else if (this.system.action.area.length > 1) {
/* Pop a selection. Possibly a context menu? */
if (this.system.action.area.length === 1)
createArea(this.system.action.area[0]);
else if(this.system.action.area.length > 1) {
/* Pop a selection. Possibly a context menu? */
new foundry.applications.ux.ContextMenu.implementation(
event.target,
'.action-areas',
this.system.action.area.map((area, index) => ({
name: area.name,
callback: () => createArea(this.system.action.area[index])
callback: () => createArea(this.system.action.area[index]),
})),
{
jQuery: false,

View file

@ -3,7 +3,7 @@ export default class DhActorCollection extends foundry.documents.collections.Act
get party() {
const id = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.ActiveParty);
const actor = game.actors.get(id);
return actor?.type === 'party' ? actor : null;
return actor?.type === "party" ? actor : null;
}
/** Ensure companions are initialized after all other subtypes. */

View file

@ -76,13 +76,6 @@ export default class DHItem extends foundry.documents.Item {
return this.system.metadata.isInventoryItem ?? false;
}
/** Returns true if the item can be used */
get usable() {
const actor = this.actor;
const actionsList = this.system.actionsList;
return this.isOwner && actor?.type === 'character' && (actionsList?.size || actionsList?.length);
}
/** @inheritdoc */
static async createDialog(data = {}, createOptions = {}, options = {}) {
const { folders, types, template, context = {}, ...dialogOptions } = options;

View file

@ -61,7 +61,7 @@ export const renderMeasuredTemplate = async event => {
type,
angle,
range,
direction
direction,
});
await canvas.regions.placeRegion(
@ -77,4 +77,4 @@ export const renderMeasuredTemplate = async event => {
},
{ create: true }
);
};
};

View file

@ -16,7 +16,7 @@ export default class RegisterHandlebarsHelpers {
empty: this.empty,
pluralize: this.pluralize,
positive: this.positive,
isNullish: this.isNullish
isNullish: this.isNullish,
});
}
static add(a, b) {

View file

@ -56,10 +56,10 @@ export const registerKeyBindings = () => {
game.keybindings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.keybindings.partySheet, {
name: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.name'),
hint: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.hint'),
editable: [{ key: 'KeyP' }],
editable: [{ key: "KeyP" }],
onDown: () => {
const controlled = canvas.ready ? canvas.tokens.controlled : [];
const selectedParty = controlled.find(c => c.actor?.type === 'party')?.actor;
const selectedParty = controlled.find((c) => c.actor?.type === 'party')?.actor;
const party = selectedParty ?? game.actors.party;
if (!party) return;
@ -215,6 +215,6 @@ const registerNonConfigSettings = () => {
scope: 'world',
config: false,
type: String,
default: null
default: null,
});
};

872
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,18 +17,13 @@
"pullYMLtoLDB": "node ./tools/pullYMLtoLDB.mjs",
"pullYMLtoLDBBuild": "node ./tools/pullYMLtoLDB.mjs --build",
"createSymlink": "node ./tools/create-symlink.mjs",
"setup:dev": "node ./tools/dev-setup.mjs",
"lint": "eslint",
"lint:fix": "eslint --fix"
"setup:dev": "node ./tools/dev-setup.mjs"
},
"devDependencies": {
"@foundryvtt/foundryvtt-cli": "^1.0.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"concurrently": "^8.2.2",
"eslint": "^10.2.1",
"eslint-plugin-prettier": "^5.5.5",
"globals": "^17.5.0",
"husky": "^9.1.5",
"lint-staged": "^15.2.10",
"postcss": "^8.4.32",

View file

@ -11,6 +11,21 @@
padding-bottom: 0;
overflow-x: auto;
&.viewMode {
button:not(.btn-toggle-view),
input:not(.search),
.controls,
.character-sidebar-sheet,
.img-portait,
.name-row,
.hope-section,
.downtime-section,
.character-traits,
.card-list {
pointer-events: none;
}
}
.character-sidebar-sheet {
grid-row: 1 / span 2;
grid-column: 1;

View file

@ -316,9 +316,9 @@
border-radius: 3px;
background: light-dark(@dark-blue, @golden);
clip-path: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
border: 1px solid transparent;
transition: all 0.3s ease;

View file

@ -21,7 +21,7 @@
</div>
{{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}}
{{#each source.parts as |dmg key|}}
{{#each source.parts as |dmg|}}
<div class="nest-inputs">
<fieldset{{#if dmg.base}} disabled{{/if}} class="one-column{{#if ../path}} no-style{{/if}}">
<legend class="with-icon">
@ -31,44 +31,40 @@
{{/unless}}
</legend>
{{#unless (and @root.source.damage.includeBase (eq key 'hitPoints'))}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
<div class="nest-inputs">
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
</fieldset>
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}}
</fieldset>
</div>
{{else}}
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
{{/if}}
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}}
{{/if}}
{{#if ../horde}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
<div class="nest-inputs">
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
<div class="nest-inputs">
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
</div>
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
</fieldset>
{{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}}
</fieldset>
</div>
{{else}}
<span class="hint">{{localize "DAGGERHEART.ACTIONS.Config.itemDamageIsUsed"}}</span>
{{/unless}}
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
{{/if}}
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}}
{{/if}}
{{#if ../horde}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
<div class="nest-inputs">
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
</div>
</fieldset>
{{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
</fieldset>
</div>
{{/each}}

View file

@ -1,7 +1,7 @@
<fieldset class="one-column{{#if source.useDefault}} child-disabled{{/if}}">
<legend>
{{localize "DAGGERHEART.GENERAL.roll"}}
{{#if @root.hasBaseDamage}}{{formInput fields.useDefault name="roll.useDefault" value=source.useDefault dataset=(object tooltip=(localize "DAGGERHEART.ACTIONS.Config.useDefaultItemValues") tooltipDirection="UP")}}{{/if}}
Roll
{{#if @root.hasBaseDamage}}{{formInput fields.useDefault name="roll.useDefault" value=source.useDefault dataset=(object tooltip="Use default Item values" tooltipDirection="UP")}}{{/if}}
</legend>
{{formField fields.type label="DAGGERHEART.GENERAL.type" name="roll.type" value=source.type localize=true choices=@root.getRollTypeOptions localize=true}}

View file

@ -6,7 +6,7 @@
type='effect'
isGlassy=true
collection=effects.actives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
@ -15,7 +15,7 @@
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
</div>

View file

@ -6,8 +6,8 @@
type='feature'
collection=@root.features
hideContextMenu=true
canCreate=@root.editable
showActions=@root.editable
canCreate=true
showActions=true
}}
</div>
</section>

View file

@ -7,7 +7,7 @@
type='effect'
isGlassy=true
collection=effects.actives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
@ -16,7 +16,7 @@
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=@root.editable
canCreate=true
hideResources=true
disabled=true
}}

View file

@ -8,8 +8,8 @@
type='feature'
actorType='character'
collection=category.values
canCreate=@root.editable
showActions=@root.editable
canCreate=true
showActions=true
}}
{{else if category.values}}
{{> 'daggerheart.inventory-items'
@ -18,7 +18,7 @@
actorType='character'
collection=category.values
canCreate=false
showActions=@root.editable
showActions=true
}}
{{/if}}

View file

@ -4,24 +4,22 @@
<h1 class="actor-name input" contenteditable="plaintext-only" data-property="name" placeholder="{{localize "DAGGERHEART.GENERAL.actorName"}}">{{source.name}}</h1>
<div class='level-div'>
<h3 class='label'>
{{#if @root.editable}}
{{#if document.system.needsCharacterSetup}}
<button
type="button"
class="level-button glow"
data-action="levelManagement"
>
{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.buttonTitle"}}
</button>
{{else if document.system.levelData.canLevelUp}}
<button
type="button"
class="level-button glow" data-tooltip="{{localize "DAGGERHEART.ACTORS.Character.levelUp"}}"
data-action="levelManagement"
>
<i class="fa-solid fa-angles-up"></i>
</button>
{{/if}}
{{#if document.system.needsCharacterSetup}}
<button
type="button"
class="level-button glow"
data-action="levelManagement"
>
{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.buttonTitle"}}
</button>
{{else if document.system.levelData.canLevelUp}}
<button
type="button"
class="level-button glow" data-tooltip="{{localize "DAGGERHEART.ACTORS.Character.levelUp"}}"
data-action="levelManagement"
>
<i class="fa-solid fa-angles-up"></i>
</button>
{{/if}}
{{#unless document.system.needsCharacterSetup}}
{{localize 'DAGGERHEART.GENERAL.level'}}
@ -112,14 +110,12 @@
<i class="fa-solid fa-fw fa-users"></i>
</button>
{{/if}}
{{#if @root.editable}}
<button type="button" data-action="useDowntime" data-type="shortRest" data-tooltip="DAGGERHEART.APPLICATIONS.Downtime.shortRest.title">
<i class="fa-solid fa-fw fa-utensils"></i>
</button>
<button type="button" data-action="useDowntime" data-type="longRest" data-tooltip="DAGGERHEART.APPLICATIONS.Downtime.longRest.title">
<i class="fa-solid fa-fw fa-bed"></i>
</button>
{{/if}}
<button type="button" data-action="useDowntime" data-type="shortRest" data-tooltip="DAGGERHEART.APPLICATIONS.Downtime.shortRest.title">
<i class="fa-solid fa-fw fa-utensils"></i>
</button>
<button type="button" data-action="useDowntime" data-type="longRest" data-tooltip="DAGGERHEART.APPLICATIONS.Downtime.longRest.title">
<i class="fa-solid fa-fw fa-bed"></i>
</button>
</div>
</div>

View file

@ -22,7 +22,7 @@
type='weapon'
collection=@root.inventory.weapons
isGlassy=true
canCreate=@root.editable
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
@ -30,7 +30,7 @@
type='armor'
collection=@root.inventory.armor
isGlassy=true
canCreate=@root.editable
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
@ -38,7 +38,7 @@
type='consumable'
collection=@root.inventory.consumables
isGlassy=true
canCreate=@root.editable
canCreate=true
isQuantifiable=true
}}
{{> 'daggerheart.inventory-items'
@ -46,8 +46,8 @@
type='loot'
collection=@root.inventory.loot
isGlassy=true
canCreate=@root.editable
showActions=@root.editable
canCreate=true
showActions=true
isQuantifiable=true
}}
</div>

View file

@ -27,7 +27,7 @@
isGlassy=true
cardView=cardView
collection=document.system.domainCards.loadout
canCreate=@root.editable
canCreate=true
}}
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.Tabs.vault'
@ -35,7 +35,7 @@
isGlassy=true
cardView=cardView
collection=document.system.domainCards.vault
canCreate=@root.editable
canCreate=true
inVault=true
}}
</div>

View file

@ -45,11 +45,11 @@
</a>
{{/times}}
</div>
<a class="slot-label" data-action="toggleArmorMangement" {{disabled (not @root.editable)}}>
<a class="slot-label" data-action="toggleArmorMangement">
<span class="label">{{localize "DAGGERHEART.GENERAL.armorSlots"}}</span>
<div class="slot-value-container">
<span class="value">{{document.system.armorScore.value}} / {{document.system.armorScore.max}}</span>
{{#if @root.editable}}<i class="fa-solid fa-gear" inert></i>{{/if}}
<i class="fa-solid fa-gear"></i>
</div>
</a>
</div>
@ -64,9 +64,9 @@
value='{{document.system.armorScore.value}}'
max='{{document.system.armorScore.max}}'
></progress>
<a class="status-label" data-action="toggleArmorMangement" {{disabled (not @root.editable)}}>
<a class="status-label" data-action="toggleArmorMangement">
<h4>{{localize "DAGGERHEART.GENERAL.armorSlots"}}</h4>
{{#if @root.editable}}<i class="fa-solid fa-gear" inert></i>{{/if}}
<i class="fa-solid fa-gear"></i>
</a>
{{/if}}
</div>

View file

@ -6,7 +6,7 @@
type='effect'
isGlassy=true
collection=effects.actives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
@ -15,7 +15,7 @@
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
</div>

View file

@ -9,8 +9,8 @@
type='feature'
collection=@root.features
hideContextMenu=true
canCreate=@root.editable
showActions=@root.editable
canCreate=true
showActions=true
}}
</div>
</section>

View file

@ -26,7 +26,7 @@
actorType='party'
collection=@root.inventory.weapons
isGlassy=true
canCreate=@root.editable
canCreate=true
hideResources=true
hideContextMenu=true
isQuantifiable=true
@ -37,7 +37,7 @@
actorType='party'
collection=@root.inventory.armor
isGlassy=true
canCreate=@root.editable
canCreate=true
hideResources=true
hideContextMenu=true
isQuantifiable=true
@ -48,7 +48,7 @@
actorType='party'
collection=@root.inventory.consumables
isGlassy=true
canCreate=@root.editable
canCreate=true
hideContextMenu=true
isQuantifiable=true
}}
@ -58,7 +58,7 @@
actorType='party'
collection=@root.inventory.loot
isGlassy=true
canCreate=@root.editable
canCreate=true
hideContextMenu=true
isQuantifiable=true
}}

View file

@ -52,11 +52,12 @@ Parameters:
{{else}}
<ul class="items-list">
{{#each collection as |item|}}
{{> 'daggerheart.inventory-item'
item=item
type=../type
disabledEffect=../disabledEffect
actorType=(ifThen ../actorType ../actorType @root.document.type)
actorType=../actorType
hideControls=../hideControls
hideContextMenu=../hideContextMenu
isActor=../isActor

View file

@ -25,11 +25,11 @@ Parameters:
>
<div class="inventory-item-header {{#if hideContextMenu}}padded{{/if}}" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
{{!-- Image --}}
<div class="img-portait" data-action='{{ifThen item.usable "useItem" (ifThen
<div class="img-portait" data-action='{{ifThen (or (hasProperty item "use") (eq type "attack")) "useItem" (ifThen
(hasProperty item "toChat" ) "toChat" "editDoc" ) }}' {{#unless hideTooltip}} {{#if (eq type 'attack' )}}
data-tooltip="#attack#{{item.actor.uuid}}" {{else}} data-tooltip="#item#{{item.uuid}}" {{/if}} {{/unless}} draggable="true">
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" />
{{#if item.usable}}
{{#if (or item.system.actionsList.size item.system.actionsList.length item.actionType)}}
{{#if @root.isNPC}}
<img class="roll-img d20" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt="d20">
{{else}}
@ -71,63 +71,66 @@ Parameters:
{{!-- Controls --}}
{{#unless hideControls}}
<div class="controls">
{{!-- Toggle/Equip buttons --}}
{{#if @root.editable}}
{{#if (and (eq actorType 'character') (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" inert></i>
</a>
{{/if}}
{{#if (and (eq actorType 'character') (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-fw fa-shield" inert></i>
</a>
{{/if}}
{{#if (and (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'}}" inert></i>
</a>
{{/if}}
{{#if (and (and (eq type 'effect') (not (eq item.type 'beastform'))))}}
<a data-action="toggleEffect"
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.disabled 'enableEffect' 'disableEffect' }}">
<i class="{{ifThen item.disabled 'fa-solid fa-toggle-off' 'fa-solid fa-toggle-on'}}" inert></i>
</a>
{{/if}}
{{/if}}
{{!-- Send to Chat --}}
{{#if (hasProperty item "toChat")}}
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
<i class="fa-regular fa-fw fa-message" inert></i>
</a>
{{/if}}
{{!-- Document management buttons or context menu --}}
{{#if (and (not isActor) (not hideContextMenu))}}
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
<i class="fa-solid fa-fw fa-ellipsis-vertical" inert></i>
</a>
{{else if @root.editable}}
<a data-action="editDoc" data-tooltip="DAGGERHEART.UI.Tooltip.edit">
<i class="fa-solid fa-edit" inert></i>
</a>
{{#if (not isActor)}}
<a data-action="deleteItem" data-tooltip="DAGGERHEART.UI.Tooltip.deleteItem">
<i class="fa-solid fa-trash" inert></i>
</a>
{{else if (eq type 'adversary')}}
<a data-action='deleteAdversary' data-category="{{categoryAdversary}}" data-tooltip="CONTROLS.CommonDelete">
<i class="fas fa-trash" inert></i>
</a>
{{/if}}
{{/if}}
</div>
{{/unless}}
<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}}
{{#if (eq type 'character')}}
<a data-action='deletePartyMember' data-tooltip="CONTROLS.CommonDelete">
<i class='fas fa-trash'></i>
</a>
{{/if}}
{{else}}
{{#unless (eq actorType 'party')}}
{{#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-fw fa-shield"></i>
</a>
{{/if}}
{{#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 (and (eq type 'effect') (not (eq item.type 'beastform')))}}
<a data-action="toggleEffect"
data-tooltip="DAGGERHEART.UI.Tooltip.{{ifThen item.disabled 'enableEffect' 'disableEffect' }}">
<i class="{{ifThen item.disabled 'fa-solid fa-toggle-off' 'fa-solid fa-toggle-on'}}"></i>
</a>
{{/if}}
{{#if (hasProperty item "toChat")}}
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">
<i class="fa-regular fa-fw fa-message"></i>
</a>
{{/if}}
{{else}}
<a data-action="editDoc" data-tooltip="DAGGERHEART.UI.Tooltip.openActorWorld">
<i class="fa-solid fa-globe"></i>
</a>
<a data-action="deleteItem" data-tooltip="DAGGERHEART.UI.Tooltip.deleteItem">
<i class="fa-solid fa-trash"></i>
</a>
{{/unless}}
{{#unless hideContextMenu}}
<a data-action="triggerContextMenu" data-tooltip="DAGGERHEART.UI.Tooltip.moreOptions">
<i class="fa-solid fa-fw fa-ellipsis-vertical"></i>
</a>
{{/unless}}
{{/if}}
</div>
{{/unless}}
</div>
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}">
{{!-- Description --}}

View file

@ -48,28 +48,26 @@
</a>
{{/if}}
{{else}}
{{#if @root.editable}}
{{#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-fw 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-fw 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 fa-fw {{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="fa-solid fa-fw {{ifThen item.disabled 'fa-toggle-off' 'fa-toggle-on'}}"></i>
</a>
{{/if}}
{{#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-fw 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-fw 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 fa-fw {{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="fa-solid fa-fw {{ifThen item.disabled 'fa-toggle-off' 'fa-toggle-on'}}"></i>
</a>
{{/if}}
{{#if (hasProperty item "toChat")}}
<a data-action="toChat" data-tooltip="DAGGERHEART.UI.Tooltip.sendToChat">

View file

@ -8,6 +8,6 @@
title='DAGGERHEART.GENERAL.Action.plural'
collection=document.system.actions
type='action'
canCreate=@root.editable
canCreate=true
}}
</section>

View file

@ -6,7 +6,7 @@
type='effect'
isGlassy=true
collection=effects.actives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
@ -16,7 +16,7 @@
disabledEffect=true
isGlassy=true
collection=effects.inactives
canCreate=@root.editable
canCreate=true
hideResources=true
}}
</section>

View file

@ -7,7 +7,7 @@
<legend>{{localize tabs.settings.label}}</legend>
<span>{{localize "DAGGERHEART.GENERAL.Tiers.singular"}}</span>
{{formInput systemFields.tier value=source.system.tier}}
<span>{{localize "DAGGERHEART.ITEMS.Weapon.secondaryWeapon.full"}}</span>
<span>{{localize "DAGGERHEART.ITEMS.Weapon.secondaryWeapon"}}</span>
{{formInput systemFields.secondary value=source.system.secondary}}
<span>{{localize "DAGGERHEART.GENERAL.Trait.single"}}</span>
{{formInput systemFields.attack.fields.roll.fields.trait value=document.system.attack.roll.trait name="system.attack.roll.trait" label="DAGGERHEART.GENERAL.Trait.single" localize=true}}

View file

@ -1,12 +1,12 @@
import { compilePack } from '@foundryvtt/foundryvtt-cli';
import readline from 'node:readline/promises';
import { promises as fs } from 'fs';
import systemJSON from '../system.json' with { type: 'json' };
import systemJSON from "../system.json" with { type: "json" };
const MODULE_ID = process.cwd();
const answer = await (async () => {
if (process.argv.includes('--build')) return 'overwrite';
if (process.argv.includes("--build")) return "overwrite";
const rl = readline.createInterface({
input: process.stdin,
@ -42,8 +42,8 @@ async function pullToLDB() {
function transformEntry(entry) {
const stats = {
coreVersion: systemJSON.compatibility.minimum,
systemId: 'daggerheart',
systemVersion: systemJSON.version
systemId: "daggerheart",
systemVersion: systemJSON.version,
};
entry._stats = { ...stats };

View file

@ -23,7 +23,7 @@ for (const pack of packs) {
await extractPack(`${MODULE_ID}/${pack}`, `${MODULE_ID}/src/${pack}`, {
yaml,
transformName,
transformEntry
transformEntry,
});
}
/**
@ -45,12 +45,12 @@ function transformEntry(entry) {
delete entry._stats;
for (const effect of entry.effects ?? []) {
effect._stats = prune(effect._stats);
effect._stats = prune(effect._stats)
}
for (const item of entry.items ?? []) {
item._stats = prune(item._stats);
for (const effect of item.effects ?? []) {
effect._stats = prune(effect._stats);
effect._stats = prune(effect._stats)
}
}
}