From d9c31f7861dbecd90bb22036853869cf0370616a Mon Sep 17 00:00:00 2001 From: Imper1um Date: Fri, 6 Oct 2023 11:14:27 -0400 Subject: [PATCH] Fixing Double Roll and rollMode Fixes #36 : No longer has a roll from the system displayed for these roll modes. --- src/ceus_RollProvider_pf1.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ceus_RollProvider_pf1.js b/src/ceus_RollProvider_pf1.js index 7299876..063ae86 100644 --- a/src/ceus_RollProvider_pf1.js +++ b/src/ceus_RollProvider_pf1.js @@ -237,6 +237,8 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider { const skillId = skillRoll.skillId; const skill = actor.system.skills[skillRoll.skillId]; const rollOptions = rp.baseRollOptions(); + rollOptions.rollMode = requestOptions.rollPrivacy; + rollOptions.bonus = requestItem.customBonus; var completeRoll; switch (requestItem.trainedOption) { case "HideUntrained": @@ -274,7 +276,10 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider { const rp = Ceus.current.providerEngine.currentRollProvider; const skill = actor.system.skills["per"]; const skillId = "per"; - const completeRoll = await actor.rollSkill(skillId, skill, rp.baseRollOptions()); + const rollOptions = rp.baseRollOptions(); + rollOptions.rollMode = requestOptions.rollPrivacy; + rollOptions.bonus = requestItem.customBonus; + const completeRoll = await actor.rollSkill(skillId, rollOptions); return rp.buildResult(requestOptions, actor, requestItem, completeRoll); } @@ -282,7 +287,10 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider { ceus_RollProvider_pf1.log.Trace("rollSave", {requestOptions, actor, requestItem}); const rp = Ceus.current.providerEngine.currentRollProvider; const saveRoll = rp.getAvailableRolls().find(r => r.id === "Saves").rolls.find(r => r.id === requestItem.rollId); - const completeRoll = await actor.rollSavingThrow(saveRoll.saveId, rp.baseRollOptions()); + const rollOptions = rp.baseRollOptions(); + rollOptions.rollMode = requestOptions.rollPrivacy; + rollOptions.bonus = requestItem.customBonus; + const completeRoll = await actor.rollSavingThrow(saveRoll.saveId, rollOptions); return rp.buildResult(requestOptions, actor, requestItem, completeRoll); } @@ -290,7 +298,10 @@ export class ceus_RollProvider_pf1 extends ceus_RefactorRollProvider { ceus_RollProvider_pf1.log.Trace("rollAbility", {requestOptions, actor, requestItem}); const rp = Ceus.current.providerEngine.currentRollProvider; const abilityRoll = rp.getAvailableRolls().find(r => r.id === "Abilities").rolls.find(r => r.id === requestItem.rollId); - const completeRoll = await actor.rollAbilityTest(abilityRoll.abilityId, rp.baseRollOptions()); + const rollOptions = rp.baseRollOptions(); + rollOptions.rollMode = requestItem.rollPrivacy; + rollOptions.bonus = requestItem.customBonus; + const completeRoll = await actor.rollAbilityTest(abilityRoll.abilityId, rollOptions); return rp.buildResult(requestOptions, actor, requestItem, completeRoll); }