2024-06-15 02:52:45 +02:00
|
|
|
import fs from "fs";
|
2025-04-01 15:49:08 -07:00
|
|
|
import path from "path";
|
|
|
|
import { repoDir } from "@/src/helpers/pathHelper";
|
2024-05-15 21:55:59 +02:00
|
|
|
|
|
|
|
interface IConfig {
|
|
|
|
mongodbUrl: string;
|
2025-04-05 06:50:57 -07:00
|
|
|
logger: {
|
|
|
|
files: boolean;
|
|
|
|
level: string; // "fatal" | "error" | "warn" | "info" | "http" | "debug" | "trace";
|
|
|
|
};
|
2024-05-15 21:55:59 +02:00
|
|
|
myAddress: string;
|
2024-05-22 23:32:11 +02:00
|
|
|
httpPort?: number;
|
|
|
|
httpsPort?: number;
|
2024-06-18 12:24:58 +02:00
|
|
|
myIrcAddresses?: string[];
|
2025-02-21 08:29:42 +01:00
|
|
|
NRS?: string[];
|
2025-03-23 09:06:08 -07:00
|
|
|
administratorNames?: string[];
|
2024-05-15 21:55:59 +02:00
|
|
|
autoCreateAccount?: boolean;
|
|
|
|
skipTutorial?: boolean;
|
2024-07-03 12:31:35 +02:00
|
|
|
skipAllDialogue?: boolean;
|
2024-05-15 21:55:59 +02:00
|
|
|
unlockAllScans?: boolean;
|
|
|
|
unlockAllMissions?: boolean;
|
2024-12-22 00:34:19 +01:00
|
|
|
infiniteCredits?: boolean;
|
|
|
|
infinitePlatinum?: boolean;
|
2025-01-06 05:36:39 +01:00
|
|
|
infiniteEndo?: boolean;
|
|
|
|
infiniteRegalAya?: boolean;
|
2025-02-22 11:09:17 -08:00
|
|
|
infiniteHelminthMaterials?: boolean;
|
2025-04-26 11:55:45 -07:00
|
|
|
dontSubtractConsumables?: boolean;
|
2024-06-11 12:56:51 +02:00
|
|
|
unlockAllShipFeatures?: boolean;
|
2024-05-15 21:55:59 +02:00
|
|
|
unlockAllShipDecorations?: boolean;
|
|
|
|
unlockAllFlavourItems?: boolean;
|
2024-05-29 22:08:41 +02:00
|
|
|
unlockAllSkins?: boolean;
|
2024-12-29 21:11:36 +01:00
|
|
|
unlockAllCapturaScenes?: boolean;
|
2025-04-11 06:54:07 -07:00
|
|
|
unlockAllDecoRecipes?: boolean;
|
2024-06-22 23:22:38 +02:00
|
|
|
universalPolarityEverywhere?: boolean;
|
2025-01-15 05:20:30 +01:00
|
|
|
unlockDoubleCapacityPotatoesEverywhere?: boolean;
|
|
|
|
unlockExilusEverywhere?: boolean;
|
|
|
|
unlockArcanesEverywhere?: boolean;
|
2025-01-17 07:02:19 +01:00
|
|
|
noDailyStandingLimits?: boolean;
|
2025-04-16 06:30:22 -07:00
|
|
|
noDailyFocusLimit?: boolean;
|
2025-03-15 06:39:54 -07:00
|
|
|
noArgonCrystalDecay?: boolean;
|
2025-04-06 06:04:44 -07:00
|
|
|
noMasteryRankUpCooldown?: boolean;
|
2025-03-13 02:14:53 -07:00
|
|
|
noVendorPurchaseLimits?: boolean;
|
2025-04-17 08:01:59 -07:00
|
|
|
noDeathMarks?: boolean;
|
2025-04-13 05:51:54 -07:00
|
|
|
noKimCooldowns?: boolean;
|
2025-03-03 05:48:46 -08:00
|
|
|
instantResourceExtractorDrones?: boolean;
|
2025-04-14 07:14:15 -07:00
|
|
|
noResourceExtractorDronesDamage?: boolean;
|
2025-04-27 12:38:55 -07:00
|
|
|
skipClanKeyCrafting?: boolean;
|
2025-03-03 12:48:39 -08:00
|
|
|
noDojoRoomBuildStage?: boolean;
|
2025-04-10 07:14:33 -07:00
|
|
|
noDojoDecoBuildStage?: boolean;
|
2025-03-06 07:19:01 -08:00
|
|
|
fastDojoRoomDestruction?: boolean;
|
2025-02-28 12:35:14 -08:00
|
|
|
noDojoResearchCosts?: boolean;
|
|
|
|
noDojoResearchTime?: boolean;
|
2025-03-08 01:44:30 -08:00
|
|
|
fastClanAscension?: boolean;
|
2024-05-28 13:28:35 +02:00
|
|
|
spoofMasteryRank?: number;
|
2025-03-29 15:42:42 -07:00
|
|
|
worldState?: {
|
2025-03-15 03:21:54 -07:00
|
|
|
creditBoost?: boolean;
|
|
|
|
affinityBoost?: boolean;
|
|
|
|
resourceBoost?: boolean;
|
2025-03-08 04:28:05 -08:00
|
|
|
starDays?: boolean;
|
2025-03-29 15:42:42 -07:00
|
|
|
lockTime?: number;
|
2025-03-08 04:28:05 -08:00
|
|
|
};
|
2024-05-15 21:55:59 +02:00
|
|
|
}
|
|
|
|
|
2025-04-05 06:50:57 -07:00
|
|
|
export const configPath = path.join(repoDir, "config.json");
|
2024-05-15 21:55:59 +02:00
|
|
|
|
2025-04-05 06:50:57 -07:00
|
|
|
export const config: IConfig = {
|
|
|
|
mongodbUrl: "mongodb://127.0.0.1:27017/openWF",
|
|
|
|
logger: {
|
|
|
|
files: true,
|
|
|
|
level: "trace"
|
|
|
|
},
|
|
|
|
myAddress: "localhost"
|
2024-06-15 02:52:45 +02:00
|
|
|
};
|
2024-12-29 23:34:26 +01:00
|
|
|
|
2025-04-05 06:50:57 -07:00
|
|
|
export const loadConfig = (): void => {
|
|
|
|
// Set all values to undefined now so if the new config.json omits some fields that were previously present, it's correct in-memory.
|
|
|
|
for (const key of Object.keys(config)) {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
|
|
(config as any)[key] = undefined;
|
2024-12-29 23:34:26 +01:00
|
|
|
}
|
2025-04-05 06:50:57 -07:00
|
|
|
|
|
|
|
Object.assign(config, JSON.parse(fs.readFileSync(configPath, "utf-8")));
|
2024-12-29 23:34:26 +01:00
|
|
|
};
|