Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Replace deprecated Roll with Rolls (#628)
Browse files Browse the repository at this point in the history
Fixes #626
  • Loading branch information
johnnolan authored Oct 21, 2023
1 parent 1411291 commit e4fc1e1
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions scripts/SetupHooksPF2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ export default class SetupHooksPF2e {
return;
}
}
const firstChatRoll = chatMessagePF2e.rolls[0];

if (chatType === "attack-roll" || chatType === "spell-attack-roll") {
const workflow = await PF2e.ParseHook(
chatMessagePF2e.item,
chatMessagePF2e.actor,
CombatDetailType.Attack,
chatMessagePF2e.roll,
firstChatRoll,
);
OnEncounterWorkflowComplete(workflow, ChatType.PF2e);
OnTrackRollStreak(
chatMessagePF2e.roll?.terms[0]?.results?.find(
(f) => f.active === true,
).result ?? 0,
firstChatRoll?.terms[0]?.results?.find((f) => f.active === true)
.result ?? 0,
chatMessagePF2e.token.name,
chatMessagePF2e.actor.id,
chatRollMode,
Expand All @@ -57,22 +57,20 @@ export default class SetupHooksPF2e {
chatMessagePF2e.item,
chatMessagePF2e.item.actor,
CombatDetailType.Damage,
chatMessagePF2e.roll,
firstChatRoll,
);
OnEncounterWorkflowComplete(workflow, ChatType.PF2e);
}
if (chatType === "saving-throw" || chatType.indexOf("-check") > 0) {
OnTrackDiceRoll(
chatMessagePF2e.roll?.terms[0]?.results?.find(
(f) => f.active === true,
).result ?? 0,
firstChatRoll?.terms[0]?.results?.find((f) => f.active === true)
.result ?? 0,
chatMessagePF2e.actor.name,
chatMessagePF2e?.flags?.pf2e?.modifierName,
);
OnTrackRollStreak(
chatMessagePF2e.roll?.terms[0]?.results?.find(
(f) => f.active === true,
).result ?? 0,
firstChatRoll?.terms[0]?.results?.find((f) => f.active === true)
.result ?? 0,
chatMessagePF2e.token.name,
chatMessagePF2e.actor.id,
chatRollMode,
Expand Down

0 comments on commit e4fc1e1

Please sign in to comment.