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" ;
2025-06-20 18:30:52 -07:00
import { args } from "@/src/helpers/commandLineArguments" ;
2025-07-17 05:04:30 -07:00
import { Inbox } from "@/src/models/inboxModel" ;
2024-05-15 21:55:59 +02:00
2025-06-18 11:05:07 -07:00
export interface IConfig {
2024-05-15 21:55:59 +02:00
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 ;
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-05-09 21:37:28 -07:00
claimingBlueprintRefundsIngredients? : boolean ;
2025-06-19 16:18:35 -07:00
dontSubtractPurchaseCreditCost? : boolean ;
dontSubtractPurchasePlatinumCost? : boolean ;
dontSubtractPurchaseItemCost? : boolean ;
dontSubtractPurchaseStandingCost? : boolean ;
2025-05-10 19:12:42 -07:00
dontSubtractVoidTraces? : 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-06-22 06:55:44 -07:00
fullyStockedVendors? : boolean ;
2025-06-24 11:19:32 -07:00
baroAlwaysAvailable? : boolean ;
baroFullyStocked? : boolean ;
2025-05-20 02:48:45 -07:00
syndicateMissionsRepeatable? : boolean ;
2025-06-20 04:41:13 -07:00
unlockAllProfitTakerStages? : boolean ;
2025-05-18 01:33:16 -07:00
instantFinishRivenChallenge? : 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 ;
2025-06-20 04:42:11 -07:00
missionsCanGiveAllRelics? : boolean ;
2025-07-02 14:17:14 -07:00
exceptionalRelicsAlwaysGiveBronzeReward? : boolean ;
flawlessRelicsAlwaysGiveSilverReward? : boolean ;
radiantRelicsAlwaysGiveGoldReward? : boolean ;
2025-06-23 04:54:54 -07:00
unlockAllSimarisResearchEntries? : boolean ;
2025-06-28 09:47:39 -07:00
disableDailyTribute? : boolean ;
2024-05-28 13:28:35 +02:00
spoofMasteryRank? : number ;
2025-07-01 07:44:13 -07:00
relicRewardItemCountMultiplier? : number ;
2025-06-14 12:58:26 -07:00
nightwaveStandingMultiplier? : number ;
2025-06-23 21:51:48 -07:00
unfaithfulBugFixes ? : {
ignore1999LastRegionPlayed? : boolean ;
fixXtraCheeseTimer? : boolean ;
} ;
2025-03-29 15:42:42 -07:00
worldState ? : {
2025-03-15 03:21:54 -07:00
creditBoost? : boolean ;
affinityBoost? : boolean ;
resourceBoost? : boolean ;
2025-07-30 01:50:43 -07:00
tennoLiveRelay? : boolean ;
2025-06-25 08:04:03 -07:00
galleonOfGhouls? : number ;
2025-07-30 05:44:42 -07:00
starDaysOverride? : boolean ;
2025-06-09 06:54:58 -07:00
eidolonOverride? : string ;
vallisOverride? : string ;
2025-06-19 16:18:17 -07:00
duviriOverride? : string ;
2025-06-07 02:16:19 -07:00
nightwaveOverride? : string ;
2025-06-26 14:32:26 -07:00
allTheFissures? : string ;
2025-06-18 05:51:56 -07:00
circuitGameModes? : string [ ] ;
2025-06-28 09:39:41 -07:00
darvoStockMultiplier? : number ;
2025-07-04 15:18:41 -07:00
varziaOverride? : string ;
varziaFullyStocked? : boolean ;
2025-03-08 04:28:05 -08:00
} ;
2025-06-14 12:58:26 -07:00
dev ? : {
keepVendorsExpired? : boolean ;
} ;
2024-05-15 21:55:59 +02:00
}
2025-06-20 18:30:52 -07:00
export const configPath = path . join ( repoDir , args . configPath ? ? "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 = > {
2025-06-29 11:54:20 -07:00
const newConfig = JSON . parse ( fs . readFileSync ( configPath , "utf-8" ) ) as IConfig ;
2025-04-05 06:50:57 -07:00
// 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 ) ) {
2025-07-23 07:51:51 -07:00
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2025-04-05 06:50:57 -07:00
( config as any ) [ key ] = undefined ;
2024-12-29 23:34:26 +01:00
}
2025-04-05 06:50:57 -07:00
2025-06-29 11:54:20 -07:00
Object . assign ( config , newConfig ) ;
2024-12-29 23:34:26 +01:00
} ;
2025-07-17 05:04:30 -07:00
export const syncConfigWithDatabase = ( ) : void = > {
// Event messages are deleted after endDate. Since we don't use beginDate/endDate and instead have config toggles, we need to delete the messages once those bools are false.
// Also, for some reason, I can't just do `Inbox.deleteMany(...)`; - it needs this whole circus.
if ( ! config . worldState ? . creditBoost ) {
void Inbox . deleteMany ( { globaUpgradeId : "5b23106f283a555109666672" } ) . then ( ( ) = > { } ) ;
}
if ( ! config . worldState ? . affinityBoost ) {
void Inbox . deleteMany ( { globaUpgradeId : "5b23106f283a555109666673" } ) . then ( ( ) = > { } ) ;
}
if ( ! config . worldState ? . resourceBoost ) {
void Inbox . deleteMany ( { globaUpgradeId : "5b23106f283a555109666674" } ) . then ( ( ) = > { } ) ;
}
if ( ! config . worldState ? . galleonOfGhouls ) {
void Inbox . deleteMany ( { goalTag : "GalleonRobbery" } ) . then ( ( ) = > { } ) ;
}
} ;