Merged with v14-Dev

This commit is contained in:
WBHarry 2026-03-27 00:40:22 +01:00
commit 6bf0fffcb7
735 changed files with 9587 additions and 6016 deletions

View file

@ -39,6 +39,7 @@ export const preloadHandlebarsTemplates = async function () {
'systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs',
'systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs',
'systems/daggerheart/templates/dialogs/downtime/activities.hbs',
'systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs',
'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs',
'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs',
'systems/daggerheart/templates/ui/chat/parts/description-part.hbs',
@ -48,6 +49,7 @@ export const preloadHandlebarsTemplates = async function () {
'systems/daggerheart/templates/ui/itemBrowser/itemContainer.hbs',
'systems/daggerheart/templates/scene/dh-config.hbs',
'systems/daggerheart/templates/settings/appearance-settings/diceSoNiceTab.hbs',
'systems/daggerheart/templates/ui/tooltip/parts/beastformData.hbs'
'systems/daggerheart/templates/ui/tooltip/parts/beastformData.hbs',
'systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs'
]);
};

View file

@ -193,11 +193,11 @@ export async function runMigrations() {
}
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
const tagTeam = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
if (!game.actors.some(actor => actor.id === id)) {
acc[`-=${id}`] = null;
acc[id] = _del;
}
return acc;
}, {});
@ -206,7 +206,7 @@ export async function runMigrations() {
initiator: initatorMissing ? null : tagTeam.initiator,
members: missingMembers
});
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll, tagTeam);
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
lastMigrationVersion = '1.2.7';
}
@ -246,6 +246,101 @@ export async function runMigrations() {
lastMigrationVersion = '1.6.0';
}
if (foundry.utils.isNewerVersion('2.0.0', lastMigrationVersion)) {
const progress = game.system.api.applications.ui.DhProgress.createMigrationProgress(0);
const progressBuffer = 50;
//#region Data Setup
const lockedPacks = [];
const itemPacks = game.packs.filter(x => x.metadata.type === 'Item');
const actorPacks = game.packs.filter(x => x.metadata.type === 'Actor');
const getIndexes = async (packs, type) => {
const indexes = [];
for (const pack of packs) {
const indexValues = pack.index.values().reduce((acc, index) => {
if (!type || index.type === type) acc.push(index.uuid);
return acc;
}, []);
if (indexValues.length && pack.locked) {
lockedPacks.push(pack.collection);
await pack.configure({ locked: false });
}
indexes.push(...indexValues);
}
return indexes;
};
const itemEntries = await getIndexes(itemPacks);
const characterEntries = await getIndexes(actorPacks, 'character');
const worldItems = game.items;
const worldCharacters = game.actors.filter(x => x.type === 'character');
/* The async fetches are the mainstay of time. Leaving 1 progress for the sync logic */
const newMax = itemEntries.length + characterEntries.length + progressBuffer;
progress.updateMax(newMax);
const compendiumItems = [];
for (const entry of itemEntries) {
const item = await foundry.utils.fromUuid(entry);
compendiumItems.push(item);
progress.advance();
}
const compendiumCharacters = [];
for (const entry of characterEntries) {
const character = await foundry.utils.fromUuid(entry);
compendiumCharacters.push(character);
progress.advance();
}
//#endregion
/* Migrate existing effects modifying armor, creating new Armor Effects instead */
const migrateEffects = async entity => {
for (const effect of entity.effects) {
if (effect.system.changes.every(x => x.key !== 'system.armorScore')) continue;
effect.update({
'system.changes': effect.system.changes.map(change => ({
...change,
type: change.key === 'system.armorScore' ? 'armor' : change.type,
value: change.key === 'system.armorScore' ? { current: 0, max: change.value } : change.value
}))
});
}
};
/* Migrate existing armors effects */
const migrateItems = async items => {
for (const item of items) {
await migrateEffects(item);
}
};
await migrateItems([...compendiumItems, ...worldItems]);
progress.advance({ by: progressBuffer / 2 });
for (const actor of [...compendiumCharacters, ...worldCharacters]) {
await migrateEffects(actor);
await migrateItems(actor.items);
}
progress.advance({ by: progressBuffer / 2 });
for (let packId of lockedPacks) {
const pack = game.packs.get(packId);
await pack.configure({ locked: true });
}
progress.close();
lastMigrationVersion = '2.0.0';
}
//#endregion
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion, lastMigrationVersion);

View file

@ -15,9 +15,10 @@ import {
DhMetagamingSettings,
DhVariantRuleSettings
} from '../applications/settings/_module.mjs';
import { CompendiumBrowserSettings, DhTagTeamRoll } from '../data/_module.mjs';
import { CompendiumBrowserSettings } from '../data/_module.mjs';
export const registerDHSettings = () => {
registerKeyBindings();
registerMenuSettings();
registerMenus();
registerNonConfigSettings();
@ -33,6 +34,25 @@ export const registerDHSettings = () => {
});
};
export const registerKeyBindings = () => {
game.keybindings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.keybindings.spotlight, {
name: game.i18n.localize('DAGGERHEART.SETTINGS.Keybindings.spotlight.name'),
hint: game.i18n.localize('DAGGERHEART.SETTINGS.Keybindings.spotlight.hint'),
uneditable: [],
editable: [
{
key: 's',
modifiers: []
}
],
onDown: game.system.api.macros.spotlightCombatant,
onUp: () => {},
restricted: true,
reservedModifiers: [],
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL
});
};
const registerMenuSettings = () => {
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules, {
scope: 'world',
@ -157,12 +177,6 @@ const registerNonConfigSettings = () => {
type: DhCountdowns
});
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll, {
scope: 'world',
config: false,
type: DhTagTeamRoll
});
game.settings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.CompendiumBrowserSettings, {
scope: 'world',
config: false,

View file

@ -15,6 +15,9 @@ export function handleSocketEvent({ action = null, data = {} } = {}) {
case socketEvent.DowntimeTrigger:
Party.downtimeMoveQuery(data);
break;
case socketEvent.TagTeamStart:
Hooks.callAll(CONFIG.DH.HOOKS.hooksConfig.tagTeamStart, data);
break;
}
}
@ -22,7 +25,8 @@ export const socketEvent = {
GMUpdate: 'DhGMUpdate',
Refresh: 'DhRefresh',
DhpFearUpdate: 'DhFearUpdate',
DowntimeTrigger: 'DowntimeTrigger'
DowntimeTrigger: 'DowntimeTrigger',
TagTeamStart: 'DhTagTeamStart'
};
export const GMUpdateEvent = {