refacto: Changing actions reset windows + display

This commit is contained in:
gauvainboiche
2026-04-02 15:44:58 +02:00
parent e573ea0d37
commit 3cdb6385a7
9 changed files with 70 additions and 16 deletions
+7
View File
@@ -8,9 +8,12 @@ const CONFIG_FILE_PATH =
process.env.CONFIG_FILE_PATH ?? path.join(__dirname, "..", "config", "game.settings.json");
/** @type {{ dailyActionQuota: number, teamActionQuota: number, databaseWipeoutIntervalSeconds: number, configReloadIntervalSeconds: number, resourceWorth: object, militaryPower: object }} */
const VALID_RESET_HOURS = new Set([1, 2, 3, 4, 6, 8, 12, 24]);
let cached = {
dailyActionQuota: 100,
teamActionQuota: 100,
actionsResetIntervalHours: 12,
databaseWipeoutIntervalSeconds: 21600,
configReloadIntervalSeconds: 30,
elementWorth: {},
@@ -44,6 +47,10 @@ export function loadConfigFile() {
if (typeof j.teamActionQuota === "number" && j.teamActionQuota >= 1) {
cached.teamActionQuota = Math.floor(j.teamActionQuota);
}
if (typeof j.actionsResetIntervalHours === "number") {
const v = Math.floor(j.actionsResetIntervalHours);
if (VALID_RESET_HOURS.has(v)) cached.actionsResetIntervalHours = v;
}
if (typeof j.databaseWipeoutIntervalSeconds === "number" && j.databaseWipeoutIntervalSeconds >= 60) {
cached.databaseWipeoutIntervalSeconds = j.databaseWipeoutIntervalSeconds;
}