mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
File Structure Rework (#262)
* Restructured all the files * Moved build/daggerheart.js to ./daggerheart.js. Changed rollup to use the css file instead of the less * Restored build/ folder * Mvoed config out form under application * Moved roll.mjs to module/dice and renamed to dhRolls.mjs * Update module/canvas/placeables/_module.mjs Co-authored-by: joaquinpereyra98 <24190917+joaquinpereyra98@users.noreply.github.com> * Le massive export update * Removed unncessary import --------- Co-authored-by: joaquinpereyra98 <24190917+joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
parent
099a4576da
commit
9d76405221
203 changed files with 1556 additions and 2565 deletions
2
module/helpers/_module.mjs
Normal file
2
module/helpers/_module.mjs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { default as HandlebarsHelper } from './handlebarsHelper.mjs';
|
||||
export * as utils from './utils.mjs';
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
export function handleSocketEvent({ action = null, data = {} } = {}) {
|
||||
switch (action) {
|
||||
case socketEvent.GMUpdate:
|
||||
Hooks.callAll(socketEvent.GMUpdate, data);
|
||||
break;
|
||||
case socketEvent.DhpFearUpdate:
|
||||
Hooks.callAll(socketEvent.DhpFearUpdate);
|
||||
break;
|
||||
case socketEvent.Refresh:
|
||||
Hooks.call(socketEvent.Refresh, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export const socketEvent = {
|
||||
GMUpdate: 'DhGMUpdate',
|
||||
Refresh: 'DhRefresh',
|
||||
DhpFearUpdate: 'DhFearUpdate'
|
||||
};
|
||||
|
||||
export const GMUpdateEvent = {
|
||||
UpdateDocument: 'DhGMUpdateDocument',
|
||||
UpdateSetting: 'DhGMUpdateSetting',
|
||||
UpdateFear: 'DhGMUpdateFear'
|
||||
};
|
||||
|
||||
export const RefreshType = {
|
||||
Countdown: 'DhCoundownRefresh'
|
||||
};
|
||||
|
||||
export const registerSocketHooks = () => {
|
||||
Hooks.on(socketEvent.GMUpdate, async data => {
|
||||
if (game.user.isGM) {
|
||||
const document = data.uuid ? await fromUuid(data.uuid) : null;
|
||||
switch (data.action) {
|
||||
case GMUpdateEvent.UpdateDocument:
|
||||
if (document && data.update) {
|
||||
await document.update(data.update);
|
||||
}
|
||||
break;
|
||||
case GMUpdateEvent.UpdateSetting:
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(SYSTEM.id, data.uuid, data.update);
|
||||
}
|
||||
break;
|
||||
case GMUpdateEvent.UpdateFear:
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(
|
||||
SYSTEM.id,
|
||||
SYSTEM.SETTINGS.gameSettings.Resources.Fear,
|
||||
Math.max(Math.min(data.update, 6), 0)
|
||||
);
|
||||
Hooks.callAll(socketEvent.DhpFearUpdate);
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, { action: socketEvent.DhpFearUpdate });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.refresh) {
|
||||
await game.socket.emit(`system.${SYSTEM.id}`, {
|
||||
action: socketEvent.Refresh,
|
||||
data: data.refresh
|
||||
});
|
||||
Hooks.call(socketEvent.Refresh, data.refresh);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -226,7 +226,7 @@ export const getDeleteKeys = (property, innerProperty, innerPropertyDefaultValue
|
|||
// Fix on Foundry native formula replacement for DH
|
||||
const nativeReplaceFormulaData = Roll.replaceFormulaData;
|
||||
Roll.replaceFormulaData = function (formula, data = {}, { missing, warn = false } = {}) {
|
||||
const terms = Object.keys(SYSTEM.GENERAL.multiplierTypes).map(type => {
|
||||
const terms = Object.keys(CONFIG.DH.GENERAL.multiplierTypes).map(type => {
|
||||
return { term: type, default: 1 };
|
||||
});
|
||||
formula = terms.reduce((a, c) => a.replaceAll(`@${c.term}`, data[c.term] ?? c.default), formula);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue