From 494fd66f5131b55198d7854542f595e207655623 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 6 Jul 2024 13:54:04 +0100 Subject: [PATCH] Renamed `LocationGenerator` to `LocationLootGenerator` --- project/src/controllers/LocationController.ts | 8 ++++---- project/src/di/Container.ts | 4 ++-- ...nGenerator.ts => LocationLootGenerator.ts} | 2 +- .../routers/dynamic/LocationDynamicRouter.ts | 19 ++----------------- 4 files changed, 9 insertions(+), 24 deletions(-) rename project/src/generators/{LocationGenerator.ts => LocationLootGenerator.ts} (99%) diff --git a/project/src/controllers/LocationController.ts b/project/src/controllers/LocationController.ts index f09206e2..588e81a7 100644 --- a/project/src/controllers/LocationController.ts +++ b/project/src/controllers/LocationController.ts @@ -1,7 +1,7 @@ import { inject, injectable } from "tsyringe"; import { ApplicationContext } from "@spt/context/ApplicationContext"; import { ContextVariableType } from "@spt/context/ContextVariableType"; -import { LocationGenerator } from "@spt/generators/LocationGenerator"; +import { LocationLootGenerator } from "@spt/generators/LocationLootGenerator"; import { ILocationBase } from "@spt/models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "@spt/models/eft/common/ILocationsSourceDestinationBase"; import { ILooseLoot, SpawnpointTemplate } from "@spt/models/eft/common/ILooseLoot"; @@ -26,7 +26,7 @@ export class LocationController constructor( @inject("PrimaryLogger") protected logger: ILogger, - @inject("LocationGenerator") protected locationGenerator: LocationGenerator, + @inject("LocationLootGenerator") protected locationLootGenerator: LocationLootGenerator, @inject("LocalisationService") protected localisationService: LocalisationService, @inject("RaidTimeAdjustmentService") protected raidTimeAdjustmentService: RaidTimeAdjustmentService, @inject("DatabaseService") protected databaseService: DatabaseService, @@ -73,12 +73,12 @@ export class LocationController const staticAmmoDist = this.cloner.clone(location.staticAmmo); // Create containers and add loot to them - const staticLoot = this.locationGenerator.generateStaticContainers(locationBaseClone, staticAmmoDist); + const staticLoot = this.locationLootGenerator.generateStaticContainers(locationBaseClone, staticAmmoDist); locationBaseClone.Loot.push(...staticLoot); // Add dynamic loot to output loot const dynamicLootDistClone: ILooseLoot = this.cloner.clone(location.looseLoot); - const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationGenerator.generateDynamicLoot( + const dynamicSpawnPoints: SpawnpointTemplate[] = this.locationLootGenerator.generateDynamicLoot( dynamicLootDistClone, staticAmmoDist, name, diff --git a/project/src/di/Container.ts b/project/src/di/Container.ts index 35823d78..46174bd9 100644 --- a/project/src/di/Container.ts +++ b/project/src/di/Container.ts @@ -68,7 +68,7 @@ import { BotLevelGenerator } from "@spt/generators/BotLevelGenerator"; import { BotLootGenerator } from "@spt/generators/BotLootGenerator"; import { BotWeaponGenerator } from "@spt/generators/BotWeaponGenerator"; import { FenceBaseAssortGenerator } from "@spt/generators/FenceBaseAssortGenerator"; -import { LocationGenerator } from "@spt/generators/LocationGenerator"; +import { LocationLootGenerator } from "@spt/generators/LocationLootGenerator"; import { LootGenerator } from "@spt/generators/LootGenerator"; import { PlayerScavGenerator } from "@spt/generators/PlayerScavGenerator"; import { PMCLootGenerator } from "@spt/generators/PMCLootGenerator"; @@ -537,7 +537,7 @@ export class Container depContainer.register("BotWeaponGenerator", BotWeaponGenerator); depContainer.register("BotLootGenerator", BotLootGenerator); depContainer.register("BotInventoryGenerator", BotInventoryGenerator); - depContainer.register("LocationGenerator", { useClass: LocationGenerator }); + depContainer.register("LocationLootGenerator", { useClass: LocationLootGenerator }); depContainer.register("PMCLootGenerator", PMCLootGenerator, { lifecycle: Lifecycle.Singleton, }); diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationLootGenerator.ts similarity index 99% rename from project/src/generators/LocationGenerator.ts rename to project/src/generators/LocationLootGenerator.ts index 085db492..e9fcac09 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationLootGenerator.ts @@ -44,7 +44,7 @@ export interface IContainerGroupCount } @injectable() -export class LocationGenerator +export class LocationLootGenerator { protected locationConfig: ILocationConfig; diff --git a/project/src/routers/dynamic/LocationDynamicRouter.ts b/project/src/routers/dynamic/LocationDynamicRouter.ts index a4354725..3330070f 100644 --- a/project/src/routers/dynamic/LocationDynamicRouter.ts +++ b/project/src/routers/dynamic/LocationDynamicRouter.ts @@ -1,28 +1,13 @@ import { inject, injectable } from "tsyringe"; import { LocationCallbacks } from "@spt/callbacks/LocationCallbacks"; -import { DynamicRouter, RouteAction } from "@spt/di/Router"; -import { ILocationBase } from "@spt/models/eft/common/ILocationBase"; -import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData"; +import { DynamicRouter } from "@spt/di/Router"; @injectable() export class LocationDynamicRouter extends DynamicRouter { constructor(@inject("LocationCallbacks") protected locationCallbacks: LocationCallbacks) { - super([ - new RouteAction( - "/client/location/getLocalloot", - async ( - url: string, - info: any, - sessionID: string, - _output: string, - ): Promise> => - { - return this.locationCallbacks.getLocation(url, info, sessionID); - }, - ), - ]); + super([]); } public override getTopLevelRoute(): string