-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fate reroll button to chat messages
Add fate reroll button to chat messages, allowing for using fate to open the skill (rerolling any 6's) Hide fate reroll button for all but the owner of the character that performed the roll.
- Loading branch information
Showing
5 changed files
with
110 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Chat message helpers | ||
*/ | ||
import { handleFateReroll } from "./rolls.js"; | ||
|
||
/** | ||
* Binds buttons in chat log to perform actions | ||
* @param html rendered html of the chat long | ||
*/ | ||
export function onChatLogRender(html: JQuery) { | ||
html.on('click', 'button.chat-fate-button', (e) => handleFateReroll(e.target)); | ||
} | ||
|
||
export function hideChatButtonsIfNotOwner(_message: unknown, html: JQuery, data: any) { | ||
const message = html.find("div.chat-message"); | ||
if (message.length > 0) { | ||
const actor = game.actors.get(data.message.speaker.actor); | ||
if (actor && actor.owner) { | ||
return; // we are the owner of the message and shouldn't hide the buttons | ||
} | ||
message.find('div.chat-fate-reroll').each((i, b) => { b.style.display = "none"; }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters