50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { getGame } from "./helpers";
|
|
|
|
export function registerSystemSettings(): void {
|
|
/**
|
|
* Track the migrations version of the latest migration that has been applied
|
|
*/
|
|
getGame().settings.register("ds4", "systemMigrationVersion", {
|
|
name: "System Migration Version",
|
|
scope: "world",
|
|
config: false,
|
|
type: Number,
|
|
default: -1,
|
|
});
|
|
|
|
getGame().settings.register("ds4", "useSlayingDiceForAutomatedChecks", {
|
|
name: "DS4.SettingUseSlayingDiceForAutomatedChecksName",
|
|
hint: "DS4.SettingUseSlayingDiceForAutomatedChecksHint",
|
|
scope: "world",
|
|
config: true,
|
|
type: Boolean,
|
|
default: false,
|
|
});
|
|
|
|
getGame().settings.register("ds4", "showSlayerPoints", {
|
|
name: "DS4.SettingShowSlayerPointsName",
|
|
hint: "DS4.SettingShowSlayerPointsHint",
|
|
scope: "world",
|
|
config: true,
|
|
type: Boolean,
|
|
default: false,
|
|
});
|
|
}
|
|
|
|
export interface DS4Settings {
|
|
systemMigrationVersion: number;
|
|
useSlayingDiceForAutomatedChecks: boolean;
|
|
showSlayerPoints: boolean;
|
|
}
|
|
|
|
export function getDS4Settings(): DS4Settings {
|
|
return {
|
|
systemMigrationVersion: getGame().settings.get("ds4", "systemMigrationVersion"),
|
|
useSlayingDiceForAutomatedChecks: getGame().settings.get("ds4", "useSlayingDiceForAutomatedChecks"),
|
|
showSlayerPoints: getGame().settings.get("ds4", "showSlayerPoints"),
|
|
};
|
|
}
|