refacto: Changing click cooldown to daily actions for users and teams
This commit is contained in:
@@ -7,9 +7,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const CONFIG_FILE_PATH =
|
||||
process.env.CONFIG_FILE_PATH ?? path.join(__dirname, "..", "config", "game.settings.json");
|
||||
|
||||
/** @type {{ clickCooldownSeconds: number, databaseWipeoutIntervalSeconds: number, debugModeForTeams: boolean, configReloadIntervalSeconds: number, resourceWorth: object, militaryPower: object }} */
|
||||
/** @type {{ dailyActionQuota: number, databaseWipeoutIntervalSeconds: number, debugModeForTeams: boolean, configReloadIntervalSeconds: number, resourceWorth: object, militaryPower: object }} */
|
||||
let cached = {
|
||||
clickCooldownSeconds: 5,
|
||||
dailyActionQuota: 100,
|
||||
databaseWipeoutIntervalSeconds: 21600,
|
||||
debugModeForTeams: true,
|
||||
configReloadIntervalSeconds: 30,
|
||||
@@ -38,8 +38,8 @@ export function loadConfigFile() {
|
||||
}
|
||||
const raw = fs.readFileSync(CONFIG_FILE_PATH, "utf8");
|
||||
const j = JSON.parse(raw);
|
||||
if (typeof j.clickCooldownSeconds === "number" && j.clickCooldownSeconds >= 0) {
|
||||
cached.clickCooldownSeconds = j.clickCooldownSeconds;
|
||||
if (typeof j.dailyActionQuota === "number" && j.dailyActionQuota >= 1) {
|
||||
cached.dailyActionQuota = Math.floor(j.dailyActionQuota);
|
||||
}
|
||||
if (typeof j.databaseWipeoutIntervalSeconds === "number" && j.databaseWipeoutIntervalSeconds >= 60) {
|
||||
cached.databaseWipeoutIntervalSeconds = j.databaseWipeoutIntervalSeconds;
|
||||
|
||||
Reference in New Issue
Block a user