mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
Merge branch 'development' into feature/death-moves
This commit is contained in:
commit
cec0bb75ae
11 changed files with 42 additions and 24 deletions
|
|
@ -2,7 +2,6 @@ import { SYSTEM } from './module/config/system.mjs';
|
||||||
import * as applications from './module/applications/_module.mjs';
|
import * as applications from './module/applications/_module.mjs';
|
||||||
import * as data from './module/data/_module.mjs';
|
import * as data from './module/data/_module.mjs';
|
||||||
import * as models from './module/data/_module.mjs';
|
import * as models from './module/data/_module.mjs';
|
||||||
import * as canvas from './module/canvas/_module.mjs';
|
|
||||||
import * as documents from './module/documents/_module.mjs';
|
import * as documents from './module/documents/_module.mjs';
|
||||||
import * as dice from './module/dice/_module.mjs';
|
import * as dice from './module/dice/_module.mjs';
|
||||||
import * as fields from './module/data/fields/_module.mjs';
|
import * as fields from './module/data/fields/_module.mjs';
|
||||||
|
|
@ -18,7 +17,7 @@ import {
|
||||||
settingsRegistration,
|
settingsRegistration,
|
||||||
socketRegistration
|
socketRegistration
|
||||||
} from './module/systemRegistration/_module.mjs';
|
} from './module/systemRegistration/_module.mjs';
|
||||||
import { placeables } from './module/canvas/_module.mjs';
|
import { placeables, DhTokenLayer } from './module/canvas/_module.mjs';
|
||||||
import './node_modules/@yaireo/tagify/dist/tagify.css';
|
import './node_modules/@yaireo/tagify/dist/tagify.css';
|
||||||
import TemplateManager from './module/documents/templateManager.mjs';
|
import TemplateManager from './module/documents/templateManager.mjs';
|
||||||
import TokenManager from './module/documents/tokenManager.mjs';
|
import TokenManager from './module/documents/tokenManager.mjs';
|
||||||
|
|
@ -55,7 +54,7 @@ CONFIG.ChatMessage.template = 'systems/daggerheart/templates/ui/chat/chat-messag
|
||||||
|
|
||||||
CONFIG.Canvas.rulerClass = placeables.DhRuler;
|
CONFIG.Canvas.rulerClass = placeables.DhRuler;
|
||||||
CONFIG.Canvas.layers.templates.layerClass = placeables.DhTemplateLayer;
|
CONFIG.Canvas.layers.templates.layerClass = placeables.DhTemplateLayer;
|
||||||
CONFIG.Canvas.layers.tokens.layerClass = canvas.DhTokenLayer;
|
CONFIG.Canvas.layers.tokens.layerClass = DhTokenLayer;
|
||||||
|
|
||||||
CONFIG.MeasuredTemplate.objectClass = placeables.DhMeasuredTemplate;
|
CONFIG.MeasuredTemplate.objectClass = placeables.DhMeasuredTemplate;
|
||||||
|
|
||||||
|
|
@ -392,7 +391,9 @@ const updateAllRangeDependentEffects = async () => {
|
||||||
const effectsAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).effects;
|
const effectsAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).effects;
|
||||||
if (!effectsAutomation.rangeDependent) return;
|
if (!effectsAutomation.rangeDependent) return;
|
||||||
|
|
||||||
const tokens = canvas.scene.tokens;
|
const tokens = canvas.scene?.tokens;
|
||||||
|
if (!tokens) return;
|
||||||
|
|
||||||
if (game.user.character) {
|
if (game.user.character) {
|
||||||
// The character updates their character's token. There can be only one token.
|
// The character updates their character's token. There can be only one token.
|
||||||
const characterToken = tokens.find(x => x.actor === game.user.character);
|
const characterToken = tokens.find(x => x.actor === game.user.character);
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
Hooks.on(socketEvent.Refresh, ({ refreshType }) => {
|
Hooks.on(socketEvent.Refresh, ({ refreshType }) => {
|
||||||
if (refreshType === RefreshType.Scene) {
|
if (refreshType === RefreshType.Scene) this.render();
|
||||||
this.daggerheartFlag = new game.system.api.data.scenes.DHScene(this.document.flags.daggerheart);
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +39,9 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
||||||
|
|
||||||
async _preRender(context, options) {
|
async _preRender(context, options) {
|
||||||
await super._preFirstRender(context, options);
|
await super._preFirstRender(context, options);
|
||||||
this.daggerheartFlag = new game.system.api.data.scenes.DHScene(this.document.flags.daggerheart);
|
|
||||||
|
if (!options.internalRefresh)
|
||||||
|
this.daggerheartFlag = new game.system.api.data.scenes.DHScene(this.document.flags.daggerheart);
|
||||||
}
|
}
|
||||||
|
|
||||||
_attachPartListeners(partId, htmlElement, options) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
|
|
@ -52,7 +51,7 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
||||||
case 'dh':
|
case 'dh':
|
||||||
htmlElement.querySelector('#rangeMeasurementSetting')?.addEventListener('change', async event => {
|
htmlElement.querySelector('#rangeMeasurementSetting')?.addEventListener('change', async event => {
|
||||||
this.daggerheartFlag.updateSource({ rangeMeasurement: { setting: event.target.value } });
|
this.daggerheartFlag.updateSource({ rangeMeasurement: { setting: event.target.value } });
|
||||||
this.render();
|
this.render({ internalRefresh: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
const dragArea = htmlElement.querySelector('.scene-environments');
|
const dragArea = htmlElement.querySelector('.scene-environments');
|
||||||
|
|
@ -69,7 +68,7 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
||||||
await this.daggerheartFlag.updateSource({
|
await this.daggerheartFlag.updateSource({
|
||||||
sceneEnvironments: [...this.daggerheartFlag.sceneEnvironments, data.uuid]
|
sceneEnvironments: [...this.daggerheartFlag.sceneEnvironments, data.uuid]
|
||||||
});
|
});
|
||||||
this.render();
|
this.render({ internalRefresh: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +91,7 @@ export default class DhSceneConfigSettings extends foundry.applications.sheets.S
|
||||||
(_, index) => index !== Number.parseInt(button.dataset.index)
|
(_, index) => index !== Number.parseInt(button.dataset.index)
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
this.render();
|
this.render({ internalRefresh: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
|
|
|
||||||
|
|
@ -505,6 +505,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
const doc = await getDocFromElement(target),
|
const doc = await getDocFromElement(target),
|
||||||
action = doc?.system?.attack ?? doc;
|
action = doc?.system?.attack ?? doc;
|
||||||
const config = action.prepareConfig(event);
|
const config = action.prepareConfig(event);
|
||||||
|
config.effects = Array.from(await this.document.allApplicableEffects());
|
||||||
config.hasRoll = false;
|
config.hasRoll = false;
|
||||||
return action && action.workflow.get('damage').execute(config, null, true);
|
return action && action.workflow.get('damage').execute(config, null, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,14 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
result.flatMap(r => r),
|
result.flatMap(r => r),
|
||||||
'name'
|
'name'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */
|
||||||
|
for (const item of this.items) {
|
||||||
|
item.system.enrichedDescription =
|
||||||
|
(await item.system.getEnrichedDescription?.()) ??
|
||||||
|
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
||||||
|
}
|
||||||
|
|
||||||
this.fieldFilter = this._createFieldFilter();
|
this.fieldFilter = this._createFieldFilter();
|
||||||
|
|
||||||
if (this.presets?.filter) {
|
if (this.presets?.filter) {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default class DhSceneNavigation extends foundry.applications.ui.SceneNavi
|
||||||
const environments = daggerheartInfo.sceneEnvironments.filter(
|
const environments = daggerheartInfo.sceneEnvironments.filter(
|
||||||
x => x && x.testUserPermission(game.user, 'LIMITED')
|
x => x && x.testUserPermission(game.user, 'LIMITED')
|
||||||
);
|
);
|
||||||
const hasEnvironments = environments.length > 0;
|
const hasEnvironments = environments.length > 0 && x.isView;
|
||||||
return {
|
return {
|
||||||
...x,
|
...x,
|
||||||
hasEnvironments,
|
hasEnvironments,
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
||||||
textStyle.wordWrapWidth = this.w * 2.5;
|
textStyle.wordWrapWidth = this.w * 2.5;
|
||||||
textStyle.fontStyle = 'italic';
|
textStyle.fontStyle = 'italic';
|
||||||
|
|
||||||
const helpText = new PreciseText(
|
const helpText = new foundry.canvas.containers.PreciseText(
|
||||||
`(${game.i18n.localize('DAGGERHEART.UI.Tooltip.previewTokenHelp')})`,
|
`(${game.i18n.localize('DAGGERHEART.UI.Tooltip.previewTokenHelp')})`,
|
||||||
textStyle
|
textStyle
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ export default class DHAttackAction extends DHDamageAction {
|
||||||
|
|
||||||
async use(event, options) {
|
async use(event, options) {
|
||||||
const result = await super.use(event, options);
|
const result = await super.use(event, options);
|
||||||
|
if (!result.message) return;
|
||||||
|
|
||||||
if (result.message.system.action.roll?.type === 'attack') {
|
if (result.message.system.action.roll?.type === 'attack') {
|
||||||
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,12 @@ export default class DamageRoll extends DHRoll {
|
||||||
const changeKeys = [];
|
const changeKeys = [];
|
||||||
|
|
||||||
for (const roll of this.options.roll) {
|
for (const roll of this.options.roll) {
|
||||||
for (const damageType of roll.damageTypes) changeKeys.push(`system.bonuses.${type}.${damageType}`);
|
for (const damageType of roll.damageTypes?.values?.() ?? []) {
|
||||||
|
changeKeys.push(`system.bonuses.${type}.${damageType}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const item = this.data.parent.items?.get(this.options.source.item);
|
const item = this.data.parent?.items?.get(this.options.source.item);
|
||||||
if (item) {
|
if (item) {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'weapon':
|
case 'weapon':
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
if (item) {
|
if (item) {
|
||||||
const isAction = item instanceof game.system.api.models.actions.actionsTypes.base;
|
const isAction = item instanceof game.system.api.models.actions.actionsTypes.base;
|
||||||
const isEffect = item instanceof ActiveEffect;
|
const isEffect = item instanceof ActiveEffect;
|
||||||
await this.enrichText(item, isAction || isEffect);
|
await this.enrichText(item);
|
||||||
|
|
||||||
const type = isAction ? 'action' : isEffect ? 'effect' : item.type;
|
const type = isAction ? 'action' : isEffect ? 'effect' : item.type;
|
||||||
html = await foundry.applications.handlebars.renderTemplate(
|
html = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
|
@ -202,10 +202,20 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async enrichText(item, flatStructure) {
|
async enrichText(item) {
|
||||||
const { TextEditor } = foundry.applications.ux;
|
const { TextEditor } = foundry.applications.ux;
|
||||||
|
|
||||||
|
if (item.system?.metadata?.hasDescription) {
|
||||||
|
const enrichedValue =
|
||||||
|
(await item.system?.getEnrichedDescription?.()) ??
|
||||||
|
(await TextEditor.enrichHTML(item.system.description));
|
||||||
|
foundry.utils.setProperty(item, 'system.enrichedDescription', enrichedValue);
|
||||||
|
} else if (item.description) {
|
||||||
|
const enrichedValue = await TextEditor.enrichHTML(item.description);
|
||||||
|
foundry.utils.setProperty(item, 'enrichedDescription', enrichedValue);
|
||||||
|
}
|
||||||
|
|
||||||
const enrichPaths = [
|
const enrichPaths = [
|
||||||
{ path: flatStructure ? '' : 'system', name: 'description' },
|
|
||||||
{ path: 'system', name: 'features' },
|
{ path: 'system', name: 'features' },
|
||||||
{ path: 'system', name: 'actions' },
|
{ path: 'system', name: 'actions' },
|
||||||
{ path: 'system', name: 'customActions' }
|
{ path: 'system', name: 'customActions' }
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,6 @@ export const registerSocketHooks = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Hooks.on(socketEvent.RefreshDocument, async data => {
|
|
||||||
const document = await foundry.utils.fromUuid(data.uuid);
|
|
||||||
document.sheet.render();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const registerUserQueries = () => {
|
export const registerUserQueries = () => {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-desc extensible">
|
<div class="item-desc extensible">
|
||||||
<span class="wrapper">{{{system.description}}}</span>
|
<span class="wrapper">{{{system.enrichedDescription}}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue