From 4af4e7e780c242b07bd0f8c9acae6c883cef7533 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 2 Oct 2022 23:00:27 +0100 Subject: [PATCH] Update examples for 3.2.4 --- TypeScript/10ScopesAndTypes/package.json | 20 ++--- .../10ScopesAndTypes/types/ErrorHandler.d.ts | 6 ++ .../10ScopesAndTypes/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../10ScopesAndTypes/types/di/Container.d.ts | 1 + .../10ScopesAndTypes/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../10ScopesAndTypes/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/11BundleLoadingSample/package.json | 20 ++--- .../types/ErrorHandler.d.ts | 6 ++ .../11BundleLoadingSample/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ .../12ClassExtensionOverride/package.json | 20 ++--- .../types/ErrorHandler.d.ts | 6 ++ .../types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/13AddTrader/package.json | 20 ++--- .../13AddTrader/types/ErrorHandler.d.ts | 6 ++ TypeScript/13AddTrader/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../13AddTrader/types/di/Container.d.ts | 1 + .../13AddTrader/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../13AddTrader/types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../13AddTrader/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../13AddTrader/types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../13AddTrader/types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/14AfterDBLoadHook/package.json | 20 ++--- .../14AfterDBLoadHook/types/ErrorHandler.d.ts | 6 ++ .../14AfterDBLoadHook/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../14AfterDBLoadHook/types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../14AfterDBLoadHook/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/15HttpListenerExample/package.json | 17 +++-- .../types/ErrorHandler.d.ts | 6 ++ .../15HttpListenerExample/types/Program.d.ts | 1 + .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 9 ++- .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/generators/LootGenerator.d.ts | 3 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 25 ++++++- .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../services/BotGenerationCacheService.d.ts | 6 +- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- TypeScript/1LogToConsole/package.json | 18 ++--- .../1LogToConsole/types/ErrorHandler.d.ts | 6 ++ TypeScript/1LogToConsole/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../1LogToConsole/types/di/Container.d.ts | 1 + .../1LogToConsole/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../1LogToConsole/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/2EditDatabase/package.json | 20 ++--- .../2EditDatabase/types/ErrorHandler.d.ts | 6 ++ TypeScript/2EditDatabase/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../2EditDatabase/types/di/Container.d.ts | 1 + .../2EditDatabase/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../2EditDatabase/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/3GetSptConfigFile/package.json | 20 ++--- .../3GetSptConfigFile/types/ErrorHandler.d.ts | 6 ++ .../3GetSptConfigFile/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../3GetSptConfigFile/types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../3GetSptConfigFile/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/4UseACustomConfigFile/package.json | 20 ++--- .../types/ErrorHandler.d.ts | 6 ++ .../4UseACustomConfigFile/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/5ReplaceMethod/package.json | 20 ++--- .../5ReplaceMethod/types/ErrorHandler.d.ts | 6 ++ TypeScript/5ReplaceMethod/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../5ReplaceMethod/types/di/Container.d.ts | 1 + .../5ReplaceMethod/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../5ReplaceMethod/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ .../6ReferenceAnotherClass/package.json | 20 ++--- .../types/ErrorHandler.d.ts | 6 ++ .../6ReferenceAnotherClass/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../types/di/Container.d.ts | 1 + .../types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/7OnLoadHook/package.json | 20 ++--- .../7OnLoadHook/types/ErrorHandler.d.ts | 6 ++ TypeScript/7OnLoadHook/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../7OnLoadHook/types/di/Container.d.ts | 1 + .../7OnLoadHook/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../7OnLoadHook/types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../7OnLoadHook/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../7OnLoadHook/types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../7OnLoadHook/types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/8OnUpdateHook/package.json | 20 ++--- .../8OnUpdateHook/types/ErrorHandler.d.ts | 6 ++ TypeScript/8OnUpdateHook/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../8OnUpdateHook/types/di/Container.d.ts | 1 + .../8OnUpdateHook/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../8OnUpdateHook/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ TypeScript/9RouterHooks/package.json | 20 ++--- .../9RouterHooks/types/ErrorHandler.d.ts | 6 ++ TypeScript/9RouterHooks/types/Program.d.ts | 1 + .../types/callbacks/BundleCallbacks.d.ts | 6 +- .../types/callbacks/HttpCallbacks.d.ts | 6 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/RepairCallbacks.d.ts | 14 ++++ .../types/controllers/BotController.d.ts | 15 +++- .../types/controllers/DialogueController.d.ts | 67 +++++++++++++++-- .../types/controllers/GameController.d.ts | 15 +++- .../types/controllers/MatchController.d.ts | 7 ++ .../types/controllers/RagfairController.d.ts | 30 ++++++++ .../types/controllers/RepairController.d.ts | 18 ++--- .../9RouterHooks/types/di/Container.d.ts | 1 + .../9RouterHooks/types/di/Serializer.d.ts | 5 +- .../types/generators/LootGenerator.d.ts | 6 +- .../generators/RagfairOfferGenerator.d.ts | 7 ++ .../9RouterHooks/types/helpers/BotHelper.d.ts | 6 ++ .../types/helpers/DialogueHelper.d.ts | 3 +- .../types/helpers/GameEventHelper.d.ts | 11 ++- .../types/helpers/NotificationSendHelper.d.ts | 6 +- .../types/helpers/RagfairOfferHelper.d.ts | 6 ++ .../types/helpers/RagfairSortHelper.d.ts | 16 +++- .../types/helpers/RepairHelper.d.ts | 15 +++- .../9RouterHooks/types/ide/Compiler.d.ts | 1 - .../types/loaders/PreAkiModLoader.d.ts | 38 ++++++++-- .../types/models/eft/common/IGlobals.d.ts | 1 + .../models/eft/common/tables/IBotBase.d.ts | 3 + .../models/eft/ragfair/IRagfairOffer.d.ts | 1 + .../eft/ragfair/ISearchRequestData.d.ts | 3 +- .../types/models/enums/ConfigTypes.d.ts | 3 +- .../types/models/enums/RagfairSort.d.ts | 7 ++ .../types/models/external/HttpFramework.d.ts | 33 ++++++++ .../models/spt/config/IAirdropConfig.d.ts | 2 + .../types/models/spt/config/IBotConfig.d.ts | 2 +- .../types/models/spt/config/IHttpConfig.d.ts | 1 + .../spt/config/ISeasonalEventConfig.d.ts | 12 +++ .../types/models/spt/server/IHttpServer.d.ts | 12 --- .../models/spt/services/LootRequest.d.ts | 2 + .../types/routers/ImageRouter.d.ts | 7 +- .../routers/serializers/BundleSerializer.d.ts | 9 ++- .../routers/serializers/ImageSerializer.d.ts | 5 +- .../routers/serializers/NotifySerializer.d.ts | 5 +- .../types/servers/DatabaseServer.d.ts | 2 +- .../types/servers/HttpServer.d.ts | 33 ++------ .../types/servers/http/AkiHttpListener.d.ts | 26 +++++++ .../types/servers/http/HttpBufferHandler.d.ts | 6 ++ .../types/servers/http/HttpMethods.d.ts | 8 ++ .../types/servers/http/IHttpListener.d.ts | 6 ++ .../services/BotGenerationCacheService.d.ts | 11 ++- .../types/services/ModCompilerService.d.ts | 14 +--- .../types/services/ProfileFixerService.d.ts | 24 +++++- .../types/services/RepairService.d.ts | 75 +++++++++++++++++++ .../mod/httpListener/HttpListenerMod.d.ts | 10 +++ .../httpListener/HttpListenerModService.d.ts | 8 ++ .../types/utils/HttpFileUtil.d.ts | 8 ++ readme.md | 2 +- 811 files changed, 7924 insertions(+), 1792 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/ide/Compiler.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/ide/Compiler.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/ide/Compiler.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/13AddTrader/types/ErrorHandler.d.ts delete mode 100644 TypeScript/13AddTrader/types/ide/Compiler.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/13AddTrader/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/13AddTrader/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/13AddTrader/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/13AddTrader/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/13AddTrader/types/services/RepairService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/ide/Compiler.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/ide/Compiler.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/1LogToConsole/types/ErrorHandler.d.ts delete mode 100644 TypeScript/1LogToConsole/types/ide/Compiler.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/1LogToConsole/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/1LogToConsole/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/1LogToConsole/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/1LogToConsole/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/1LogToConsole/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/RepairService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/2EditDatabase/types/ErrorHandler.d.ts delete mode 100644 TypeScript/2EditDatabase/types/ide/Compiler.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/2EditDatabase/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/2EditDatabase/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/2EditDatabase/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/2EditDatabase/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/RepairService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/ide/Compiler.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/ide/Compiler.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/ide/Compiler.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/RepairService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/ide/Compiler.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/7OnLoadHook/types/ErrorHandler.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/ide/Compiler.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/7OnLoadHook/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/7OnLoadHook/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/7OnLoadHook/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/RepairService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/ide/Compiler.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/RepairService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts create mode 100644 TypeScript/9RouterHooks/types/ErrorHandler.d.ts delete mode 100644 TypeScript/9RouterHooks/types/ide/Compiler.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/RagfairSort.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts delete mode 100644 TypeScript/9RouterHooks/types/models/spt/server/IHttpServer.d.ts create mode 100644 TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts create mode 100644 TypeScript/9RouterHooks/types/servers/http/HttpBufferHandler.d.ts create mode 100644 TypeScript/9RouterHooks/types/servers/http/HttpMethods.d.ts create mode 100644 TypeScript/9RouterHooks/types/servers/http/IHttpListener.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/RepairService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerMod.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerModService.d.ts create mode 100644 TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts diff --git a/TypeScript/10ScopesAndTypes/package.json b/TypeScript/10ScopesAndTypes/package.json index cf6dc45..8d68ea4 100644 --- a/TypeScript/10ScopesAndTypes/package.json +++ b/TypeScript/10ScopesAndTypes/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts b/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/Program.d.ts b/TypeScript/10ScopesAndTypes/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/10ScopesAndTypes/types/Program.d.ts +++ b/TypeScript/10ScopesAndTypes/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/RepairCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/di/Container.d.ts b/TypeScript/10ScopesAndTypes/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/10ScopesAndTypes/types/di/Container.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/10ScopesAndTypes/types/di/Serializer.d.ts b/TypeScript/10ScopesAndTypes/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/10ScopesAndTypes/types/di/Serializer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/NotificationSendHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/ide/Compiler.d.ts b/TypeScript/10ScopesAndTypes/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/10ScopesAndTypes/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/RagfairSort.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/IHttpServer.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/ImageRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/ImageRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/10ScopesAndTypes/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/10ScopesAndTypes/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/10ScopesAndTypes/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/servers/DatabaseServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/DatabaseServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts b/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/10ScopesAndTypes/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/10ScopesAndTypes/types/servers/http/HttpMethods.d.ts b/TypeScript/10ScopesAndTypes/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/10ScopesAndTypes/types/servers/http/IHttpListener.d.ts b/TypeScript/10ScopesAndTypes/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/11BundleLoadingSample/package.json b/TypeScript/11BundleLoadingSample/package.json index cb06192..93c9e63 100644 --- a/TypeScript/11BundleLoadingSample/package.json +++ b/TypeScript/11BundleLoadingSample/package.json @@ -4,21 +4,21 @@ "author": "Chomp", "license": "MIT", "main": "src/mod.js", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "isBundleMod": true, "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts b/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/Program.d.ts b/TypeScript/11BundleLoadingSample/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/11BundleLoadingSample/types/Program.d.ts +++ b/TypeScript/11BundleLoadingSample/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/RepairCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/di/Container.d.ts b/TypeScript/11BundleLoadingSample/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/11BundleLoadingSample/types/di/Container.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/11BundleLoadingSample/types/di/Serializer.d.ts b/TypeScript/11BundleLoadingSample/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/11BundleLoadingSample/types/di/Serializer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/NotificationSendHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/ide/Compiler.d.ts b/TypeScript/11BundleLoadingSample/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/11BundleLoadingSample/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/RagfairSort.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/IHttpServer.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/ImageRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/ImageRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/11BundleLoadingSample/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/11BundleLoadingSample/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/11BundleLoadingSample/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/servers/DatabaseServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/DatabaseServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts b/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/11BundleLoadingSample/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/11BundleLoadingSample/types/servers/http/HttpMethods.d.ts b/TypeScript/11BundleLoadingSample/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/11BundleLoadingSample/types/servers/http/IHttpListener.d.ts b/TypeScript/11BundleLoadingSample/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/12ClassExtensionOverride/package.json b/TypeScript/12ClassExtensionOverride/package.json index 2b6ff81..8e66fab 100644 --- a/TypeScript/12ClassExtensionOverride/package.json +++ b/TypeScript/12ClassExtensionOverride/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts b/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/Program.d.ts b/TypeScript/12ClassExtensionOverride/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/12ClassExtensionOverride/types/Program.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/RepairCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/di/Container.d.ts b/TypeScript/12ClassExtensionOverride/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/Container.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/12ClassExtensionOverride/types/di/Serializer.d.ts b/TypeScript/12ClassExtensionOverride/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/Serializer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/NotificationSendHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/ide/Compiler.d.ts b/TypeScript/12ClassExtensionOverride/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/12ClassExtensionOverride/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/RagfairSort.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/IHttpServer.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/ImageRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/ImageRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/servers/DatabaseServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/DatabaseServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/12ClassExtensionOverride/types/servers/http/HttpMethods.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/12ClassExtensionOverride/types/servers/http/IHttpListener.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/13AddTrader/package.json b/TypeScript/13AddTrader/package.json index cad6aab..913f742 100644 --- a/TypeScript/13AddTrader/package.json +++ b/TypeScript/13AddTrader/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Shirito", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/13AddTrader/types/ErrorHandler.d.ts b/TypeScript/13AddTrader/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/13AddTrader/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/13AddTrader/types/Program.d.ts b/TypeScript/13AddTrader/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/13AddTrader/types/Program.d.ts +++ b/TypeScript/13AddTrader/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/13AddTrader/types/callbacks/RepairCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/13AddTrader/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/BotController.d.ts b/TypeScript/13AddTrader/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/13AddTrader/types/controllers/BotController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/13AddTrader/types/controllers/RepairController.d.ts b/TypeScript/13AddTrader/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/13AddTrader/types/controllers/RepairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/di/Container.d.ts b/TypeScript/13AddTrader/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/13AddTrader/types/di/Container.d.ts +++ b/TypeScript/13AddTrader/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/13AddTrader/types/di/Serializer.d.ts b/TypeScript/13AddTrader/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/13AddTrader/types/di/Serializer.d.ts +++ b/TypeScript/13AddTrader/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/13AddTrader/types/helpers/NotificationSendHelper.d.ts b/TypeScript/13AddTrader/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/13AddTrader/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/13AddTrader/types/ide/Compiler.d.ts b/TypeScript/13AddTrader/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/13AddTrader/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/13AddTrader/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/13AddTrader/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/13AddTrader/types/models/enums/RagfairSort.d.ts b/TypeScript/13AddTrader/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts b/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/13AddTrader/types/models/spt/server/IHttpServer.d.ts b/TypeScript/13AddTrader/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/13AddTrader/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/13AddTrader/types/routers/ImageRouter.d.ts b/TypeScript/13AddTrader/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/13AddTrader/types/routers/ImageRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/13AddTrader/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/13AddTrader/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/13AddTrader/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/13AddTrader/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/13AddTrader/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/13AddTrader/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/13AddTrader/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/13AddTrader/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/13AddTrader/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/13AddTrader/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/13AddTrader/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/13AddTrader/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/13AddTrader/types/servers/DatabaseServer.d.ts b/TypeScript/13AddTrader/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/13AddTrader/types/servers/DatabaseServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts b/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/13AddTrader/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/13AddTrader/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/13AddTrader/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/13AddTrader/types/servers/http/HttpMethods.d.ts b/TypeScript/13AddTrader/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/13AddTrader/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/13AddTrader/types/servers/http/IHttpListener.d.ts b/TypeScript/13AddTrader/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/13AddTrader/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/13AddTrader/types/services/RepairService.d.ts b/TypeScript/13AddTrader/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/13AddTrader/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts b/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/13AddTrader/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/14AfterDBLoadHook/package.json b/TypeScript/14AfterDBLoadHook/package.json index 2259b8d..ec6d83e 100644 --- a/TypeScript/14AfterDBLoadHook/package.json +++ b/TypeScript/14AfterDBLoadHook/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts b/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/Program.d.ts b/TypeScript/14AfterDBLoadHook/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/14AfterDBLoadHook/types/Program.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/RepairCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/di/Container.d.ts b/TypeScript/14AfterDBLoadHook/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/Container.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/14AfterDBLoadHook/types/di/Serializer.d.ts b/TypeScript/14AfterDBLoadHook/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/Serializer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/NotificationSendHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/ide/Compiler.d.ts b/TypeScript/14AfterDBLoadHook/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/14AfterDBLoadHook/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/RagfairSort.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/IHttpServer.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/ImageRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/ImageRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/servers/DatabaseServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/DatabaseServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/14AfterDBLoadHook/types/servers/http/HttpMethods.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/14AfterDBLoadHook/types/servers/http/IHttpListener.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/15HttpListenerExample/package.json b/TypeScript/15HttpListenerExample/package.json index 79e7769..fd92fc2 100644 --- a/TypeScript/15HttpListenerExample/package.json +++ b/TypeScript/15HttpListenerExample/package.json @@ -13,13 +13,14 @@ "clean:environment": "node -e \"require('fs').rm('mod.zip', ()=>{})\" && node -e \"require('fs').rmdir('./dist/',{recursive:true},()=>{})\"" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", - "copyfiles": "2.4.1", - "eslint": "7.26.0", - "tsyringe": "4.6.0", - "typescript": "4.6.4", - "bestzip": "2.2.1" + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", + "bestzip": "2.2.1", + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } } diff --git a/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts b/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/15HttpListenerExample/types/Program.d.ts b/TypeScript/15HttpListenerExample/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/15HttpListenerExample/types/Program.d.ts +++ b/TypeScript/15HttpListenerExample/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index 2d00898..eec7dc5 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -1,10 +1,13 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -19,11 +22,15 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index bbc1915..66056c2 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -48,11 +48,12 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/15HttpListenerExample/types/ide/Compiler.d.ts b/TypeScript/15HttpListenerExample/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/15HttpListenerExample/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts index 4ab1689..7a687a5 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -56,12 +59,26 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/RagfairSort.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts b/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/15HttpListenerExample/types/servers/http/HttpMethods.d.ts b/TypeScript/15HttpListenerExample/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts index 670c583..ba53fec 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts @@ -35,9 +35,9 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** diff --git a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/1LogToConsole/package.json b/TypeScript/1LogToConsole/package.json index dcfe59b..0b82a48 100644 --- a/TypeScript/1LogToConsole/package.json +++ b/TypeScript/1LogToConsole/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } } diff --git a/TypeScript/1LogToConsole/types/ErrorHandler.d.ts b/TypeScript/1LogToConsole/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/1LogToConsole/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/1LogToConsole/types/Program.d.ts b/TypeScript/1LogToConsole/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/1LogToConsole/types/Program.d.ts +++ b/TypeScript/1LogToConsole/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/1LogToConsole/types/callbacks/RepairCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/1LogToConsole/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/di/Container.d.ts b/TypeScript/1LogToConsole/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/1LogToConsole/types/di/Container.d.ts +++ b/TypeScript/1LogToConsole/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/1LogToConsole/types/di/Serializer.d.ts b/TypeScript/1LogToConsole/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/1LogToConsole/types/di/Serializer.d.ts +++ b/TypeScript/1LogToConsole/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/1LogToConsole/types/helpers/NotificationSendHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/1LogToConsole/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/ide/Compiler.d.ts b/TypeScript/1LogToConsole/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/1LogToConsole/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/1LogToConsole/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/1LogToConsole/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/1LogToConsole/types/models/enums/RagfairSort.d.ts b/TypeScript/1LogToConsole/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/1LogToConsole/types/models/external/HttpFramework.d.ts b/TypeScript/1LogToConsole/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/server/IHttpServer.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/1LogToConsole/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/1LogToConsole/types/routers/ImageRouter.d.ts b/TypeScript/1LogToConsole/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/1LogToConsole/types/routers/ImageRouter.d.ts +++ b/TypeScript/1LogToConsole/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/1LogToConsole/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/1LogToConsole/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/1LogToConsole/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/1LogToConsole/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/1LogToConsole/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/1LogToConsole/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/1LogToConsole/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/1LogToConsole/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/1LogToConsole/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/1LogToConsole/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/servers/DatabaseServer.d.ts b/TypeScript/1LogToConsole/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/1LogToConsole/types/servers/DatabaseServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts b/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/1LogToConsole/types/servers/http/AkiHttpListener.d.ts b/TypeScript/1LogToConsole/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/1LogToConsole/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/1LogToConsole/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/1LogToConsole/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/1LogToConsole/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/1LogToConsole/types/servers/http/HttpMethods.d.ts b/TypeScript/1LogToConsole/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/1LogToConsole/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/1LogToConsole/types/servers/http/IHttpListener.d.ts b/TypeScript/1LogToConsole/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/1LogToConsole/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/1LogToConsole/types/services/RepairService.d.ts b/TypeScript/1LogToConsole/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts b/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/1LogToConsole/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/2EditDatabase/package.json b/TypeScript/2EditDatabase/package.json index da3ea71..f0c0dfe 100644 --- a/TypeScript/2EditDatabase/package.json +++ b/TypeScript/2EditDatabase/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/2EditDatabase/types/ErrorHandler.d.ts b/TypeScript/2EditDatabase/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/2EditDatabase/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/2EditDatabase/types/Program.d.ts b/TypeScript/2EditDatabase/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/2EditDatabase/types/Program.d.ts +++ b/TypeScript/2EditDatabase/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/2EditDatabase/types/callbacks/RepairCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/2EditDatabase/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/di/Container.d.ts b/TypeScript/2EditDatabase/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/2EditDatabase/types/di/Container.d.ts +++ b/TypeScript/2EditDatabase/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/2EditDatabase/types/di/Serializer.d.ts b/TypeScript/2EditDatabase/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/2EditDatabase/types/di/Serializer.d.ts +++ b/TypeScript/2EditDatabase/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/NotificationSendHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/2EditDatabase/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/ide/Compiler.d.ts b/TypeScript/2EditDatabase/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/2EditDatabase/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/2EditDatabase/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/2EditDatabase/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/2EditDatabase/types/models/enums/RagfairSort.d.ts b/TypeScript/2EditDatabase/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts b/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/server/IHttpServer.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/2EditDatabase/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/2EditDatabase/types/routers/ImageRouter.d.ts b/TypeScript/2EditDatabase/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/2EditDatabase/types/routers/ImageRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/2EditDatabase/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/2EditDatabase/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/2EditDatabase/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/2EditDatabase/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/2EditDatabase/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/2EditDatabase/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/2EditDatabase/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/2EditDatabase/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/2EditDatabase/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/2EditDatabase/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/servers/DatabaseServer.d.ts b/TypeScript/2EditDatabase/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/2EditDatabase/types/servers/DatabaseServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts b/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/2EditDatabase/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/2EditDatabase/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/2EditDatabase/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/2EditDatabase/types/servers/http/HttpMethods.d.ts b/TypeScript/2EditDatabase/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/2EditDatabase/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/2EditDatabase/types/servers/http/IHttpListener.d.ts b/TypeScript/2EditDatabase/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/2EditDatabase/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/2EditDatabase/types/services/RepairService.d.ts b/TypeScript/2EditDatabase/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts b/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/2EditDatabase/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/3GetSptConfigFile/package.json b/TypeScript/3GetSptConfigFile/package.json index f037e8f..a3a4ad5 100644 --- a/TypeScript/3GetSptConfigFile/package.json +++ b/TypeScript/3GetSptConfigFile/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts b/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/Program.d.ts b/TypeScript/3GetSptConfigFile/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/3GetSptConfigFile/types/Program.d.ts +++ b/TypeScript/3GetSptConfigFile/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/RepairCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/di/Container.d.ts b/TypeScript/3GetSptConfigFile/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/3GetSptConfigFile/types/di/Container.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/3GetSptConfigFile/types/di/Serializer.d.ts b/TypeScript/3GetSptConfigFile/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/3GetSptConfigFile/types/di/Serializer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/NotificationSendHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/ide/Compiler.d.ts b/TypeScript/3GetSptConfigFile/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/3GetSptConfigFile/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/RagfairSort.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/IHttpServer.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/ImageRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/ImageRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/3GetSptConfigFile/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/3GetSptConfigFile/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/3GetSptConfigFile/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/servers/DatabaseServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/DatabaseServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts b/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/3GetSptConfigFile/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/3GetSptConfigFile/types/servers/http/HttpMethods.d.ts b/TypeScript/3GetSptConfigFile/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/3GetSptConfigFile/types/servers/http/IHttpListener.d.ts b/TypeScript/3GetSptConfigFile/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/4UseACustomConfigFile/package.json b/TypeScript/4UseACustomConfigFile/package.json index ccf504c..f6ca092 100644 --- a/TypeScript/4UseACustomConfigFile/package.json +++ b/TypeScript/4UseACustomConfigFile/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts b/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/Program.d.ts b/TypeScript/4UseACustomConfigFile/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/4UseACustomConfigFile/types/Program.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/RepairCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/di/Container.d.ts b/TypeScript/4UseACustomConfigFile/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/Container.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/4UseACustomConfigFile/types/di/Serializer.d.ts b/TypeScript/4UseACustomConfigFile/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/Serializer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/NotificationSendHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/ide/Compiler.d.ts b/TypeScript/4UseACustomConfigFile/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/4UseACustomConfigFile/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/RagfairSort.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/IHttpServer.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/ImageRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/ImageRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/servers/DatabaseServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/DatabaseServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/4UseACustomConfigFile/types/servers/http/HttpMethods.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/4UseACustomConfigFile/types/servers/http/IHttpListener.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/5ReplaceMethod/package.json b/TypeScript/5ReplaceMethod/package.json index a65e021..fa4e455 100644 --- a/TypeScript/5ReplaceMethod/package.json +++ b/TypeScript/5ReplaceMethod/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts b/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/5ReplaceMethod/types/Program.d.ts b/TypeScript/5ReplaceMethod/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/5ReplaceMethod/types/Program.d.ts +++ b/TypeScript/5ReplaceMethod/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/RepairCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/di/Container.d.ts b/TypeScript/5ReplaceMethod/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/5ReplaceMethod/types/di/Container.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/5ReplaceMethod/types/di/Serializer.d.ts b/TypeScript/5ReplaceMethod/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/5ReplaceMethod/types/di/Serializer.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/NotificationSendHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/ide/Compiler.d.ts b/TypeScript/5ReplaceMethod/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/5ReplaceMethod/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/RagfairSort.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts b/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/IHttpServer.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/5ReplaceMethod/types/routers/ImageRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/5ReplaceMethod/types/routers/ImageRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/5ReplaceMethod/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/5ReplaceMethod/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/5ReplaceMethod/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/5ReplaceMethod/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/5ReplaceMethod/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/5ReplaceMethod/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/5ReplaceMethod/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/servers/DatabaseServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/5ReplaceMethod/types/servers/DatabaseServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts b/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/5ReplaceMethod/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/5ReplaceMethod/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/5ReplaceMethod/types/servers/http/HttpMethods.d.ts b/TypeScript/5ReplaceMethod/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/5ReplaceMethod/types/servers/http/IHttpListener.d.ts b/TypeScript/5ReplaceMethod/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts b/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/package.json b/TypeScript/6ReferenceAnotherClass/package.json index da5e572..f07f1dc 100644 --- a/TypeScript/6ReferenceAnotherClass/package.json +++ b/TypeScript/6ReferenceAnotherClass/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts b/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/Program.d.ts b/TypeScript/6ReferenceAnotherClass/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/6ReferenceAnotherClass/types/Program.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/RepairCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/di/Container.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/Container.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/6ReferenceAnotherClass/types/di/Serializer.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/Serializer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/NotificationSendHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/ide/Compiler.d.ts b/TypeScript/6ReferenceAnotherClass/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/RagfairSort.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IHttpServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/ImageRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/ImageRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/DatabaseServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/DatabaseServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpMethods.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/http/IHttpListener.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/7OnLoadHook/package.json b/TypeScript/7OnLoadHook/package.json index 3e56229..01063fb 100644 --- a/TypeScript/7OnLoadHook/package.json +++ b/TypeScript/7OnLoadHook/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts b/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/7OnLoadHook/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/7OnLoadHook/types/Program.d.ts b/TypeScript/7OnLoadHook/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/7OnLoadHook/types/Program.d.ts +++ b/TypeScript/7OnLoadHook/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/7OnLoadHook/types/callbacks/RepairCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/di/Container.d.ts b/TypeScript/7OnLoadHook/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/7OnLoadHook/types/di/Container.d.ts +++ b/TypeScript/7OnLoadHook/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/7OnLoadHook/types/di/Serializer.d.ts b/TypeScript/7OnLoadHook/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/7OnLoadHook/types/di/Serializer.d.ts +++ b/TypeScript/7OnLoadHook/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/NotificationSendHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/7OnLoadHook/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/ide/Compiler.d.ts b/TypeScript/7OnLoadHook/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/7OnLoadHook/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/RagfairSort.d.ts b/TypeScript/7OnLoadHook/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts b/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/IHttpServer.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/7OnLoadHook/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/7OnLoadHook/types/routers/ImageRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/7OnLoadHook/types/routers/ImageRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/7OnLoadHook/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/7OnLoadHook/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/7OnLoadHook/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/7OnLoadHook/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/7OnLoadHook/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/7OnLoadHook/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/7OnLoadHook/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/servers/DatabaseServer.d.ts b/TypeScript/7OnLoadHook/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/7OnLoadHook/types/servers/DatabaseServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/7OnLoadHook/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/7OnLoadHook/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/7OnLoadHook/types/servers/http/HttpMethods.d.ts b/TypeScript/7OnLoadHook/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/7OnLoadHook/types/servers/http/IHttpListener.d.ts b/TypeScript/7OnLoadHook/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/7OnLoadHook/types/services/RepairService.d.ts b/TypeScript/7OnLoadHook/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/8OnUpdateHook/package.json b/TypeScript/8OnUpdateHook/package.json index 2cb3a35..4e48e4c 100644 --- a/TypeScript/8OnUpdateHook/package.json +++ b/TypeScript/8OnUpdateHook/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts b/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/8OnUpdateHook/types/Program.d.ts b/TypeScript/8OnUpdateHook/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/8OnUpdateHook/types/Program.d.ts +++ b/TypeScript/8OnUpdateHook/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/RepairCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/di/Container.d.ts b/TypeScript/8OnUpdateHook/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/8OnUpdateHook/types/di/Container.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/8OnUpdateHook/types/di/Serializer.d.ts b/TypeScript/8OnUpdateHook/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/8OnUpdateHook/types/di/Serializer.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/NotificationSendHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/ide/Compiler.d.ts b/TypeScript/8OnUpdateHook/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/8OnUpdateHook/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/RagfairSort.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts b/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/IHttpServer.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/8OnUpdateHook/types/routers/ImageRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/8OnUpdateHook/types/routers/ImageRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/8OnUpdateHook/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/8OnUpdateHook/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/8OnUpdateHook/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/8OnUpdateHook/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/8OnUpdateHook/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/8OnUpdateHook/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/8OnUpdateHook/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/servers/DatabaseServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/8OnUpdateHook/types/servers/DatabaseServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/8OnUpdateHook/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/8OnUpdateHook/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/8OnUpdateHook/types/servers/http/HttpMethods.d.ts b/TypeScript/8OnUpdateHook/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/8OnUpdateHook/types/servers/http/IHttpListener.d.ts b/TypeScript/8OnUpdateHook/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts b/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/TypeScript/9RouterHooks/package.json b/TypeScript/9RouterHooks/package.json index 0e2cf2e..f0db9d8 100644 --- a/TypeScript/9RouterHooks/package.json +++ b/TypeScript/9RouterHooks/package.json @@ -4,20 +4,20 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup": "npm i", "build": "node ./packageBuild.ts" }, "devDependencies": { - "@types/node": "^14.15.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@types/node": "16.11.62", + "@typescript-eslint/eslint-plugin": "5.38.1", + "@typescript-eslint/parser": "5.38.1", "bestzip": "2.2.1", - "eslint": "7.26.0", - "fs-extra": "^10.1.0", - "glob": "^8.0.3", - "tsyringe": "4.6.0", - "typescript": "4.6.4" + "eslint": "8.24.0", + "fs-extra": "10.1.0", + "glob": "8.0.3", + "tsyringe": "4.7.0", + "typescript": "4.8.4" } -} +} \ No newline at end of file diff --git a/TypeScript/9RouterHooks/types/ErrorHandler.d.ts b/TypeScript/9RouterHooks/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/TypeScript/9RouterHooks/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/TypeScript/9RouterHooks/types/Program.d.ts b/TypeScript/9RouterHooks/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/TypeScript/9RouterHooks/types/Program.d.ts +++ b/TypeScript/9RouterHooks/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/TypeScript/9RouterHooks/types/callbacks/RepairCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/RepairCallbacks.d.ts index 63733fa..14edeeb 100644 --- a/TypeScript/9RouterHooks/types/callbacks/RepairCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/RepairCallbacks.d.ts @@ -6,6 +6,20 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa export declare class RepairCallbacks { protected repairController: RepairController; constructor(repairController: RepairController); + /** + * use trader to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + /** + * Use repair kit to repair item + * @param pmcData + * @param body + * @param sessionID + * @returns + */ repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts index d6a8ae4..a5111d5 100644 --- a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotHelper } from "../helpers/BotHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; @@ -18,8 +19,9 @@ export declare class BotController { protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; protected configServer: ConfigServer; + protected applicationContext: ApplicationContext; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -36,6 +38,17 @@ export declare class BotController { */ getBotDifficulty(type: string, difficulty: string): Difficulty; protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Generate bot profiles and store in cache + * @param sessionId Session id + * @param info bot generation request info + * @returns IBotBase array + */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the max number of bots allowed on a map + * Looks up location player is entering when getting cap value + * @returns cap number + */ getBotCap(): number; } diff --git a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index d374453..eec7dc5 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -1,27 +1,40 @@ +import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { Config } from "../models/eft/common/IGlobals"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ISeasonalEvent } from "../models/spt/config/ISeasonalEventConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected gameEventHelper: GameEventHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected enableDancingTree(): void; + /** + * Make non-trigger-spawned raiders spawn earlier + always + */ + protected adjustLabsRaiderSpawnRate(): void; protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts index 0e78ef6..ae54a53 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepairController.d.ts @@ -8,9 +8,9 @@ import { ITraderRepairActionDataRequest } from "../models/eft/repair/ITraderRepa import { IRepairConfig } from "../models/spt/config/IRepairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; -import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { PaymentService } from "../services/PaymentService"; +import { RepairService } from "../services/RepairService"; export declare class RepairController { protected logger: ILogger; protected itemEventRouter: ItemEventRouter; @@ -19,23 +19,23 @@ export declare class RepairController { protected traderHelper: TraderHelper; protected paymentService: PaymentService; protected repairHelper: RepairHelper; - protected configServer: ConfigServer; + protected repairService: RepairService; protected repairConfig: IRepairConfig; - constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService); /** * Repair with trader - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; /** * Repair with repair kit - * @param pmcData player profile - * @param body endpoint request data * @param sessionID session id + * @param body endpoint request data + * @param pmcData player profile * @returns item event router action */ - repairWithKit(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse; + repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/di/Container.d.ts b/TypeScript/9RouterHooks/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/TypeScript/9RouterHooks/types/di/Container.d.ts +++ b/TypeScript/9RouterHooks/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/TypeScript/9RouterHooks/types/di/Serializer.d.ts b/TypeScript/9RouterHooks/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/TypeScript/9RouterHooks/types/di/Serializer.d.ts +++ b/TypeScript/9RouterHooks/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index bfc605a..66056c2 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -35,23 +35,25 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param items items to choose from * @param itemTypeCounts item limit counts + * @param options item filters * @param result array to add found item to * @returns true if item was valid and added to pool */ protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, options: LootRequest, result: LootItem[]): boolean; /** * * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts index 7613053..fca87be 100644 --- a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts @@ -1,9 +1,18 @@ +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(databaseServer: DatabaseServer, configServer: ConfigServer); get events(): Record; get christmasEventItems(): string[]; itemIsChristmasRelated(itemId: string): boolean; christmasEventEnabled(): boolean; + /** + * Get the dates each seasonal event starts and ends + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/NotificationSendHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/TypeScript/9RouterHooks/types/helpers/NotificationSendHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts index 9a3ab29..5b09320 100644 --- a/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts @@ -14,8 +14,17 @@ export declare class RepairHelper { protected configServer: ConfigServer; protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); - updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit?: boolean, applyRandomDegradation?: boolean): Item; - protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number): number; - protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, armorMax: number): number; + /** + * + * @param itemToRepair item to update durability details + * @param itemToRepairDetails db details of item to repair + * @param isArmor Is item being repaired a piece of armor + * @param amountToRepair how many unit of durability to repair + * @param useRepairKit Is item being repaired with a repair kit + * @param applyMaxDurabilityDegradation should item have max durability reduced + */ + updateItemDurability(itemToRepair: Item, itemToRepairDetails: ITemplateItem, isArmor: boolean, amountToRepair: number, useRepairKit: boolean, traderQualityMultipler: number, applyMaxDurabilityDegradation?: boolean): void; + protected getRandomisedArmorRepairDegredationValue(armorMaterial: string, isRepairKit: boolean, armorMax: number, traderQualityMultipler: number): number; + protected getRandomisedWeaponRepairDegredationValue(itemProps: Props, isRepairKit: boolean, weaponMax: number, traderQualityMultipler: number): number; isWeaponTemplate(tpl: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/ide/Compiler.d.ts b/TypeScript/9RouterHooks/types/ide/Compiler.d.ts deleted file mode 100644 index fded23a..0000000 --- a/TypeScript/9RouterHooks/types/ide/Compiler.d.ts +++ /dev/null @@ -1 +0,0 @@ -import "reflect-metadata"; diff --git a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts index d310ae2..7a687a5 100644 --- a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -44,9 +47,9 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getDuplicates(stringArray: string[]): string[]; /** - * - * @param mods Get an array of broken/invalid mods by name - * @returns Mod names array + * Get an array of mods with errors that prevent them from working with SPT + * @param mods mods to validate + * @returns Mod names as array */ protected getBrokenMods(mods: string[]): string[]; /** @@ -56,19 +59,38 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; protected addMod(mod: string): Promise; protected areModDependenciesFulfilled(pkg: IPackageJsonData, loadedMods: Record): boolean; protected isModCompatible(mod: IPackageJsonData, loadedMods: Record): boolean; - protected validMod(mod: string): boolean; + /** + * Validate a mod passes a number of checks + * @param modName name of mod in /mods/ to validate + * @returns true if valid + */ + protected validMod(modName: string): boolean; protected getLoadOrderRecursive(mod: string, result: Record, visited: Record): void; protected getLoadOrder(mods: Record): Record; getContainer(): DependencyContainer; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts index 9d28dbc..81e2023 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts @@ -1175,5 +1175,6 @@ export interface Preset { _name: string; _parent: string; _items: Item[]; + /** Default presets have this property */ _encyclopedia?: string; } diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/TypeScript/9RouterHooks/types/models/eft/ragfair/ISearchRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/TypeScript/9RouterHooks/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts index 468ece5..9c48b68 100644 --- a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts @@ -18,5 +18,6 @@ export declare enum ConfigTypes { REPAIR = "aki-repair", SCAVCASE = "aki-scavcase", TRADER = "aki-trader", - WEATHER = "aki-weather" + WEATHER = "aki-weather", + SEASONAL_EVENT = "aki-seasonalevents" } diff --git a/TypeScript/9RouterHooks/types/models/enums/RagfairSort.d.ts b/TypeScript/9RouterHooks/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts b/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts index 8b7fffc..3edcbdd 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts @@ -25,4 +25,6 @@ export interface AirdropLoot { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts index 2d495f9..af8ceba 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts @@ -24,7 +24,7 @@ export interface IBotConfig extends IBaseConfig { /** Show a bots botType value after their name */ showTypeInNickname: boolean; /** Max number of bots that can be spawned in a raid at any one time */ - maxBotCap: number; + maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts new file mode 100644 index 0000000..bc60618 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -0,0 +1,12 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ISeasonalEventConfig extends IBaseConfig { + kind: "aki-seasonalevents"; + events: ISeasonalEvent[]; +} +export interface ISeasonalEvent { + name: string; + startDay: number; + startMonth: number; + endDay: number; + endMonth: number; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/server/IHttpServer.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/IHttpServer.d.ts deleted file mode 100644 index c828399..0000000 --- a/TypeScript/9RouterHooks/types/models/spt/server/IHttpServer.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -/// -import http, { ServerResponse } from "http"; -import { INotification } from "../../eft/notifier/INotifier"; -export interface IHttpServer { - load(): void; - getCookies(req: http.IncomingMessage): any; - sendFile(resp: ServerResponse, file: any): void; - isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - sendMessage(sessionID: string, output: INotification): void; -} diff --git a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts index 64b4e5c..1da8770 100644 --- a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts @@ -6,4 +6,6 @@ export declare class LootRequest { itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; + armorLevelWhitelist: number[]; + moneyStackLimits: Record; } diff --git a/TypeScript/9RouterHooks/types/routers/ImageRouter.d.ts b/TypeScript/9RouterHooks/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/TypeScript/9RouterHooks/types/routers/ImageRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/TypeScript/9RouterHooks/types/routers/serializers/BundleSerializer.d.ts b/TypeScript/9RouterHooks/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/TypeScript/9RouterHooks/types/routers/serializers/BundleSerializer.d.ts +++ b/TypeScript/9RouterHooks/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/routers/serializers/ImageSerializer.d.ts b/TypeScript/9RouterHooks/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/TypeScript/9RouterHooks/types/routers/serializers/ImageSerializer.d.ts +++ b/TypeScript/9RouterHooks/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/routers/serializers/NotifySerializer.d.ts b/TypeScript/9RouterHooks/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/TypeScript/9RouterHooks/types/routers/serializers/NotifySerializer.d.ts +++ b/TypeScript/9RouterHooks/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/servers/DatabaseServer.d.ts b/TypeScript/9RouterHooks/types/servers/DatabaseServer.d.ts index aa152d0..b3d29e9 100644 --- a/TypeScript/9RouterHooks/types/servers/DatabaseServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/DatabaseServer.d.ts @@ -2,5 +2,5 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; export declare class DatabaseServer { protected tableData: IDatabaseTables; getTables(): IDatabaseTables; - setTables(any: any): void; + setTables(tableData: IDatabaseTables): void; } diff --git a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts b/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/TypeScript/9RouterHooks/types/servers/http/HttpBufferHandler.d.ts b/TypeScript/9RouterHooks/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/TypeScript/9RouterHooks/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/TypeScript/9RouterHooks/types/servers/http/HttpMethods.d.ts b/TypeScript/9RouterHooks/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/TypeScript/9RouterHooks/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/TypeScript/9RouterHooks/types/servers/http/IHttpListener.d.ts b/TypeScript/9RouterHooks/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/TypeScript/9RouterHooks/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts index c7dddf5..ba53fec 100644 --- a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts @@ -35,13 +35,18 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** * Remove all cached bot profiles */ clearStoredBots(): void; + /** + * Does cache have bots + * @returns true if empty + */ + cacheIsEmpty(): boolean; } diff --git a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts index 26cb4ac..a4bf3c8 100644 --- a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts @@ -1,20 +1,14 @@ -import * as ts from "typescript"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { VFS } from "../utils/VFS"; +import { CompilerOptions } from "typescript"; +import type { ILogger } from "../models/spt/utils/ILogger"; import { HashCacheService } from "./HashCacheService"; +import { VFS } from "../utils/VFS"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; - protected compile(fileNames: string[], options: ts.CompilerOptions): Promise; - protected buildDepth(depth: number): string; - protected getNodesModulesPath(depth: number): string; - protected getAkiPath(depth: number): string; - protected getAkiFolder(): string; - protected getNodesModulesFolder(): string; - protected calculateDepth(file: string): number; + protected compile(fileNames: string[], options: CompilerOptions): Promise; protected areFilesReady(fileNames: string[]): boolean; protected delay(ms: number): Promise; } diff --git a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/TypeScript/9RouterHooks/types/services/RepairService.d.ts b/TypeScript/9RouterHooks/types/services/RepairService.d.ts new file mode 100644 index 0000000..3e6077c --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/RepairService.d.ts @@ -0,0 +1,75 @@ +import { QuestHelper } from "../helpers/QuestHelper"; +import { RepairHelper } from "../helpers/RepairHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { RepairKitsInfo } from "../models/eft/repair/IRepairActionDataRequest"; +import { RepairItem } from "../models/eft/repair/ITraderRepairActionDataRequest"; +import { IRepairConfig } from "../models/spt/config/IRepairConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ItemEventRouter } from "../routers/ItemEventRouter"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { PaymentService } from "./PaymentService"; +export declare class RepairService { + protected logger: ILogger; + protected itemEventRouter: ItemEventRouter; + protected databaseServer: DatabaseServer; + protected questHelper: QuestHelper; + protected traderHelper: TraderHelper; + protected paymentService: PaymentService; + protected repairHelper: RepairHelper; + protected configServer: ConfigServer; + repairConfig: IRepairConfig; + constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer); + /** + * Use trader to repair an items durability + * @param sessionID Session id + * @param pmcData profile to find item to repair in + * @param repairItemDetails details of the item to repair + * @param traderId Trader being used to repair item + * @returns RepairDetails object + */ + repairItemByTrader(sessionID: string, pmcData: IPmcData, repairItemDetails: RepairItem, traderId: string): RepairDetails; + /** + * + * @param sessionID Session id + * @param pmcData profile to take money from + * @param repairedItemId Repaired item id + * @param repairCost Cost to repair item in roubles + * @param traderId Id of the trader who repaired the item / who is paid + * @param output + */ + payForRepair(sessionID: string, pmcData: IPmcData, repairedItemId: string, repairCost: number, traderId: string, output: IItemEventRouterResponse): void; + /** + * Add skill points to profile after repairing an item + * @param sessionId Session id + * @param repairDetails details of item repaired, cost/item + * @param pmcData Profile to add points to + * @param output IItemEventRouterResponse + */ + addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData, output: IItemEventRouterResponse): void; + /** + * + * @param sessionId Session id + * @param pmcData Profile to update repaired item in + * @param repairKits Array of Repair kits to use + * @param itemToRepairId Item id to repair + * @param output IItemEventRouterResponse + * @returns Details of repair, item/price + */ + repairItemByKit(sessionId: string, pmcData: IPmcData, repairKits: RepairKitsInfo[], itemToRepairId: string, output: IItemEventRouterResponse): RepairDetails; + /** + * Update repair kits Resource object if it doesn't exist + * @param repairKitDetails Repair kit details from db + * @param repairKitInInventory Repair kit to update + */ + protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void; +} +export declare class RepairDetails { + repairCost?: number; + repairedItem: Item; + repairedItemIsArmor: boolean; +} diff --git a/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerMod.d.ts b/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerModService.d.ts b/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts b/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/TypeScript/9RouterHooks/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/readme.md b/readme.md index 49e0829..dff7704 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.2.3 +# Mod examples for 3.2.4 A collection of example mods that perform typical actions in SPT