Skip to content

Commit

Permalink
Update main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 authored Jun 5, 2022
1 parent 79d053c commit 9156dee
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,22 @@ export default class InitiativeTracker extends Plugin {
.getPlugin("obsidian-dice-roller")
.parseDice(text, "initiative-tracker");
}
async getRoller(str: string) {
getRoller(str: string) {
if (!this.canUseDiceRoller) return;
const roller = await this.app.plugins
const roller = this.app.plugins
.getPlugin("obsidian-dice-roller")
.getRoller(str, "statblock", true);
.getRollerSync(str, "statblock", true);
return roller;
}
get canUseDiceRoller() {
return this.app.plugins.getPlugin("obsidian-dice-roller") != null;
if (this.app.plugins.getPlugin("obsidian-dice-roller") != null) {
if (! this.app.plugins.getPlugin("obsidian-dice-roller").getRollerSync) {
new Notice("Please update Dice Roller to the latest version to use with Initiative Tracker.");
} else {
return true;
}
}
return false;
}

async getInitiativeValue(modifier: number = 0): Promise<number> {
Expand Down

0 comments on commit 9156dee

Please sign in to comment.