Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…roller into main
  • Loading branch information
valentine195 committed Sep 11, 2023
2 parents dd2eb18 + 79cef3b commit c3d4072
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
import DiceRollerPlugin from "src/main";
import { StackRoller } from "src/roller";
import { COPY_DEFINITION, ICON_DEFINITION } from "src/utils/constants";
import { ExpectedValue, RollerOptions } from "../types";
import API from "../api/api";

export const VIEW_TYPE = "DICE_ROLLER_VIEW";

Expand Down Expand Up @@ -238,7 +240,11 @@ export default class DiceView extends ItemView {
return;
}
this.rollButton.setDisabled(true);
const roller = await this.plugin.getRoller(formula, "view");
const opts: RollerOptions = {...API.RollerOptions(this.plugin)};
if (opts.expectedValue == ExpectedValue.None) {
opts.expectedValue = ExpectedValue.Roll;
}
const roller = await this.plugin.getRoller(formula, "view", opts);

if (!(roller instanceof StackRoller)) {
new Notice("The Dice View only supports dice rolls.");
Expand Down

0 comments on commit c3d4072

Please sign in to comment.