Merge branch 'main' into release

This commit is contained in:
WBHarry 2025-11-11 22:15:30 +01:00
commit 50311679a5
13 changed files with 60 additions and 18 deletions

View file

@ -167,12 +167,14 @@ Hooks.on('setup', () => {
});
Hooks.on('ready', async () => {
const appearanceSettings = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance);
ui.resources = new CONFIG.ui.resources();
if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).displayFear !== 'hide')
ui.resources.render({ force: true });
if (appearanceSettings.displayFear !== 'hide') ui.resources.render({ force: true });
ui.countdowns = new CONFIG.ui.countdowns();
ui.countdowns.render({ force: true });
if (appearanceSettings.displayCountdownUI) {
ui.countdowns = new CONFIG.ui.countdowns();
ui.countdowns.render({ force: true });
}
if (!(ui.compendiumBrowser instanceof applications.ui.ItemBrowser))
ui.compendiumBrowser = new applications.ui.ItemBrowser();

View file

@ -2219,6 +2219,9 @@
"displayFear": {
"label": "Display Fear"
},
"displayCountdownUI": {
"label": "Display Countdown UI"
},
"showGenericStatusEffects": {
"label": "Show Foundry Status Effects"
},
@ -2344,6 +2347,9 @@
},
"Homebrew": {
"newDowntimeMove": "Downtime Move",
"downtimeMove": "Downtime Move",
"armorFeature": "Armor Feature",
"weaponFeature": "Weapon Feaure",
"newFeature": "New ItemFeature",
"downtimeMoves": "Downtime Moves",
"itemFeatures": "Item Features",

View file

@ -89,7 +89,7 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD {
setTimeout(() => token.document.delete(), animationDuration);
}
} else {
const activeScene = game.scenes.find(x => x.active);
const activeScene = game.scenes.find(x => x.id === game.user.viewedScene);
const partyTokenData = [];
for (let member of this.actor.system.partyMembers) {
const data = await member.getTokenDocument();

View file

@ -147,7 +147,14 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
const path = isDowntime ? `restMoves.${type}.moves.${id}` : `itemFeatures.${type}.${id}`;
const featureBase = isDowntime ? this.settings.restMoves[type].moves[id] : this.settings.itemFeatures[type][id];
const configTitle = isDowntime
? game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.downtimeMove')
: type === 'armorFeatures'
? game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.armorFeature')
: game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.weaponFeature');
const editedBase = await game.system.api.applications.sheetConfigs.SettingFeatureConfig.configure(
configTitle,
featureBase,
path,
this.settings,

View file

@ -4,9 +4,10 @@ import DHActionConfig from './action-config.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class SettingFeatureConfig extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(move, movePath, settings, optionalParts, options) {
constructor(configTitle, move, movePath, settings, optionalParts, options) {
super(options);
this.configTitle = configTitle;
this.move = move;
this.movePath = movePath;
@ -19,7 +20,7 @@ export default class SettingFeatureConfig extends HandlebarsApplicationMixin(App
}
get title() {
return game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.downtimeMoves');
return this.configTitle;
}
static DEFAULT_OPTIONS = {
@ -200,9 +201,9 @@ export default class SettingFeatureConfig extends HandlebarsApplicationMixin(App
if (!options.submitted) this.move = null;
}
static async configure(move, movePath, settings, optionalParts, options = {}) {
static async configure(configTitle, move, movePath, settings, optionalParts, options = {}) {
return new Promise(resolve => {
const app = new this(move, movePath, settings, optionalParts, options);
const app = new this(configTitle, move, movePath, settings, optionalParts, options);
app.addEventListener('close', () => resolve(app.move), { once: true });
app.render({ force: true });
});

View file

@ -203,10 +203,10 @@ export default class ClassSheet extends DHBaseItemSheet {
if (target === 'subclasses') {
const subclass = await foundry.utils.fromUuid(uuid);
await subclass.update({ 'system.linkedClass': null });
await subclass?.update({ 'system.linkedClass': null });
}
await this.document.update({ [`system.${target}`]: prop.filter(i => i.uuid !== uuid).map(x => x.uuid) });
await this.document.update({ [`system.${target}`]: prop.filter(i => i && i.uuid !== uuid).map(x => x.uuid) });
}
/**

View file

@ -81,6 +81,13 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
return frame;
}
/**@inheritdoc */
async _onFirstRender(context, options) {
await super._onFirstRender(context, options);
this.toggleCollapsedPosition(undefined, !ui.sidebar.expanded);
}
/** @override */
async _prepareContext(options) {
const context = await super._prepareContext(options);
@ -124,6 +131,8 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
}
toggleCollapsedPosition = async (_, collapsed) => {
if (!this.element) return;
this.sidebarCollapsed = collapsed;
if (!collapsed) this.element.classList.add('expanded');
else this.element.classList.remove('expanded');
@ -188,10 +197,13 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
Hooks.on(socketEvent.Refresh, this.cooldownRefresh.bind());
}
close(options) {
async close(options) {
/* Opt out of Foundry's standard behavior of closing all application windows marked as UI when Escape is pressed */
if (options.closeKey) return;
Hooks.off('collapseSidebar', this.toggleCollapsedPosition);
Hooks.off(socketEvent.Refresh, this.cooldownRefresh);
super.close(options);
return super.close(options);
}
static async updateCountdowns(progressType) {

View file

@ -24,6 +24,7 @@ export default class DhAppearance extends foundry.abstract.DataModel {
choices: CONFIG.DH.GENERAL.fearDisplay,
initial: CONFIG.DH.GENERAL.fearDisplay.token.value
}),
displayCountdownUI: new BooleanField({ initial: true }),
diceSoNice: new SchemaField({
hope: diceStyle({ fg: '#ffffff', bg: '#ffe760', outline: '#000000', edge: '#ffffff' }),
fear: diceStyle({ fg: '#000000', bg: '#0032b1', outline: '#ffffff', edge: '#000000' }),

View file

@ -1,3 +1,5 @@
import { RefreshType, socketEvent } from './socket.mjs';
export async function runMigrations() {
let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion);
if (!lastMigrationVersion) lastMigrationVersion = game.system.version;
@ -158,7 +160,8 @@ export async function runMigrations() {
...countdown,
type: type,
ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => {
acc[key] = countdown.ownership.players[key].type;
acc[key] =
countdown.ownership.players[key].type === 1 ? 2 : countdown.ownership.players[key].type;
return acc;
}, {}),
progress: {
@ -179,6 +182,12 @@ export async function runMigrations() {
});
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, countdownSettings);
game.socket.emit(`system.${CONFIG.DH.id}`, {
action: socketEvent.Refresh,
data: { refreshType: RefreshType.Countdown }
});
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown });
lastMigrationVersion = '1.2.0';
}

View file

@ -18,7 +18,7 @@
box-shadow: none;
width: 300px;
top: 16px;
right: 64px;
right: calc(64px * var(--ui-scale));
transition:
right ease 250ms,
opacity var(--ui-fade-duration) ease,
@ -29,7 +29,7 @@
}
&.expanded {
right: 364px;
right: calc(364px * var(--ui-scale));
}
&.icon-only {

View file

@ -2,7 +2,7 @@
"id": "daggerheart",
"title": "Daggerheart",
"description": "An unofficial implementation of the Daggerheart system",
"version": "1.2.0",
"version": "1.2.1",
"compatibility": {
"minimum": "13",
"verified": "13.350",

View file

@ -8,6 +8,10 @@
value=setting.displayFear
localize=true}}
{{formGroup
fields.displayCountdownUI
value=setting.displayCountdownUI
localize=true}}
{{formGroup
fields.showGenericStatusEffects
value=setting.showGenericStatusEffects
localize=true}}

View file

@ -50,7 +50,7 @@
class='effect-control'
data-action='removeItemFromCollection'
data-target="subclasses"
data-uuid={{subclass.uuid}}
data-uuid="{{subclass.uuid}}"
data-tooltip='{{localize "CONTROLS.CommonDelete"}}'
>
<i class='fas fa-trash'></i>