feat: add compatibility with foundry v9

This commit is contained in:
Johannes Loher 2021-12-28 21:38:35 +01:00
parent fc8ae8c132
commit 17adddd48e
2 changed files with 7 additions and 6 deletions

View file

@ -12,7 +12,8 @@ class DefaultCheckOptions implements DS4CheckFactoryOptions {
readonly maximumCoupResult = 1;
readonly minimumFumbleResult = 20;
readonly useSlayingDice = false;
readonly rollMode: foundry.CONST.DiceRollMode = "roll";
// TODO: Use the type `keyof CONFIG.Dice.rollModes` instead as soon as https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues/1501 has been resolved.
readonly rollMode: foundry.CONST.DICE_ROLL_MODES = "publicroll";
readonly flavor: undefined;
mergeWith(other: Partial<DS4CheckFactoryOptions>): DS4CheckFactoryOptions {
@ -188,7 +189,7 @@ function parseDialogFormData(formData: HTMLFormElement): Partial<IntermediateGmM
gmModifier: Number.isSafeInteger(chosenGMModifier) ? chosenGMModifier : undefined,
maximumCoupResult: Number.isSafeInteger(chosenMaximumCoupResult) ? chosenMaximumCoupResult : undefined,
minimumFumbleResult: Number.isSafeInteger(chosenMinimumFumbleResult) ? chosenMinimumFumbleResult : undefined,
rollMode: Object.values(CONST.DICE_ROLL_MODES).includes(chosenRollMode) ? chosenRollMode : undefined,
rollMode: Object.keys(CONFIG.Dice.rollModes).includes(chosenRollMode) ? chosenRollMode : undefined,
};
}
@ -197,7 +198,7 @@ function parseDialogFormData(formData: HTMLFormElement): Partial<IntermediateGmM
*/
interface GmModifierData {
gmModifier: number;
rollMode: foundry.CONST.DiceRollMode;
rollMode: foundry.CONST.DICE_ROLL_MODES;
}
/**
@ -228,7 +229,7 @@ export interface DS4CheckFactoryOptions {
maximumCoupResult: number;
minimumFumbleResult: number;
useSlayingDice: boolean;
rollMode: foundry.CONST.DiceRollMode;
rollMode: foundry.CONST.DICE_ROLL_MODES;
flavor?: string;
flavorData?: Record<string, string | number | null>;
speaker?: ReturnType<typeof ChatMessage.getSpeaker>;

View file

@ -33,8 +33,8 @@
"bugs": "https://git.f3l.de/dungeonslayers/ds4/-/issues",
"changelog": "https://git.f3l.de/dungeonslayers/ds4/-/releases/1.10.1",
"version": "1.10.1",
"minimumCoreVersion": "0.8.9",
"compatibleCoreVersion": "0.8.9",
"minimumCoreVersion": "9.238",
"compatibleCoreVersion": "9.238",
"esmodules": ["module/ds4.js"],
"styles": ["css/ds4.css"],
"languages": [