Skip to content

Commit

Permalink
fix(dice_helper): fix for 0.8.x dice helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrycu committed Jul 13, 2021
1 parent 04e15be commit 4cc1c95
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/dice_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function dice_helper() {
html.on("click", ".effg-die-result", async function () {
await dice_helper_clicked(messageData);
});
if (game.user.isGM && app.roll && (messageData.message.content.search('Initiative') === -1 || messageData.message.content.search(game.i18n.localize('ffg-star-wars-enhancements.dice-helper-button-text')) === -1 || messageData.message.content.search(game.i18n.localize('ffg-star-wars-enhancements.dice-helper-message-content-3')) === -1)) {
if (is_roll(app, messageData) === true) {
let skill = messageData['message']['flavor'].replace(game.i18n.localize('SWFFG.Rolling'), '').replace('...', '').replace(' ', ' ').replace(' ', '');
let roll_result = {
'advantage': app.roll.ffg.advantage,
Expand Down Expand Up @@ -77,6 +77,21 @@ export function dice_helper() {
});
}

function is_roll(app, message_data) {
if (game.user.isGM && app.data.roll) {
if (message_data.message.content.search(
'Initiative'
) === -1 || message_data.message.content.search(
game.i18n.localize('ffg-star-wars-enhancements.dice-helper-button-text')
) === -1 || message_data.message.content.search(
game.i18n.localize('ffg-star-wars-enhancements.dice-helper-message-content-3')
) === -1) {
return true;
}
}
return false;
}

async function dice_helper_clicked(object) {
/**
* update the content of the "help me spend results" button based on results of the dice roll
Expand Down

0 comments on commit 4cc1c95

Please sign in to comment.