feat: use the selected token as speaker when performing a roll

This commit is contained in:
Johannes Loher 2021-09-19 20:12:01 +02:00
parent 3b2a7857e1
commit 0fa9d838e2
13 changed files with 57 additions and 61 deletions

View file

@ -4,16 +4,16 @@
import { getGame } from "../helpers";
import notifications from "../ui/notifications";
import { getActiveActor } from "./helpers";
import { getActiveActorAndToken } from "./helpers";
/**
* Executes the roll generic check macro.
*/
export async function rollGenericCheck(): Promise<void> {
const actor = getActiveActor();
const { actor, token } = getActiveActorAndToken();
if (!actor) {
return notifications.warn(getGame().i18n.localize("DS4.WarningMustControlActorToUseRollCheckMacro"));
}
return actor.rollGenericCheck().catch((e) => notifications.error(e, { log: true }));
return actor.rollGenericCheck({ speaker: { token } }).catch((e) => notifications.error(e, { log: true }));
}