ds4/src/settings.js

59 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-06-26 22:02:00 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
2022-11-04 21:47:18 +01:00
import { getGame } from "./utils/utils";
2021-07-07 19:22:35 +02:00
export function registerSystemSettings() {
2023-07-10 22:23:13 +02:00
const game = getGame();
2021-07-23 00:43:15 +02:00
2023-07-10 22:23:13 +02:00
/**
* Track the migration version of the latest migration that has been applied.
*/
game.settings.register("ds4", "systemMigrationVersion", {
name: "System Migration Version",
scope: "world",
config: false,
type: Number,
default: -1,
});
2021-03-18 08:52:02 +01:00
2023-07-10 22:23:13 +02:00
game.settings.register("ds4", "useSlayingDiceForAutomatedChecks", {
name: "DS4.SettingUseSlayingDiceForAutomatedChecksName",
hint: "DS4.SettingUseSlayingDiceForAutomatedChecksHint",
scope: "world",
config: true,
type: Boolean,
default: false,
});
2021-05-13 15:41:00 +02:00
2023-07-10 22:23:13 +02:00
game.settings.register("ds4", "showSlayerPoints", {
name: "DS4.SettingShowSlayerPointsName",
hint: "DS4.SettingShowSlayerPointsHint",
scope: "world",
config: true,
type: Boolean,
default: false,
});
2021-05-13 15:41:00 +02:00
}
/**
* @typedef DS4Settings
* @property {number} systemMigrationVersion
* @property {boolean} useSlayingDiceForAutomatedChecks
* @property {boolean} showSlayerPoints
*/
2021-05-13 15:41:00 +02:00
/**
* Get the current values for DS4 settings.
* @returns {DS4Settings}
*/
export function getDS4Settings() {
2023-07-10 22:23:13 +02:00
const game = getGame();
return {
systemMigrationVersion: game.settings.get("ds4", "systemMigrationVersion"),
useSlayingDiceForAutomatedChecks: game.settings.get("ds4", "useSlayingDiceForAutomatedChecks"),
showSlayerPoints: game.settings.get("ds4", "showSlayerPoints"),
};
}