import { DependencyContainer, Lifecycle } from "tsyringe"; import type { StaticRouterModService } from "../types/services/mod/staticRouter/StaticRouterModService"; import type { IMod } from "../types/models/external/mod"; import type { ILogger } from "../types/models/spt/utils/ILogger"; import { Other } from "./other"; import { Items } from "./items"; import { Raids } from "./raids"; import { Traders } from "./traders"; import { Player } from "./player"; import { Notifications } from "./Notifications"; import { Fixes } from "./fixes"; import { AIOConfigHandler } from "./AIOConfigHandler"; class AIOMod implements IMod { private logger: ILogger; private pkg; public load(container: DependencyContainer): void { container.register("AIOConfigHandler", AIOConfigHandler, {lifecycle:Lifecycle.Singleton}); container.register("AIOOther", Other, {lifecycle:Lifecycle.Singleton}); container.register("AIOFixes", Fixes); container.register("AIORaids", Raids); container.register("AIOItems", Items); container.register("AIOTraders", Traders); container.register("AIOPlayer", Player); container.register("AIONotifications", Notifications); const staticRoute = container.resolve("StaticRouterModService"); container.resolve("WinstonLogger"); if (container.resolve("AIOConfigHandler").getConfig().player.allSkillsMaster) { staticRoute.registerStaticRouter( "AIOModGameVersion", [ { url: "/client/game/version/validate", action: (sessionID: string): any => { return container.resolve("AIOPlayer").maxSkills(sessionID); } } ], "AIOMod" ) } if (container.resolve("AIOConfigHandler").getConfig().other.preWipeEvents.raidersOnAllMaps) { staticRoute.registerStaticRouter( "AIOModBotGen", [ { url: "/client/game/bot/generate", action: (info: any): any => { return container.resolve("AIOOther").spawnRaidersEverywhere(info); } } ], "AIOMod" ) } this.pkg = require("../package.json"); this.logger.info(`Loading: ${this.pkg.name} ${this.pkg.version}`); } public delayedLoad(container: DependencyContainer): void { container.resolve("AIOOther").applyChanges(); container.resolve("AIOFixes").applyChanges(); container.resolve("AIORaids").applyChanges(); container.resolve("AIOItems").applyChanges(); container.resolve("AIOTrader").applyChanges(); container.resolve("AIOPlayer").applyChanges(); if (container.resolve("AIOConfigHandler").getConfig().other.showModLogs) { container.resolve("AIONotifications").sendNotifications() } } } module.exports = { mod: new AIOMod() };