mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Feature/247 auto add yope fear clear stress (#285)
* cleanup * test * Step 1 * #2 * Fix Effect Action & Add Hope tumation settings to hook * remove circular dependency * Snuck in some localization fixes I noticed * Remove success condition for duality roll gain * Changed config.roll.type logic --------- Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
ee4a5d17a6
commit
52be430eff
21 changed files with 187 additions and 160 deletions
|
|
@ -39,20 +39,16 @@ export const registerSocketHooks = () => {
|
|||
}
|
||||
break;
|
||||
case GMUpdateEvent.UpdateSetting:
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(CONFIG.DH.id, data.uuid, data.update);
|
||||
}
|
||||
await game.settings.set(CONFIG.DH.id, data.uuid, data.update);
|
||||
break;
|
||||
case GMUpdateEvent.UpdateFear:
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.Resources.Fear,
|
||||
Math.max(Math.min(data.update, 6), 0)
|
||||
);
|
||||
Hooks.callAll(socketEvent.DhpFearUpdate);
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.DhpFearUpdate });
|
||||
}
|
||||
await game.settings.set(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.Resources.Fear,
|
||||
Math.max(0, Math.min(game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxFear, data.update))
|
||||
);
|
||||
/* Hooks.callAll(socketEvent.DhpFearUpdate);
|
||||
await game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.DhpFearUpdate }); */
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -66,3 +62,22 @@ export const registerSocketHooks = () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const emitAsGM = async (eventName, callback, args) => {
|
||||
if(!game.user.isGM) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const response = await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: eventName,
|
||||
update: args
|
||||
}
|
||||
});
|
||||
resolve(response);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
} else return callback(args);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue