Skip to content

Commit

Permalink
Merge pull request #289 from Deixx/table-rolls-fix
Browse files Browse the repository at this point in the history
Small fix for random table roll chat messages
  • Loading branch information
moo-man authored Jan 8, 2025
2 parents f0e3115 + 335ea0e commit 2b8caf2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/common/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class WNGChat {
return ui.notifications.error(game.i18n.format("ROLL.CannotFindTable", {name : game.i18n.localize("TABLE.CRITICAL_HIT_TABLE")}))
roll = new Roll(table.formula)
result = await table.roll({ roll })
chatData = { content: result.results[0].text + ` (${result.roll.total})`, flavor: `Critical Hit` }
chatData = { content: result.results[0].getChatText() + ` (${result.roll.total})`, flavor: `Critical Hit` }
}
}
if (test.result.isWrathComplication) {
Expand All @@ -59,7 +59,7 @@ export default class WNGChat {
return ui.notifications.error(game.i18n.format("ROLL.CannotFindTable", {name : game.i18n.localize("TABLE.COMBAT_COMPLICATIONS")}))
roll = new Roll(table.formula)
result = await table.roll({ roll })
chatData = { content: result.results[0].text + ` (${result.roll.total})`, flavor: `Combat Complication` }
chatData = { content: result.results[0].getChatText() + ` (${result.roll.total})`, flavor: `Combat Complication` }
}
else if (test.power) {
table = game.tables.getName(game.i18n.localize("TABLE.PERILS_OF_THE_WARP"))
Expand All @@ -68,15 +68,15 @@ export default class WNGChat {
let modifier = (test.result.allDice.filter(die => die.name == "wrath-complication").length - 1) * 10
roll = new Roll(table.formula + " + " + modifier)
result = await table.roll({ roll })
chatData = { content: result.results[0].text + ` (${result.roll.total})`, flavor: `Perils of the Warp ${modifier ? "(+" + modifier + ")" : ""}` }
chatData = { content: result.results[0].getChatText() + ` (${result.roll.total})`, flavor: `Perils of the Warp ${modifier ? "(+" + modifier + ")" : ""}` }
}
else {
table = game.tables.getName(game.i18n.localize("TABLE.COMPLICATION_CONSEQUENCES"))
if (!table)
return ui.notifications.error(game.i18n.format("ROLL.CannotFindTable", {name : game.i18n.localize("TABLE.COMPLICATION_CONSEQUENCES")}))
roll = new Roll(table.formula)
result = await table.roll({ roll })
chatData = { content: result.results[0].text + ` (${result.roll.total})`, flavor: `Complication Consequence` }
chatData = { content: result.results[0].getChatText() + ` (${result.roll.total})`, flavor: `Complication Consequence` }
}
}
if (chatData.content)
Expand Down

0 comments on commit 2b8caf2

Please sign in to comment.