152 - Improve Rest Options (#154)

* Fixed up downtime dialogs and data model

* Added homebrew settings without action handling for now

* Added NrChoices to homebrew
This commit is contained in:
WBHarry 2025-06-20 16:36:09 +02:00 committed by GitHub
parent f6e077b290
commit 3464717958
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 799 additions and 123 deletions

View file

@ -1,3 +1,5 @@
import { actionsTypes } from '../data/_module.mjs';
export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLog {
constructor() {
super();
@ -38,6 +40,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
html.querySelectorAll('.ability-use-button').forEach(element =>
element.addEventListener('click', event => this.abilityUseButton.bind(this)(event, data.message))
);
html.querySelectorAll('.action-use-button').forEach(element =>
element.addEventListener('click', event => this.actionUseButton.bind(this)(event, data.message))
);
};
setupHooks() {
@ -137,4 +142,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
const actor = game.actors.get(message.system.origin);
await actor.useAction(action);
};
actionUseButton = async (_, message) => {
const parent = await foundry.utils.fromUuid(message.system.actor);
const testAction = Object.values(message.system.moves)[0].actions[0];
const cls = actionsTypes[testAction.type];
const action = new cls(
{ ...testAction, _id: foundry.utils.randomID(), name: game.i18n.localize(testAction.name) },
{ parent: parent }
);
action.use();
};
}