mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Merged with development
This commit is contained in:
commit
2aa252b321
498 changed files with 4489 additions and 2601 deletions
|
|
@ -30,13 +30,13 @@ export const preloadHandlebarsTemplates = async function () {
|
|||
'systems/daggerheart/templates/dialogs/downtime/activities.hbs',
|
||||
'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs',
|
||||
|
||||
|
||||
'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/target-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/button-part.hbs',
|
||||
|
||||
'systems/daggerheart/templates/scene/dh-config.hbs',
|
||||
'systems/daggerheart/templates/ui/itemBrowser/itemContainer.hbs',
|
||||
|
||||
'systems/daggerheart/templates/scene/dh-config.hbs'
|
||||
]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,5 +96,60 @@ export async function runMigrations() {
|
|||
lastMigrationVersion = '1.1.1';
|
||||
}
|
||||
|
||||
if (foundry.utils.isNewerVersion('1.2.0', lastMigrationVersion)) {
|
||||
const lockedPacks = [];
|
||||
const compendiumItems = [];
|
||||
for (let pack of game.packs) {
|
||||
if (pack.locked) {
|
||||
lockedPacks.push(pack.collection);
|
||||
await pack.configure({ locked: false });
|
||||
}
|
||||
const documents = await pack.getDocuments();
|
||||
|
||||
compendiumItems.push(...documents.filter(x => x.system?.metadata?.hasActions));
|
||||
compendiumItems.push(
|
||||
...documents
|
||||
.filter(x => x.items)
|
||||
.flatMap(actor => actor.items.filter(x => x.system?.metadata?.hasActions))
|
||||
);
|
||||
}
|
||||
|
||||
const worldItems = game.items.filter(x => x.system.metadata.hasActions);
|
||||
const worldActorItems = Array.from(game.actors).flatMap(actor =>
|
||||
actor.items.filter(x => x.system.metadata.hasActions)
|
||||
);
|
||||
|
||||
const validCostKeys = Object.keys(CONFIG.DH.GENERAL.abilityCosts);
|
||||
for (let item of [...worldItems, ...worldActorItems, ...compendiumItems]) {
|
||||
for (let action of item.system.actions) {
|
||||
const resourceCostIndexes = Object.keys(action.cost).reduce(
|
||||
(acc, index) => (!validCostKeys.includes(action.cost[index].key) ? [...acc, Number(index)] : acc),
|
||||
[]
|
||||
);
|
||||
if (resourceCostIndexes.length === 0) continue;
|
||||
|
||||
await action.update({
|
||||
cost: action.cost.map((cost, index) => {
|
||||
const { keyIsID, ...rest } = cost;
|
||||
if (!resourceCostIndexes.includes(index)) return { ...rest };
|
||||
|
||||
return {
|
||||
...rest,
|
||||
key: 'resource',
|
||||
itemId: cost.key
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (let packId of lockedPacks) {
|
||||
const pack = game.packs.get(packId);
|
||||
await pack.configure({ locked: true });
|
||||
}
|
||||
|
||||
lastMigrationVersion = '1.2.0';
|
||||
}
|
||||
|
||||
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion, lastMigrationVersion);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const registerMenus = () => {
|
|||
});
|
||||
|
||||
game.settings.registerMenu(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance, {
|
||||
name: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.appearance.title'),
|
||||
name: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.appearance.label'),
|
||||
label: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.appearance.label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.SETTINGS.Menu.appearance.hint'),
|
||||
icon: 'fa-solid fa-palette',
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export const socketEvent = {
|
|||
|
||||
export const GMUpdateEvent = {
|
||||
UpdateDocument: 'DhGMUpdateDocument',
|
||||
UpdateEffect: 'DhGMUpdateEffect',
|
||||
UpdateSetting: 'DhGMUpdateSetting',
|
||||
UpdateFear: 'DhGMUpdateFear',
|
||||
UpdateSaveMessage: 'DhGMUpdateSaveMessage'
|
||||
|
|
@ -37,9 +38,11 @@ export const registerSocketHooks = () => {
|
|||
const document = data.uuid ? await fromUuid(data.uuid) : null;
|
||||
switch (data.action) {
|
||||
case GMUpdateEvent.UpdateDocument:
|
||||
if (document && data.update) {
|
||||
await document.update(data.update);
|
||||
}
|
||||
if (document && data.update) await document.update(data.update);
|
||||
break;
|
||||
case GMUpdateEvent.UpdateEffect:
|
||||
if (document && data.update)
|
||||
await game.system.api.fields.ActionFields.EffectsField.applyEffects.call(document, data.update);
|
||||
break;
|
||||
case GMUpdateEvent.UpdateSetting:
|
||||
await game.settings.set(CONFIG.DH.id, data.uuid, data.update);
|
||||
|
|
@ -78,7 +81,7 @@ export const registerSocketHooks = () => {
|
|||
|
||||
export const registerUserQueries = () => {
|
||||
CONFIG.queries.armorSlot = DamageReductionDialog.armorSlotQuery;
|
||||
CONFIG.queries.reactionRoll = game.system.api.models.actions.actionsTypes.base.rollSaveQuery;
|
||||
CONFIG.queries.reactionRoll = game.system.api.fields.ActionFields.SaveField.rollSaveQuery;
|
||||
};
|
||||
|
||||
export const emitAsGM = async (eventName, callback, update, uuid = null) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue