mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 21:21:08 +01:00
Temp
This commit is contained in:
parent
2599d1287d
commit
f9c30b583c
4 changed files with 72 additions and 4 deletions
|
|
@ -10,6 +10,7 @@ import DhpChatLog from './module/ui/chatLog.mjs';
|
|||
import DhpPlayers from './module/ui/players.mjs';
|
||||
import DhpRuler from './module/ui/ruler.mjs';
|
||||
import DhpTokenRuler from './module/ui/tokenRuler.mjs';
|
||||
import { dualityRollEnricher } from './module/enrichers/DualityRollEnricher.mjs';
|
||||
|
||||
globalThis.SYSTEM = SYSTEM;
|
||||
|
||||
|
|
@ -21,6 +22,11 @@ Hooks.once('init', () => {
|
|||
documents
|
||||
};
|
||||
|
||||
CONFIG.TextEditor.enrichers.push({
|
||||
pattern: /\[\[\/dr\s?(.*?)\]\]/g,
|
||||
enricher: dualityRollEnricher
|
||||
});
|
||||
|
||||
CONFIG.statusEffects = Object.values(SYSTEM.GENERAL.conditions).map(x => ({
|
||||
...x,
|
||||
name: game.i18n.localize(x.name)
|
||||
|
|
@ -89,7 +95,6 @@ Hooks.once('init', () => {
|
|||
game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent);
|
||||
|
||||
registerDHPSettings();
|
||||
|
||||
RegisterHandlebarsHelpers.registerHelpers();
|
||||
|
||||
return preloadHandlebarsTemplates();
|
||||
|
|
@ -121,6 +126,29 @@ Hooks.on(socketEvent.GMUpdate, async (action, uuid, update) => {
|
|||
}
|
||||
});
|
||||
|
||||
Hooks.on('renderChatMessageHTML', (message, element) => {
|
||||
element.querySelectorAll('.duality-roll-button').forEach(element =>
|
||||
element.addEventListener('click', async event => {
|
||||
const button = event.currentTarget;
|
||||
let target = game.canvas.tokens.controlled.length > 0 ? game.canvas.tokens.controlled[0].actor : null;
|
||||
if (!game.user.isGM) {
|
||||
target = game.user.character;
|
||||
if (!target) {
|
||||
notifications.error('DAGGERHEART.Notification.Error.NoAssignedPlayerCharacter');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
notifications.error('DAGGERHEART.Notification.Error.NoSelectedToken');
|
||||
return;
|
||||
}
|
||||
|
||||
const test = await gmTarget.diceRoll(3);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
const preloadHandlebarsTemplates = async function () {
|
||||
return foundry.applications.handlebars.loadTemplates([
|
||||
'systems/daggerheart/templates/sheets/parts/attributes.hbs',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue