From 2dc93fda84d13936b9cbcd4dc9d06ae8b1462e1a Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 20 Dec 2022 18:32:21 +0000 Subject: [PATCH] Update types for 3.4.0 --- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../10ScopesAndTypes/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../10ScopesAndTypes/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../10ScopesAndTypes/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../10ScopesAndTypes/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- TypeScript/13AddTrader/types/di/OnLoad.d.ts | 2 +- .../13AddTrader/types/di/OnLoadOnUpdate.d.ts | 4 +- TypeScript/13AddTrader/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../13AddTrader/types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../13AddTrader/types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/13AddTrader/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../13AddTrader/types/utils/JsonUtil.d.ts | 1 + .../13AddTrader/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../13AddTrader/types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../14AfterDBLoadHook/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../14AfterDBLoadHook/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../14AfterDBLoadHook/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../14AfterDBLoadHook/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- TypeScript/2EditDatabase/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../2EditDatabase/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/2EditDatabase/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../2EditDatabase/types/utils/JsonUtil.d.ts | 1 + .../2EditDatabase/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../2EditDatabase/types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../3GetSptConfigFile/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../3GetSptConfigFile/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../3GetSptConfigFile/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../3GetSptConfigFile/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../5ReplaceMethod/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../5ReplaceMethod/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../5ReplaceMethod/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../5ReplaceMethod/types/utils/JsonUtil.d.ts | 1 + .../5ReplaceMethod/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../5ReplaceMethod/types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- .../types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- .../types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../types/utils/JsonUtil.d.ts | 1 + .../types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- TypeScript/7OnLoadHook/types/di/OnLoad.d.ts | 2 +- .../7OnLoadHook/types/di/OnLoadOnUpdate.d.ts | 4 +- TypeScript/7OnLoadHook/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../7OnLoadHook/types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../7OnLoadHook/types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/7OnLoadHook/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../7OnLoadHook/types/utils/JsonUtil.d.ts | 1 + .../7OnLoadHook/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../7OnLoadHook/types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- TypeScript/8OnUpdateHook/types/di/OnLoad.d.ts | 2 +- .../types/di/OnLoadOnUpdate.d.ts | 4 +- .../8OnUpdateHook/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/8OnUpdateHook/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../8OnUpdateHook/types/utils/JsonUtil.d.ts | 1 + .../8OnUpdateHook/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../8OnUpdateHook/types/utils/Watermark.d.ts | 6 +- .../types/callbacks/DataCallbacks.d.ts | 3 +- .../types/callbacks/DialogueCallbacks.d.ts | 5 +- .../types/callbacks/HandbookCallbacks.d.ts | 2 +- .../types/callbacks/HideoutCallbacks.d.ts | 2 +- .../types/callbacks/HttpCallbacks.d.ts | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 2 +- .../types/callbacks/ModCallbacks.d.ts | 6 +- .../types/callbacks/PresetCallbacks.d.ts | 2 +- .../types/callbacks/RagfairCallbacks.d.ts | 8 +- .../types/callbacks/SaveCallbacks.d.ts | 4 +- .../types/callbacks/TraderCallbacks.d.ts | 4 +- .../types/context/ApplicationContext.d.ts | 9 + .../types/context/ContextVariableType.d.ts | 4 +- .../types/controllers/BotController.d.ts | 16 +- .../controllers/CustomizationController.d.ts | 4 +- .../types/controllers/DialogueController.d.ts | 1 + .../types/controllers/GameController.d.ts | 38 ++- .../types/controllers/HealthController.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 6 +- .../types/controllers/MatchController.d.ts | 6 +- .../types/controllers/QuestController.d.ts | 30 ++- .../types/controllers/RagfairController.d.ts | 9 +- .../RepeatableQuestController.d.ts | 17 +- .../types/controllers/TradeController.d.ts | 4 +- .../types/controllers/TraderController.d.ts | 4 +- TypeScript/9RouterHooks/types/di/OnLoad.d.ts | 2 +- .../9RouterHooks/types/di/OnLoadOnUpdate.d.ts | 4 +- .../9RouterHooks/types/di/OnUpdate.d.ts | 2 +- .../generators/BotEquipmentModGenerator.d.ts | 200 ++++++++++++++++ .../types/generators/BotGenerator.d.ts | 74 ++---- .../generators/BotInventoryGenerator.d.ts | 46 +++- .../types/generators/BotLevelGenerator.d.ts | 29 +++ .../types/generators/BotLootGenerator.d.ts | 15 +- .../types/generators/BotWeaponGenerator.d.ts | 10 +- .../types/generators/LocationGenerator.d.ts | 8 +- .../types/generators/LootGenerator.d.ts | 4 +- .../types/generators/PlayerScavGenerator.d.ts | 4 +- .../generators/RagfairOfferGenerator.d.ts | 15 +- .../generators/ScavCaseRewardGenerator.d.ts | 6 - .../types/helpers/AssortHelper.d.ts | 4 +- .../types/helpers/BotGeneratorHelper.d.ts | 216 ++---------------- .../9RouterHooks/types/helpers/BotHelper.d.ts | 28 ++- .../helpers/BotWeaponGeneratorHelper.d.ts | 4 +- .../types/helpers/DialogueHelper.d.ts | 4 +- .../types/helpers/GameEventHelper.d.ts | 22 +- .../types/helpers/HandbookHelper.d.ts | 25 +- .../types/helpers/HealthHelper.d.ts | 3 +- .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 21 +- .../types/helpers/PresetHelper.d.ts | 2 + .../types/helpers/ProfileHelper.d.ts | 9 +- .../types/helpers/QuestHelper.d.ts | 12 +- .../types/helpers/RagfairOfferHelper.d.ts | 4 +- .../types/helpers/RagfairSellHelper.d.ts | 16 +- .../types/helpers/RagfairServerHelper.d.ts | 2 +- .../types/helpers/RepairHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 8 +- .../types/helpers/TraderAssortHelper.d.ts | 6 +- .../types/helpers/TraderHelper.d.ts | 47 ++-- .../types/loaders/PostDBModLoader.d.ts | 2 +- .../types/loaders/PreAkiModLoader.d.ts | 1 + .../eft/bot/IRandomisedBotLevelResult.d.ts | 4 + .../models/eft/common/tables/IBotBase.d.ts | 1 - .../models/eft/common/tables/IBotType.d.ts | 6 +- .../models/eft/common/tables/IQuest.d.ts | 2 +- .../eft/common/tables/IRepeatableQuests.d.ts | 2 +- .../models/eft/common/tables/ITrader.d.ts | 3 +- .../eft/customization/IGetSuitsResponse.d.ts | 2 +- .../types/models/eft/dialog/IChatServer.d.ts | 16 ++ .../dialog/IGetFriendListDataResponse.d.ts | 2 +- .../models/eft/game/IGameConfigResponse.d.ts | 2 + .../eft/hideout/IHideoutProduction.d.ts | 2 +- .../IGetInsuranceCostResponseData.d.ts | 2 +- .../eft/inventory/IAddItemRequestData.d.ts | 7 +- .../IInventoryBaseActionRequestData.d.ts | 2 +- .../eft/itemEvent/IItemEventRouterBase.d.ts | 2 +- .../eft/launcher/IRemoveProfileData.d.ts | 2 +- .../types/models/eft/profile/IAkiProfile.d.ts | 13 ++ .../types/models/enums/BaseClasses.d.ts | 6 +- .../types/models/enums/ExitStatis.d.ts | 7 + .../types/models/external/HttpFramework.d.ts | 2 +- .../models/spt/bots/BotGenerationDetails.d.ts | 18 ++ .../models/spt/callbacks/IDataCallbacks.d.ts | 3 +- .../types/models/spt/config/IBotConfig.d.ts | 19 +- .../models/spt/config/ILocationConfig.d.ts | 8 + .../types/models/spt/config/IPmcConfig.d.ts | 1 + .../types/models/spt/config/IQuestConfig.d.ts | 1 + .../models/spt/config/ITraderConfig.d.ts | 7 +- .../types/models/spt/server/ILocaleBase.d.ts | 48 +--- .../models/spt/server/ISettingsBase.d.ts | 4 + .../types/routers/ItemEventRouter.d.ts | 10 +- .../types/servers/RagfairServer.d.ts | 8 +- .../services/BotEquipmentFilterService.d.ts | 36 ++- .../services/BotEquipmentModPoolService.d.ts | 65 ++++++ .../services/BotGenerationCacheService.d.ts | 16 +- .../types/services/BotLootCacheService.d.ts | 4 +- .../services/BotWeaponModLimitService.d.ts | 54 +++++ .../services/CustomLocationWaveService.d.ts | 42 ++++ .../types/services/FenceService.d.ts | 8 +- .../types/services/InsuranceService.d.ts | 8 +- .../types/services/ItemBaseClassService.d.ts | 39 ++++ .../types/services/LocaleService.d.ts | 5 +- .../types/services/OpenZoneService.d.ts | 28 +++ .../types/services/PaymentService.d.ts | 6 +- .../types/services/RagfairOfferService.d.ts | 14 +- .../types/services/RagfairPriceService.d.ts | 26 ++- .../services/RagfairRequiredItemsService.d.ts | 2 +- .../types/services/SeasonalEventService.d.ts | 72 ++++++ .../TraderPurchasePersisterService.d.ts | 34 +++ .../types/services/mod/onLoad/OnLoadMod.d.ts | 2 +- .../services/mod/onUpdate/OnUpdateMod.d.ts | 2 +- TypeScript/9RouterHooks/types/utils/App.d.ts | 4 +- .../types/utils/DatabaseImporter.d.ts | 15 +- .../9RouterHooks/types/utils/JsonUtil.d.ts | 1 + .../9RouterHooks/types/utils/Logger.d.ts | 6 + .../types/utils/RagfairOfferHolder.d.ts | 24 ++ .../9RouterHooks/types/utils/Watermark.d.ts | 6 +- 1638 files changed, 17556 insertions(+), 7532 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/13AddTrader/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/13AddTrader/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts create mode 100644 TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts create mode 100644 TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/bot/IRandomisedBotLevelResult.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/eft/dialog/IChatServer.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/ExitStatis.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/BotEquipmentModPoolService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/BotWeaponModLimitService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/CustomLocationWaveService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/OpenZoneService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts create mode 100644 TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/PresetCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/SaveCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts b/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts +++ b/TypeScript/10ScopesAndTypes/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts b/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/10ScopesAndTypes/types/di/OnLoad.d.ts b/TypeScript/10ScopesAndTypes/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/10ScopesAndTypes/types/di/OnLoad.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/di/OnLoadOnUpdate.d.ts b/TypeScript/10ScopesAndTypes/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/10ScopesAndTypes/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/di/OnUpdate.d.ts b/TypeScript/10ScopesAndTypes/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/10ScopesAndTypes/types/di/OnUpdate.d.ts +++ b/TypeScript/10ScopesAndTypes/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ExitStatis.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/10ScopesAndTypes/types/services/BotWeaponModLimitService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/CustomLocationWaveService.d.ts b/TypeScript/10ScopesAndTypes/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/10ScopesAndTypes/types/services/OpenZoneService.d.ts b/TypeScript/10ScopesAndTypes/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts b/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/10ScopesAndTypes/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/10ScopesAndTypes/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/10ScopesAndTypes/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/App.d.ts b/TypeScript/10ScopesAndTypes/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/App.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/JsonUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/JsonUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts b/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/PresetCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/SaveCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts b/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts +++ b/TypeScript/11BundleLoadingSample/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts b/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/11BundleLoadingSample/types/di/OnLoad.d.ts b/TypeScript/11BundleLoadingSample/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/11BundleLoadingSample/types/di/OnLoad.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/di/OnLoadOnUpdate.d.ts b/TypeScript/11BundleLoadingSample/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/11BundleLoadingSample/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/di/OnUpdate.d.ts b/TypeScript/11BundleLoadingSample/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/11BundleLoadingSample/types/di/OnUpdate.d.ts +++ b/TypeScript/11BundleLoadingSample/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ExitStatis.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/11BundleLoadingSample/types/services/BotWeaponModLimitService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/CustomLocationWaveService.d.ts b/TypeScript/11BundleLoadingSample/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/11BundleLoadingSample/types/services/OpenZoneService.d.ts b/TypeScript/11BundleLoadingSample/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts b/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/11BundleLoadingSample/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/11BundleLoadingSample/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/11BundleLoadingSample/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/App.d.ts b/TypeScript/11BundleLoadingSample/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/App.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/JsonUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/JsonUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts b/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/PresetCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/SaveCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts b/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts b/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/12ClassExtensionOverride/types/di/OnLoad.d.ts b/TypeScript/12ClassExtensionOverride/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/OnLoad.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/di/OnLoadOnUpdate.d.ts b/TypeScript/12ClassExtensionOverride/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/di/OnUpdate.d.ts b/TypeScript/12ClassExtensionOverride/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/12ClassExtensionOverride/types/di/OnUpdate.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ExitStatis.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotWeaponModLimitService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/CustomLocationWaveService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/12ClassExtensionOverride/types/services/OpenZoneService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/12ClassExtensionOverride/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/12ClassExtensionOverride/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/JsonUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/JsonUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/13AddTrader/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/13AddTrader/types/callbacks/PresetCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/13AddTrader/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/13AddTrader/types/callbacks/SaveCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/13AddTrader/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts b/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts +++ b/TypeScript/13AddTrader/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts b/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts +++ b/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/13AddTrader/types/controllers/BotController.d.ts b/TypeScript/13AddTrader/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/13AddTrader/types/controllers/BotController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/HealthController.d.ts b/TypeScript/13AddTrader/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/13AddTrader/types/controllers/HealthController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/13AddTrader/types/controllers/TradeController.d.ts b/TypeScript/13AddTrader/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/13AddTrader/types/controllers/TradeController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/13AddTrader/types/di/OnLoad.d.ts b/TypeScript/13AddTrader/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/13AddTrader/types/di/OnLoad.d.ts +++ b/TypeScript/13AddTrader/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/di/OnLoadOnUpdate.d.ts b/TypeScript/13AddTrader/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/13AddTrader/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/13AddTrader/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/di/OnUpdate.d.ts b/TypeScript/13AddTrader/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/13AddTrader/types/di/OnUpdate.d.ts +++ b/TypeScript/13AddTrader/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/13AddTrader/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts b/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts b/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/13AddTrader/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/13AddTrader/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/13AddTrader/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/13AddTrader/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/13AddTrader/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/13AddTrader/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/13AddTrader/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/13AddTrader/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/13AddTrader/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/13AddTrader/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/13AddTrader/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/13AddTrader/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/13AddTrader/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/13AddTrader/types/models/enums/ExitStatis.d.ts b/TypeScript/13AddTrader/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts b/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts +++ b/TypeScript/13AddTrader/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/13AddTrader/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/13AddTrader/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/13AddTrader/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/13AddTrader/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/13AddTrader/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/13AddTrader/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts b/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/13AddTrader/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/13AddTrader/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/13AddTrader/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/13AddTrader/types/services/BotWeaponModLimitService.d.ts b/TypeScript/13AddTrader/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/13AddTrader/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/13AddTrader/types/services/CustomLocationWaveService.d.ts b/TypeScript/13AddTrader/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/13AddTrader/types/services/InsuranceService.d.ts +++ b/TypeScript/13AddTrader/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts b/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/13AddTrader/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/13AddTrader/types/services/LocaleService.d.ts b/TypeScript/13AddTrader/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/13AddTrader/types/services/LocaleService.d.ts +++ b/TypeScript/13AddTrader/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/13AddTrader/types/services/OpenZoneService.d.ts b/TypeScript/13AddTrader/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/13AddTrader/types/services/PaymentService.d.ts b/TypeScript/13AddTrader/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/13AddTrader/types/services/PaymentService.d.ts +++ b/TypeScript/13AddTrader/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts b/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/13AddTrader/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/13AddTrader/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/13AddTrader/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/13AddTrader/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/13AddTrader/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/13AddTrader/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/13AddTrader/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/13AddTrader/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/13AddTrader/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/13AddTrader/types/utils/App.d.ts b/TypeScript/13AddTrader/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/13AddTrader/types/utils/App.d.ts +++ b/TypeScript/13AddTrader/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/13AddTrader/types/utils/JsonUtil.d.ts b/TypeScript/13AddTrader/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/13AddTrader/types/utils/JsonUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/13AddTrader/types/utils/Logger.d.ts b/TypeScript/13AddTrader/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/13AddTrader/types/utils/Logger.d.ts +++ b/TypeScript/13AddTrader/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/13AddTrader/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/13AddTrader/types/utils/Watermark.d.ts b/TypeScript/13AddTrader/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/13AddTrader/types/utils/Watermark.d.ts +++ b/TypeScript/13AddTrader/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/PresetCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/SaveCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts b/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts b/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/14AfterDBLoadHook/types/di/OnLoad.d.ts b/TypeScript/14AfterDBLoadHook/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/OnLoad.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/di/OnLoadOnUpdate.d.ts b/TypeScript/14AfterDBLoadHook/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/di/OnUpdate.d.ts b/TypeScript/14AfterDBLoadHook/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/14AfterDBLoadHook/types/di/OnUpdate.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ExitStatis.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts b/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotWeaponModLimitService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/CustomLocationWaveService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/14AfterDBLoadHook/types/services/OpenZoneService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/14AfterDBLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/14AfterDBLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/JsonUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/JsonUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/14AfterDBLoadHook/types/utils/Logger.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/Logger.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HttpCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/ModCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/PresetCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/SaveCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts b/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts +++ b/TypeScript/15HttpListenerExample/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts b/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts +++ b/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/15HttpListenerExample/types/di/OnLoad.d.ts b/TypeScript/15HttpListenerExample/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/15HttpListenerExample/types/di/OnLoad.d.ts +++ b/TypeScript/15HttpListenerExample/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/di/OnLoadOnUpdate.d.ts b/TypeScript/15HttpListenerExample/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/15HttpListenerExample/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/15HttpListenerExample/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/di/OnUpdate.d.ts b/TypeScript/15HttpListenerExample/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/15HttpListenerExample/types/di/OnUpdate.d.ts +++ b/TypeScript/15HttpListenerExample/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/15HttpListenerExample/types/helpers/RepairHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RepairHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/15HttpListenerExample/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ExitStatis.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts b/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/servers/RagfairServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/15HttpListenerExample/types/servers/RagfairServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/15HttpListenerExample/types/services/BotWeaponModLimitService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/services/CustomLocationWaveService.d.ts b/TypeScript/15HttpListenerExample/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts b/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/15HttpListenerExample/types/services/OpenZoneService.d.ts b/TypeScript/15HttpListenerExample/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts b/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/15HttpListenerExample/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/15HttpListenerExample/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/15HttpListenerExample/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/15HttpListenerExample/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/15HttpListenerExample/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/15HttpListenerExample/types/utils/App.d.ts b/TypeScript/15HttpListenerExample/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/15HttpListenerExample/types/utils/App.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/15HttpListenerExample/types/utils/JsonUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/15HttpListenerExample/types/utils/JsonUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/15HttpListenerExample/types/utils/Logger.d.ts b/TypeScript/15HttpListenerExample/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/15HttpListenerExample/types/utils/Logger.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/2EditDatabase/types/callbacks/PresetCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/2EditDatabase/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/2EditDatabase/types/callbacks/SaveCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/2EditDatabase/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts b/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts +++ b/TypeScript/2EditDatabase/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts b/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts +++ b/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts b/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts b/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts b/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/2EditDatabase/types/di/OnLoad.d.ts b/TypeScript/2EditDatabase/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/2EditDatabase/types/di/OnLoad.d.ts +++ b/TypeScript/2EditDatabase/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/di/OnLoadOnUpdate.d.ts b/TypeScript/2EditDatabase/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/2EditDatabase/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/2EditDatabase/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/di/OnUpdate.d.ts b/TypeScript/2EditDatabase/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/2EditDatabase/types/di/OnUpdate.d.ts +++ b/TypeScript/2EditDatabase/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/2EditDatabase/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/2EditDatabase/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/2EditDatabase/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/2EditDatabase/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/2EditDatabase/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/2EditDatabase/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/2EditDatabase/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/2EditDatabase/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/2EditDatabase/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/2EditDatabase/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/2EditDatabase/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/2EditDatabase/types/models/enums/ExitStatis.d.ts b/TypeScript/2EditDatabase/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts b/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/2EditDatabase/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/2EditDatabase/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts b/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/2EditDatabase/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/2EditDatabase/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/2EditDatabase/types/services/BotWeaponModLimitService.d.ts b/TypeScript/2EditDatabase/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/2EditDatabase/types/services/CustomLocationWaveService.d.ts b/TypeScript/2EditDatabase/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/2EditDatabase/types/services/ItemBaseClassService.d.ts b/TypeScript/2EditDatabase/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts +++ b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/2EditDatabase/types/services/OpenZoneService.d.ts b/TypeScript/2EditDatabase/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts b/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/2EditDatabase/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/2EditDatabase/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/2EditDatabase/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/2EditDatabase/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/2EditDatabase/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/2EditDatabase/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/2EditDatabase/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/2EditDatabase/types/utils/App.d.ts b/TypeScript/2EditDatabase/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/2EditDatabase/types/utils/App.d.ts +++ b/TypeScript/2EditDatabase/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/2EditDatabase/types/utils/JsonUtil.d.ts b/TypeScript/2EditDatabase/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/2EditDatabase/types/utils/JsonUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/2EditDatabase/types/utils/Logger.d.ts b/TypeScript/2EditDatabase/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/2EditDatabase/types/utils/Logger.d.ts +++ b/TypeScript/2EditDatabase/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/2EditDatabase/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts +++ b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/PresetCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/SaveCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts b/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts +++ b/TypeScript/3GetSptConfigFile/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts b/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/3GetSptConfigFile/types/di/OnLoad.d.ts b/TypeScript/3GetSptConfigFile/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/3GetSptConfigFile/types/di/OnLoad.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/di/OnLoadOnUpdate.d.ts b/TypeScript/3GetSptConfigFile/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/3GetSptConfigFile/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/di/OnUpdate.d.ts b/TypeScript/3GetSptConfigFile/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/3GetSptConfigFile/types/di/OnUpdate.d.ts +++ b/TypeScript/3GetSptConfigFile/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ExitStatis.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts b/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/3GetSptConfigFile/types/services/BotWeaponModLimitService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/CustomLocationWaveService.d.ts b/TypeScript/3GetSptConfigFile/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/3GetSptConfigFile/types/services/ItemBaseClassService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/3GetSptConfigFile/types/services/OpenZoneService.d.ts b/TypeScript/3GetSptConfigFile/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts b/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/3GetSptConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/3GetSptConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/3GetSptConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/App.d.ts b/TypeScript/3GetSptConfigFile/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/App.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/JsonUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/JsonUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/3GetSptConfigFile/types/utils/Logger.d.ts b/TypeScript/3GetSptConfigFile/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/Logger.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/PresetCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/SaveCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts b/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts b/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/4UseACustomConfigFile/types/di/OnLoad.d.ts b/TypeScript/4UseACustomConfigFile/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/OnLoad.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/di/OnLoadOnUpdate.d.ts b/TypeScript/4UseACustomConfigFile/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/di/OnUpdate.d.ts b/TypeScript/4UseACustomConfigFile/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/4UseACustomConfigFile/types/di/OnUpdate.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ExitStatis.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotWeaponModLimitService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/CustomLocationWaveService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/4UseACustomConfigFile/types/services/ItemBaseClassService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/4UseACustomConfigFile/types/services/OpenZoneService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/4UseACustomConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/4UseACustomConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/JsonUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/JsonUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/PresetCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/SaveCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts b/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts +++ b/TypeScript/5ReplaceMethod/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts b/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts +++ b/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/5ReplaceMethod/types/di/OnLoad.d.ts b/TypeScript/5ReplaceMethod/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/5ReplaceMethod/types/di/OnLoad.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/di/OnLoadOnUpdate.d.ts b/TypeScript/5ReplaceMethod/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/5ReplaceMethod/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/di/OnUpdate.d.ts b/TypeScript/5ReplaceMethod/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/5ReplaceMethod/types/di/OnUpdate.d.ts +++ b/TypeScript/5ReplaceMethod/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/5ReplaceMethod/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ExitStatis.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts b/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/5ReplaceMethod/types/services/BotWeaponModLimitService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/services/CustomLocationWaveService.d.ts b/TypeScript/5ReplaceMethod/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts b/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/5ReplaceMethod/types/services/OpenZoneService.d.ts b/TypeScript/5ReplaceMethod/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts b/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/5ReplaceMethod/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/5ReplaceMethod/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/5ReplaceMethod/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/5ReplaceMethod/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/5ReplaceMethod/types/utils/App.d.ts b/TypeScript/5ReplaceMethod/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/5ReplaceMethod/types/utils/App.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/utils/JsonUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/5ReplaceMethod/types/utils/JsonUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts b/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/SaveCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts b/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts b/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/6ReferenceAnotherClass/types/di/OnLoad.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/OnLoad.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/di/OnLoadOnUpdate.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/di/OnUpdate.d.ts b/TypeScript/6ReferenceAnotherClass/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/6ReferenceAnotherClass/types/di/OnUpdate.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ExitStatis.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotWeaponModLimitService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/CustomLocationWaveService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/6ReferenceAnotherClass/types/services/OpenZoneService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/JsonUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/JsonUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/7OnLoadHook/types/callbacks/PresetCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/SaveCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts b/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/7OnLoadHook/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts b/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts b/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/7OnLoadHook/types/di/OnLoad.d.ts b/TypeScript/7OnLoadHook/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/7OnLoadHook/types/di/OnLoad.d.ts +++ b/TypeScript/7OnLoadHook/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/di/OnLoadOnUpdate.d.ts b/TypeScript/7OnLoadHook/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/7OnLoadHook/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/7OnLoadHook/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/di/OnUpdate.d.ts b/TypeScript/7OnLoadHook/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/7OnLoadHook/types/di/OnUpdate.d.ts +++ b/TypeScript/7OnLoadHook/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/7OnLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/7OnLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/7OnLoadHook/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/7OnLoadHook/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/7OnLoadHook/types/models/enums/ExitStatis.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts b/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/7OnLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts b/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/7OnLoadHook/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/7OnLoadHook/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/7OnLoadHook/types/services/BotWeaponModLimitService.d.ts b/TypeScript/7OnLoadHook/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/7OnLoadHook/types/services/CustomLocationWaveService.d.ts b/TypeScript/7OnLoadHook/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts b/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/7OnLoadHook/types/services/OpenZoneService.d.ts b/TypeScript/7OnLoadHook/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts b/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/7OnLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/7OnLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/7OnLoadHook/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/7OnLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/7OnLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/7OnLoadHook/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/7OnLoadHook/types/utils/App.d.ts b/TypeScript/7OnLoadHook/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/7OnLoadHook/types/utils/App.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/7OnLoadHook/types/utils/JsonUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/7OnLoadHook/types/utils/JsonUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/7OnLoadHook/types/utils/Logger.d.ts b/TypeScript/7OnLoadHook/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/7OnLoadHook/types/utils/Logger.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/PresetCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/SaveCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts b/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts +++ b/TypeScript/8OnUpdateHook/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts b/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/8OnUpdateHook/types/di/OnLoad.d.ts b/TypeScript/8OnUpdateHook/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/8OnUpdateHook/types/di/OnLoad.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/di/OnLoadOnUpdate.d.ts b/TypeScript/8OnUpdateHook/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/8OnUpdateHook/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/di/OnUpdate.d.ts b/TypeScript/8OnUpdateHook/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/8OnUpdateHook/types/di/OnUpdate.d.ts +++ b/TypeScript/8OnUpdateHook/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/8OnUpdateHook/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ExitStatis.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts b/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/8OnUpdateHook/types/services/BotWeaponModLimitService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/services/CustomLocationWaveService.d.ts b/TypeScript/8OnUpdateHook/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts b/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/8OnUpdateHook/types/services/OpenZoneService.d.ts b/TypeScript/8OnUpdateHook/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts b/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/8OnUpdateHook/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/8OnUpdateHook/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/8OnUpdateHook/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/8OnUpdateHook/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/8OnUpdateHook/types/utils/App.d.ts b/TypeScript/8OnUpdateHook/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/8OnUpdateHook/types/utils/App.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/utils/JsonUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/8OnUpdateHook/types/utils/JsonUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts b/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */ diff --git a/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts index 2efcf81..1f359e5 100644 --- a/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts @@ -8,7 +8,6 @@ import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../models/eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -54,7 +53,7 @@ export declare class DataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts index 7b2eeae..862c029 100644 --- a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts @@ -1,6 +1,7 @@ import { DialogueController } from "../controllers/DialogueController"; import { OnUpdate } from "../di/OnUpdate"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; +import { IChatServer } from "../models/eft/dialog/IChatServer"; import { IFriendRequestData } from "../models/eft/dialog/IFriendRequestData"; import { IGetAllAttachmentsRequestData } from "../models/eft/dialog/IGetAllAttachmentsRequestData"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; @@ -35,7 +36,7 @@ export declare class DialogueCallbacks extends OnUpdate { * Handles client/chatServer/list * @returns */ - getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; + getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; @@ -52,6 +53,6 @@ export declare class DialogueCallbacks extends OnUpdate { listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; friendRequest(url: string, request: IFriendRequestData, sessionID: string): INullResponseData; sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HandbookCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HandbookCallbacks.d.ts index 891e375..1bb6241 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HandbookCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HandbookCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class HandbookCallbacks extends OnLoad { protected handbookController: HandbookController; constructor(handbookController: HandbookController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts index e39e806..56450a9 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts @@ -91,6 +91,6 @@ export declare class HideoutCallbacks extends OnUpdate { * @returns */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts index 43928a1..299a32c 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HttpCallbacks.d.ts @@ -3,7 +3,7 @@ import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { protected httpServer: HttpServer; constructor(httpServer: HttpServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getImage(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts index a171e1c..11aef4a 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts @@ -27,6 +27,6 @@ export declare class InsuranceCallbacks extends OnUpdate { * @returns IItemEventRouterResponse */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts index aec2f59..9ebb750 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ModCallbacks.d.ts @@ -3,6 +3,7 @@ import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { @@ -10,10 +11,11 @@ declare class ModCallbacks extends OnLoad { protected httpResponse: HttpResponseUtil; protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); - onLoad(): void; + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, localisationService: LocalisationService, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; getBundles(url: string, info: any, sessionID: string): string; diff --git a/TypeScript/9RouterHooks/types/callbacks/PresetCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/PresetCallbacks.d.ts index 4553f8f..681bb99 100644 --- a/TypeScript/9RouterHooks/types/callbacks/PresetCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/PresetCallbacks.d.ts @@ -3,6 +3,6 @@ import { OnLoad } from "../di/OnLoad"; export declare class PresetCallbacks extends OnLoad { protected presetController: PresetController; constructor(presetController: PresetController); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts index 37f3807..15597bf 100644 --- a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts @@ -14,7 +14,6 @@ import { IRemoveOfferRequestData } from "../models/eft/ragfair/IRemoveOfferReque import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; import { ISendRagfairReportRequestData } from "../models/eft/ragfair/ISendRagfairReportRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -24,14 +23,13 @@ import { JsonUtil } from "../utils/JsonUtil"; */ export declare class RagfairCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; - protected logger: ILogger; protected jsonUtil: JsonUtil; protected ragfairServer: RagfairServer; protected ragfairController: RagfairController; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(httpResponse: HttpResponseUtil, logger: ILogger, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); - onLoad(): void; + constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, configServer: ConfigServer); + onLoad(): Promise; getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; @@ -39,6 +37,6 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/9RouterHooks/types/callbacks/SaveCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/SaveCallbacks.d.ts index bbb6e53..ab29ddc 100644 --- a/TypeScript/9RouterHooks/types/callbacks/SaveCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/SaveCallbacks.d.ts @@ -3,7 +3,7 @@ import { SaveServer } from "../servers/SaveServer"; export declare class SaveCallbacks extends OnLoadOnUpdate { protected saveServer: SaveServer; constructor(saveServer: SaveServer); - onLoad(): void; + onLoad(): Promise; getRoute(): string; - onUpdate(secondsSinceLastRun: number): boolean; + onUpdate(secondsSinceLastRun: number): Promise; } diff --git a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts index 40a1455..1efde87 100644 --- a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts @@ -8,8 +8,8 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected httpResponse: HttpResponseUtil; protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); - onLoad(): void; - onUpdate(): boolean; + onLoad(): Promise; + onUpdate(): Promise; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; /** diff --git a/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts b/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts index a155bcd..28bbdf7 100644 --- a/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts +++ b/TypeScript/9RouterHooks/types/context/ApplicationContext.d.ts @@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType"; export declare class ApplicationContext { private variables; private static holderMaxSize; + /** + * Called like: + * + * const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue(); + * + * const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue(); + * @param type + * @returns + */ getLatestValue(type: ContextVariableType): ContextVariable; getValues(type: ContextVariableType): ContextVariable[]; addValue(type: ContextVariableType, value: any): void; diff --git a/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts b/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts index a7dd9b5..fa5390f 100644 --- a/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts +++ b/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts @@ -4,5 +4,7 @@ export declare enum ContextVariableType { /** Currently acive raid information */ MATCH_INFO = 1, /** Timestamp when client first connected */ - CLIENT_START_TIMESTAMP = 2 + CLIENT_START_TIMESTAMP = 2, + /** When player is loading into map and loot is requested */ + REGISTER_PLAYER_REQUEST = 3 } diff --git a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts index 92317c3..a80aaed 100644 --- a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts @@ -2,6 +2,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; @@ -23,18 +24,23 @@ export declare class BotController { protected botGenerationCacheService: BotGenerationCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; + protected profileHelper: ProfileHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for - * @returns + * @returns number of bots to generate */ getBotPresetGenerationLimit(type: string): number; + /** + * Get the core.json difficulty settings from database\bots + * @returns IBotCore + */ getBotCoreDifficulty(): IBotCore; /** * Get bot difficulty settings @@ -51,6 +57,12 @@ export declare class BotController { * @returns IBotBase array */ generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + /** + * Get the difficulty passed in, if its not "asoline", get selected difficulty from config + * @param requestedDifficulty + * @returns + */ + getPMCDifficulty(requestedDifficulty: string): string; /** * Get the max number of bots allowed on a map * Looks up location player is entering when getting cap value diff --git a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts index 5fe51e3..a4ef8cf 100644 --- a/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/CustomizationController.d.ts @@ -8,13 +8,15 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class CustomizationController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected saveServer: SaveServer; + protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper); getTraderSuits(traderID: string, sessionID: string): ISuit[]; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts index 9c8b728..98d3d52 100644 --- a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts @@ -27,6 +27,7 @@ export declare class DialogueController { */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** + * Handle player clicking 'messenger' and seeing all the messages they've recieved * Set the content of the dialogue on the details panel, showing all the messages * for the specified dialogue. * @param dialogueID Dialog id diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index f4f5849..b23ccf7 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -1,59 +1,50 @@ import { ApplicationContext } from "../context/ApplicationContext"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { PreAkiModLoader } from "../loaders/PreAkiModLoader"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Config } from "../models/eft/common/IGlobals"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IServerDetails } from "../models/eft/game/IServerDetails"; 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 { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; -import { Watermark } from "../utils/Watermark"; +import { SeasonalEventService } from "../services/SeasonalEventService"; export declare class GameController { protected logger: ILogger; protected databaseServer: DatabaseServer; - protected watermark: Watermark; + protected preAkiModLoader: PreAkiModLoader; protected httpServerHelper: HttpServerHelper; - protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; protected localisationService: LocalisationService; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; /** - * Check if current date falls inside any of the seasons events pased in, if so, handle them - * @param seasonalEvents events to check for + * Get a list of installed mods and save their details to the profile being used + * @param fullProfile Profile to add mod details to */ - protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + protected saveActiveModsToProfile(fullProfile: IAkiProfile): void; /** - * Make adjusted to server code based on the name of the event passed in - * @param globalConfig globals.json - * @param eventName Name of the event to enable. e.g. Christmas + * Add the logged in players name to PMC name pool + * @param pmcProfile */ - protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + protected addPlayerToPMCNames(pmcProfile: IPmcData): void; /** - * Read in data from seasonalEvents.json and add found equipment items to bots - * @param eventName Name of the event to read equipment in from config + * Blank out the "test" mail message from prapor */ - protected addEventGearToScavs(eventName: string): void; - /** - * Set Khorovod(dancing tree) chance to 100% on all maps that support it - */ - protected enableDancingTree(): void; + protected removePraporTestMessage(): void; /** * Make non-trigger-spawned raiders spawn earlier + always */ @@ -61,6 +52,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; - protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts b/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts index ce67993..97cf7ef 100644 --- a/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts @@ -1,23 +1,25 @@ -import { ItemHelper } from "../helpers/ItemHelper"; -import { PaymentService } from "../services/PaymentService"; -import { InventoryHelper } from "../helpers/InventoryHelper"; import { HealthHelper } from "../helpers/HealthHelper"; +import { InventoryHelper } from "../helpers/InventoryHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IHealthTreatmentRequestData } from "../models/eft/health/IHealthTreatmentRequestData"; import { IOffraidEatRequestData } from "../models/eft/health/IOffraidEatRequestData"; import { IOffraidHealRequestData } from "../models/eft/health/IOffraidHealRequestData"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; export declare class HealthController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected itemHelper: ItemHelper; protected paymentService: PaymentService; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected healthHelper: HealthHelper; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, healthHelper: HealthHelper); + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, healthHelper: HealthHelper); /** * stores in-raid player health * @param pmcData Player profile diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 39a6396..f954eff 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { HealthHelper } from "../helpers/HealthHelper"; import { InRaidHelper } from "../helpers/InRaidHelper"; @@ -35,12 +36,13 @@ export declare class InraidController { protected traderHelper: TraderHelper; protected insuranceService: InsuranceService; protected inRaidHelper: InRaidHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** - * Save locationid to active profiles inraid object + * Save locationId to active profiles inraid object AND app context * @param sessionID Session id * @param info Register player request */ diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index 2b0d150..2c78405 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -18,7 +18,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { CustomLocationWaveService } from "../services/CustomLocationWaveService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { OpenZoneService } from "../services/OpenZoneService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -29,12 +31,14 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; + protected customLocationWaveService: CustomLocationWaveService; + protected openZoneService: OpenZoneService; protected botGenerationCacheService: BotGenerationCacheService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; protected botConfig: IBotConfig; - constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts index 842207f..b57eb40 100644 --- a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts @@ -5,6 +5,7 @@ import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData"; @@ -15,11 +16,14 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { protected logger: ILogger; protected timeUtil: TimeUtil; + protected httpResponseUtil: HttpResponseUtil; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; @@ -29,9 +33,10 @@ export declare class QuestController { protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; protected localeService: LocaleService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) @@ -55,7 +60,30 @@ export declare class QuestController { * @returns client response */ acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + * @param startedMessageTextId startedMessageText property from IQuest + * @param questDescriptionId description property from IQuest + * @returns message id + */ + protected getMessageIdForQuestStart(startedMessageTextId: string, questDescriptionId: string): string; + /** + * Handle the client accepting a repeatable quest and starting it + * Send starting rewards if any to player and + * Send start notification if any to player + * @param pmcData Profile to update with new quest + * @param acceptedQuest Quest being accepted + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Look for an accepted quest inside player profile, return matching + * @param pmcData Profile to search through + * @param acceptedQuest Quest to search for + * @returns IRepeatableQuest + */ + protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest; /** * Update completed quest in profile * Add newly unlocked quests to profile diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index 95702f2..36a919f 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -67,16 +67,16 @@ export declare class RagfairController { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, 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, localisationService: LocalisationService, configServer: ConfigServer); - getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + getOffers(sessionID: string, searchRequest: 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 traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers */ - protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data @@ -100,8 +100,9 @@ export declare class RagfairController { /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update + * @param profile full profile of player */ - protected setTraderOfferPurchaseLimits(offer: IRagfairOffer): void; + protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void; protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; diff --git a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts index 333583b..fee4d44 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts @@ -20,6 +20,7 @@ import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -56,6 +57,7 @@ export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; @@ -71,7 +73,7 @@ export declare class RepeatableQuestController { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. @@ -98,6 +100,13 @@ export declare class RepeatableQuestController { * @returns {array} array of "repeatableQuestObjects" as descibed above */ getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[]; + /** + * Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + * @param repeatableConfig daily/weekly config + * @param pmcData Profile to search + * @returns IPmcDataRepeatableQuest + */ + protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; /** * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest @@ -146,6 +155,12 @@ export declare class RepeatableQuestController { * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * Cpnvert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; /** * Exploration repeatable quests can specify a required extraction point. * This method creates the according object which will be appended to the conditions array diff --git a/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts b/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts index 0ed0556..6c35d66 100644 --- a/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/TradeController.d.ts @@ -8,13 +8,15 @@ import { Upd } from "../models/eft/common/tables/IItem"; import { IProcessBaseTradeRequestData } from "../models/eft/trade/IProcessBaseTradeRequestData"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ILogger } from "../models/spt/utils/ILogger"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class TradeController { protected logger: ILogger; protected eventOutputHolder: EventOutputHolder; protected tradeHelper: TradeHelper; protected profileHelper: ProfileHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer); + protected httpResponse: HttpResponseUtil; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, profileHelper: ProfileHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil); confirmTrading(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse; confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts index d7afe95..b67aec9 100644 --- a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts @@ -7,6 +7,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class TraderController { @@ -17,10 +18,11 @@ export declare class TraderController { protected traderHelper: TraderHelper; protected timeUtil: TimeUtil; protected traderAssortService: TraderAssortService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected fenceService: FenceService; protected fenceBaseAssortGenerator: FenceBaseAssortGenerator; protected jsonUtil: JsonUtil; - constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil); /** * Runs when onLoad event is fired * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService diff --git a/TypeScript/9RouterHooks/types/di/OnLoad.d.ts b/TypeScript/9RouterHooks/types/di/OnLoad.d.ts index 064d07d..4a28f13 100644 --- a/TypeScript/9RouterHooks/types/di/OnLoad.d.ts +++ b/TypeScript/9RouterHooks/types/di/OnLoad.d.ts @@ -1,4 +1,4 @@ export declare class OnLoad { - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/di/OnLoadOnUpdate.d.ts b/TypeScript/9RouterHooks/types/di/OnLoadOnUpdate.d.ts index 8bd3dc3..eaa297c 100644 --- a/TypeScript/9RouterHooks/types/di/OnLoadOnUpdate.d.ts +++ b/TypeScript/9RouterHooks/types/di/OnLoadOnUpdate.d.ts @@ -1,7 +1,7 @@ import { OnLoad } from "./OnLoad"; import { OnUpdate } from "./OnUpdate"; export declare class OnLoadOnUpdate implements OnLoad, OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; - onLoad(): void; + onUpdate(timeSinceLastRun: number): Promise; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/di/OnUpdate.d.ts b/TypeScript/9RouterHooks/types/di/OnUpdate.d.ts index 7fbbe09..6839719 100644 --- a/TypeScript/9RouterHooks/types/di/OnUpdate.d.ts +++ b/TypeScript/9RouterHooks/types/di/OnUpdate.d.ts @@ -1,4 +1,4 @@ export declare class OnUpdate { - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts new file mode 100644 index 0000000..5b937ca --- /dev/null +++ b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts @@ -0,0 +1,200 @@ +import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; +import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { ProbabilityHelper } from "../helpers/ProbabilityHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; +import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { HashUtil } from "../utils/HashUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotEquipmentModGenerator { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected hashUtil: HashUtil; + protected randomUtil: RandomUtil; + protected probabilityHelper: ProbabilityHelper; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected botEquipmentFilterService: BotEquipmentFilterService; + protected itemFilterService: ItemFilterService; + protected profileHelper: ProfileHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botHelper: BotHelper; + protected botGeneratorHelper: BotGeneratorHelper; + protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + /** + * Check mods are compatible and add to array + * @param equipment Equipment item to add mods to + * @param modPool Mod list to choose frm + * @param parentId parentid of item to add mod to + * @param parentTemplate template objet of item to add mods to + * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn + * @returns Item + compatible mods as an array + */ + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; + /** + * Add mods to a weapon using the provided mod pool + * @param sessionId session id + * @param weapon Weapon to add mods to + * @param modPool Pool of compatible mods to attach to weapon + * @param weaponParentId parentId of weapon + * @param parentTemplate Weapon which mods will be generated on + * @param modSpawnChances Mod spawn chances + * @param ammoTpl Ammo tpl to use when generating magazines/cartridges + * @param botRole Role of bot weapon is generated for + * @param botLevel lvel of the bot weapon is being generated for + * @param modLimits limits placed on certian mod types per gun + * @param botEquipmentRole role of bot when accessing bot.json equipment config settings + * @returns Weapon + mods array + */ + generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[]; + /** + * Is this modslot a front or rear sight + * @param modSlot Slot to check + * @returns true if it's a front/rear sight + */ + protected modIsFrontOrRearSight(modSlot: string): boolean; + /** + * Does the provided mod details show the mod can hold a scope + * @param modSlot e.g. mod_scope, mod_mount + * @param modsParentId Parent id of mod item + * @returns true if it can hold a scope + */ + protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean; + /** + * Set all scope mod chances to 100% + * @param modSpawnChances Chances objet to update + */ + protected setScopeSpawnChancesToFull(modSpawnChances: ModsChances): void; + protected sortModKeys(unsortedKeys: string[]): string[]; + /** + * Get a Slot property for an item (chamber/cartridge/slot) + * @param modSlot e.g patron_in_weapon + * @param parentTemplate item template + * @returns Slot item + */ + protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; + /** + * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * never return true for an item that has 0% spawn chance + * @param itemSlot slot the item sits in + * @param modSlot slot the mod sits in + * @param modSpawnChances Chances for various mod spawns + * @returns boolean true if it should spawn + */ + protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; + /** + * + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from + * @param weapon array with only weapon tpl in it, ready for mods to be added + * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem + */ + protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; + /** + * Create a mod item with parameters as properties + * @param modId _id + * @param modTpl _tpl + * @param parentId parentId + * @param modSlot slotId + * @param modTemplate Used to add additional properites in the upd object + * @returns Item object + */ + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; + /** + * Get a list of containers that hold ammo + * e.g. mod_magazine / patron_in_weapon_000 + * @returns string array + */ + protected getAmmoContainers(): string[]; + /** + * Get a random mod from an items compatible mods Filter array + * @param modTpl ???? default value to return if nothing found + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with + * @returns item tpl + */ + protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; + /** + * Log errors if mod is not compatible with slot + * @param modToAdd template of mod to check + * @param itemSlot slot the item will be placed in + * @param modSlot slot the mod will fill + * @param parentTemplate tempalte of the mods parent item + * @returns true if valid + */ + protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; + /** + * Find mod tpls of a provided type and add to modPool + * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) + * @param modTemplate db object for modItem we get compatible mods from + * @param modPool Pool of mods we are adding to + */ + protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; + /** + * Get the possible items that fit a slot + * @param parentItemId item tpl to get compatible items for + * @param modSlot Slot item should fit in + * @param botEquipBlacklist equipment that should not be picked + * @returns array of compatible items for that slot + */ + protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[]; + /** + * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + * @param allowedMods base mods to filter + * @param botEquipBlacklist equipment blacklist + * @param modSlot slot mods belong to + * @returns Filtered array of mod tpls + */ + protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; + /** + * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + * @param items The items where the CylinderMagazine's camora are appended to + * @param modPool modPool which should include available cartrigdes + * @param parentId The CylinderMagazine's UID + * @param parentTemplate The CylinderMagazine's template + */ + protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; + /** + * Take a record of camoras and merge the compatable shells into one array + * @param camorasWithShells camoras we want to merge into one array + * @returns string array of shells fro luitple camora sources + */ + protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + /** + * Filter out non-whitelisted weapon scopes + * @param weapon Weapon scopes will be added to + * @param scopes Full scope pool + * @param botWeaponSightWhitelist whitelist of scope types by weapon base type + * @returns array of scope tpls that have been filtered + */ + protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record): string[]; +} diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index a1ac9ed..2675146 100644 --- a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts @@ -1,25 +1,21 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; -import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; +import { Health, IBotType } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotInventoryGenerator } from "./BotInventoryGenerator"; -declare namespace BotGenerator { - interface IRandomisedBotLevelResult { - level: number; - exp: number; - } -} +import { BotLevelGenerator } from "./BotLevelGenerator"; export declare class BotGenerator { protected logger: ILogger; protected hashUtil: HashUtil; @@ -28,14 +24,15 @@ export declare class BotGenerator { protected profileHelper: ProfileHelper; protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; + protected botLevelGenerator: BotLevelGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -45,23 +42,12 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects based on a condition for a raid with - * @param sessionId session id - * @param condition request condition - * @returns bot array + * Create x number of bots of the type/side/difficulty defined in botGenerationDetails + * @param sessionId Session id + * @param botGenerationDetails details on how to generate bots + * @returns array of bots */ - generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; - /** - * Get the PMCs wildSpawnType value - * @param role "usec" / "bear" - * @returns wildSpawnType value as string - */ - protected getPmcRoleByDescription(role: string): string; - /** - * Get a randomised PMC side based on bot config value 'isUsec' - * @returns pmc side as string - */ - protected getRandomisedPmcSide(): string; + prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[]; /** * Get a clone of the database\bots\base.json file * @returns IBotBase object @@ -71,26 +57,24 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param botRole Role bot will use (bear/usec for PMCs) - * @param node Bot template from db/bots/x.json - * @param isPmc Is bot to be a PMC - * @param isPlayerScav is bot to be a p scav bot + * @param botJsonTemplate Bot template from db/bots/x.json + * @param botGenerationDetails details on how to generate the bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase; + /** + * Create a bot nickname + * @param botJsonTemplate x.json from database + * @param isPlayerScav Will bot be player scav + * @param botRole role of bot e.g. assault + * @returns Nickname for bot + */ + protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string): string; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client */ protected logPmcGeneratedCount(output: IBotBase[]): void; - /** - * Return a randomised bot level and exp value - * @param role botRole being generated for - * @param min Min exp value - * @param max Max exp value - * @returns IRandomisedBotLevelResult object - */ - protected generateRandomLevel(role: string, min: number, max: number): BotGenerator.IRandomisedBotLevelResult; /** * Converts health object to the required format * @param healthObj health object from bot json @@ -99,11 +83,6 @@ export declare class BotGenerator { */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; protected generateSkills(skillsObj: Skills): Skills; - /** - * Iterate through bots inventory and loot to find and remove christmas items (as defined in GameEventHelper) - * @param nodeInventory Bots inventory to iterate over - */ - protected removeChristmasItemsFromBotInventory(nodeInventory: Inventory): void; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update @@ -111,12 +90,6 @@ export declare class BotGenerator { */ protected generateId(bot: IBotBase): IBotBase; protected generateInventoryID(profile: IBotBase): IBotBase; - /** - * Get the difficulty passed in, if its not "asoline", get selected difficulty from config - * @param requestedDifficulty - * @returns - */ - protected getPMCDifficulty(requestedDifficulty: string): string; /** * Add a side-specific (usec/bear) dogtag item to a bots inventory * @param bot bot to add dogtag to @@ -124,4 +97,3 @@ export declare class BotGenerator { */ protected generateDogtag(bot: IBotBase): IBotBase; } -export {}; diff --git a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts index e1efaf2..83a548b 100644 --- a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts @@ -1,15 +1,18 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper"; +import { BotHelper } from "../helpers/BotHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Generation, Inventory, Mods } from "../models/eft/common/tables/IBotType"; +import { Chances, Generation, IBotType, Inventory, Mods } from "../models/eft/common/tables/IBotType"; import { EquipmentSlots } from "../models/enums/EquipmentSlots"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { BotLootGenerator } from "./BotLootGenerator"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; export declare class BotInventoryGenerator { @@ -20,22 +23,24 @@ export declare class BotInventoryGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; + protected botHelper: BotHelper; protected weightedRandomHelper: WeightedRandomHelper; protected localisationService: LocalisationService; + protected botEquipmentModPoolService: BotEquipmentModPoolService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer); /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param templateInventory bot/x.json data from db - * @param equipmentChances Chances each item will be added to bot - * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botJsonTemplate bot/x.json data from db * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc + * @param botLevel Level of bot being generated * @returns PmcInventory object with equipment/weapons/loot */ - generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number): PmcInventory; /** * Create a pmcInventory object with all the base/generic items needed * @returns PmcInventory object @@ -47,9 +52,27 @@ export declare class BotInventoryGenerator { * @param equipmentChances Chances items will be added to bot * @param botRole Role bot has (assault/pmcBot) * @param botInventory Inventory to add equipment to + * @param botLevel Level of bot */ - protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void; + /** + * Add a piece of equipment with mods to inventory from the provided pools + * @param equipmentSlot Slot to select an item for + * @param equipmentPool Possible items to choose from + * @param modPool Possible mods to apply to item chosen + * @param spawnChances Chances items will be chosen to be added + * @param botRole Role of bot e.g. assault + * @param inventory Inventory to add item into + * @param randomisationDetails settings from bot.json to adjust how item is generated + */ + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void; + /** + * Get all possible mods for item and filter down based on equipment blacklist from bot.json config + * @param itemTpl Item mod pool is being retreived and filtered + * @param equipmentBlacklist blacklist to filter mod pool with + * @returns Filtered pool of mods + */ + protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record; /** * Work out what weapons bot should have equipped and add them to bot inventory * @param templateInventory bot/x.json data from db @@ -58,9 +81,10 @@ export declare class BotInventoryGenerator { * @param botInventory Inventory to add weapons to * @param botRole assault/pmcBot/bossTagilla etc * @param isPmc Is the bot being generated as a pmc + * @param botLevel level of bot having weapon generated * @param itemGenerationLimitsMinMax Limits for items the bot can have */ - protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; /** * Calculate if the bot should have weapons in Primary/Secondary/Holster slots * @param equipmentChances Chances bot has certain equipment @@ -84,5 +108,5 @@ export declare class BotInventoryGenerator { protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; - }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void; } diff --git a/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts new file mode 100644 index 0000000..751e6e6 --- /dev/null +++ b/TypeScript/9RouterHooks/types/generators/BotLevelGenerator.d.ts @@ -0,0 +1,29 @@ +import { MinMax } from "../models/common/MinMax"; +import { IRandomisedBotLevelResult } from "../models/eft/bot/IRandomisedBotLevelResult"; +import { ExpTable } from "../models/eft/common/IGlobals"; +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class BotLevelGenerator { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected databaseServer: DatabaseServer; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer); + /** + * Return a randomised bot level and exp value + * @param levelDetails min and max of level for bot + * @param botGenerationDetails Deatils to help generate a bot + * @param bot being level is being generated for + * @returns IRandomisedBotLevelResult object + */ + generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult; + /** + * Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table + * @param playerLevel Players current level + * @param relativeDeltaMax max delta above player level to go + * @returns highest level possible for bot + */ + protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: ExpTable[]): number; +} diff --git a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts index 3352a46..6273a11 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts @@ -28,7 +28,18 @@ export declare class BotLootGenerator { protected configServer: ConfigServer; protected botConfig: IBotConfig; constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; + /** + * Add loot to bots containers + * @param sessionId Session id + * @param templateInventory x.json from database/bots + * @param itemCounts Liits on item types to be added as loot + * @param isPmc Will bot be a pmc + * @param botRole Role of bot, e.g. asssult + * @param botInventory Inventory to add loot to + * @param equipmentChances + * @param botLevel Level of bot + */ + generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached @@ -51,7 +62,7 @@ export declare class BotLootGenerator { * @param botRole bots role, .e.g. pmcBot * @param isPmc are we generating for a pmc */ - protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void; + protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from diff --git a/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts index 40284ea..938d61c 100644 --- a/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts @@ -12,10 +12,12 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { BotEquipmentModGenerator } from "./BotEquipmentModGenerator"; import { IInventoryMagGen } from "./weapongen/IInventoryMagGen"; export declare class BotWeaponGenerator { protected jsonUtil: JsonUtil; @@ -28,11 +30,13 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected botWeaponModLimitService: BotWeaponModLimitService; + protected botEquipmentModGenerator: BotEquipmentModGenerator; protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster @@ -43,7 +47,7 @@ export declare class BotWeaponGenerator { * @param isPmc Is weapon generated for a pmc * @returns GenerateWeaponResult object */ - generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Get a random weighted weapon from a bots pool of weapons * @param equipmentSlot Primary/secondary/holster @@ -62,7 +66,7 @@ export declare class BotWeaponGenerator { * @param isPmc * @returns GenerateWeaponResult object */ - generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult; + generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult; /** * Create array with weapon base as only element and * add additional properties based on weapon type diff --git a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts index cc61dcf..a80ae3c 100644 --- a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts @@ -1,5 +1,4 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; -import { GameEventHelper } from "../helpers/GameEventHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; @@ -9,6 +8,8 @@ import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticL import { ILocationConfig } from "../models/spt/config/ILocationConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; @@ -26,12 +27,13 @@ export declare class LocationGenerator { protected ragfairServerHelper: RagfairServerHelper; protected itemHelper: ItemHelper; protected mathUtil: MathUtil; - protected gameEventHelper: GameEventHelper; + protected seasonalEventService: SeasonalEventService; protected containerHelper: ContainerHelper; protected presetHelper: PresetHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected locationConfig: ILocationConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, gameEventHelper: GameEventHelper, containerHelper: ContainerHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index bc0d7ec..0d2ef24 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -6,6 +6,7 @@ import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class LootGenerator { @@ -14,8 +15,9 @@ export declare class LootGenerator { protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected itemFilterService: ItemFilterService; - constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, itemFilterService: ItemFilterService); + constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService); /** * Generate a list of items based on configuration options parameter * @param options parameters to adjust how loot is generated diff --git a/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts index bb2c730..9fee88b 100644 --- a/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/PlayerScavGenerator.d.ts @@ -10,6 +10,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { BotGenerator } from "./BotGenerator"; export declare class PlayerScavGenerator { @@ -21,10 +22,11 @@ export declare class PlayerScavGenerator { protected jsonUtil: JsonUtil; protected fenceService: FenceService; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected botGenerator: BotGenerator; protected configServer: ConfigServer; protected playerScavConfig: IPlayerScavConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer); /** * Update a player profile to include a new player scav profile * @param sessionID session id to specify what profile is updated diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index 23882d2..338cd5c 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -7,7 +7,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; -import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; +import { Dynamic, IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -88,7 +88,16 @@ export declare class RagfairOfferGenerator { * Create multiple offers for items by using a unique list of items we've generated previously * @param expiredOffers optional, expired offers to regenerate */ - generateDynamicOffers(expiredOffers?: Item[]): void; + generateDynamicOffers(expiredOffers?: Item[]): Promise; + protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise; + /** + * Create one flea offer for a specific item + * @param items Item to create offer for + * @param isPreset Is item a weapon preset + * @param itemDetails raw db item details + * @returns + */ + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -110,7 +119,7 @@ export declare class RagfairOfferGenerator { */ protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; /** - * Get an array of flea prices + item tpl, cached in generator class + * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values */ protected getFleaPricesAsArray(): { diff --git a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts index 89cb5c8..f9ac623 100644 --- a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts @@ -37,12 +37,6 @@ export declare class ScavCaseRewardGenerator { * @returns filtered array of db items */ protected getDbItems(): ITemplateItem[]; - /** - * Check if a template id has a blacklisted parent id - * @param tplid template id to check - * @returns true if item is blacklisted - */ - protected itemHasBlacklistedParent(tplid: string): boolean; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts index bfc157f..de8b5bf 100644 --- a/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/AssortHelper.d.ts @@ -2,14 +2,16 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ItemHelper } from "./ItemHelper"; import { QuestHelper } from "./QuestHelper"; export declare class AssortHelper { protected logger: ILogger; protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected questHelper: QuestHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, questHelper: QuestHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper); /** * Remove assorts from a trader that have not been unlocked yet * @param pmcProfile player profile diff --git a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts index 899669e..d9ce968 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts @@ -1,204 +1,24 @@ import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper"; -import { Mods, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem"; -import { ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem"; -import { EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; -import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; -import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; -import { BotWeaponGeneratorHelper } from "./BotWeaponGeneratorHelper"; -import { ContainerHelper } from "./ContainerHelper"; -import { InventoryHelper } from "./InventoryHelper"; import { ItemHelper } from "./ItemHelper"; -import { ProbabilityHelper } from "./ProbabilityHelper"; -import { ProfileHelper } from "./ProfileHelper"; -export declare class BotModLimits { - scope: ItemCount; - scopeMax: number; - scopeBaseTypes: string[]; - flashlightLaser: ItemCount; - flashlightLaserMax: number; - flashlgihtLaserBaseTypes: string[]; -} -export declare class ItemCount { - count: number; -} export declare class BotGeneratorHelper { protected logger: ILogger; - protected jsonUtil: JsonUtil; - protected hashUtil: HashUtil; protected randomUtil: RandomUtil; - protected probabilityHelper: ProbabilityHelper; protected databaseServer: DatabaseServer; protected durabilityLimitsHelper: DurabilityLimitsHelper; protected itemHelper: ItemHelper; - protected inventoryHelper: InventoryHelper; - protected containerHelper: ContainerHelper; - protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemFilterService: ItemFilterService; - protected profileHelper: ProfileHelper; - protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); - /** - * Check mods are compatible and add to array - * @param equipment Equipment item to add mods to - * @param modPool Mod list to choose frm - * @param parentId parentid of item to add mod to - * @param parentTemplate template objet of item to add mods to - * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type - * @param botRole the bot role being generated for - * @param forceSpawn should this mod be forced to spawn - * @returns Item + compatible mods as an array - */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; - /** - * @param sessionId session id - * @param weapon Weapon to add mods to - * @param modPool Pool of compatible mods to attach to weapon - * @param weaponParentId parentId of weapon - * @param parentWeaponTemplate Weapon which mods will be generated on - * @param modSpawnChances Mod spawn chances - * @param ammoTpl Ammo tpl to use when generating magazines/cartridges - * @param botRole Role of bot weapon is generated for - * @returns Weapon + mods array - */ - generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; - /** - * - * @param modSlot Slot mod will fit into - * @param isRandomisableSlot Will generate a randomised mod pool if true - * @param modsParent Parent slot the item will be a part of - * @param botEquipBlacklist Blacklist to prevent mods from being picked - * @param itemModPool Pool of items to pick from - * @param weapon array with only weapon tpl in it, ready for mods to be added - * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate Parent item the mod will go into - * @returns ITemplateItem - */ - protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; - /** - * Find mod tpls of a provided type and add to modPool - * @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope) - * @param modTemplate db object for modItem we get compatible mods from - * @param modPool Pool of mods we are adding to - */ - protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void; - /** - * Check if mod item is on limited list + has surpassed the limit set for it - * @param botRole role the bot has e.g. assault - * @param modTemplate mods template data - * @param modLimits limits set for weapon being generated for this bot - * @returns true if over item limit - */ - protected modHasReachedItemLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits): boolean; - /** - * Initalise mod limits to be used when generating a weapon - * @param botRole "assault", "bossTagilla" or "pmc" - * @returns BotModLimits object - */ - protected initModLimits(botRole: string): BotModLimits; - /** - * Generate a pool of mods for this bots mod type if bot has values inside `randomisedWeaponModSlots` array found in bot.json/equipment[botrole] - * @param allowedMods Mods to be added to mod pool - * @param botEquipBlacklist blacklist of items not allowed to be added to mod pool - * @param modSlot Slot to generate mods for - * @param itemModPool base mod pool to replace values of - */ - protected generateDynamicWeaponModPool(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string, itemModPool: Record): void; - /** - * Find all compatible mods for equipment item and add to modPool - * @param itemDetails item to find mods for - * @param modPool ModPool to add mods to - * @param equipmentBlacklist equipment not allowed to be used by the bot - * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) - */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; - /** - * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist - * @param allowedMods base mods to filter - * @param botEquipBlacklist equipment blacklist - * @param modSlot slot mods belong to - * @returns Filtered array of mod tpls - */ - protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[]; - /** - * Check if the specific item type on the weapon has reached the set limit - * @param modTpl log mod tpl if over type limit - * @param currentCount current number of this item on gun - * @param maxLimit mod limit allowed - * @param botRole role of bot we're checking weapon of - * @returns true if limit reached - */ - protected weaponModLimitReached(modTpl: string, currentCount: { - count: number; - }, maxLimit: number, botRole: string): boolean; - /** - * Log errors if mod is not compatible with slot - * @param modToAdd template of mod to check - * @param itemSlot slot the item will be placed in - * @param modSlot slot the mod will fill - * @param parentTemplate tempalte of the mods parent item - * @returns true if valid - */ - protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean; - /** - * Create a mod item with parameters as properties - * @param modId _id - * @param modTpl _tpl - * @param parentId parentId - * @param modSlot slotId - * @param modTemplate Used to add additional properites in the upd object - * @returns Item object - */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; - /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot - * never return true for an item that has 0% spawn chance - * @param itemSlot slot the item sits in - * @param modSlot slot the mod sits in - * @param modSpawnChances Chances for various mod spawns - * @returns boolean true if it should spawn - */ - protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean; - /** - * Get a list of containers that hold ammo - * e.g. mod_magazine / patron_in_weapon_000 - * @returns string array - */ - protected getAmmoContainers(): string[]; - /** - * Get a Slot property for an item (chamber/cartridge/slot) - * @param modSlot e.g patron_in_weapon - * @param parentTemplate item template - * @returns Slot item - */ - protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; - /** - * With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - * Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - * Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - * This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" - * @param items The items where the CylinderMagazine's camora are appended to - * @param modPool modPool which should include available cartrigdes - * @param parentId The CylinderMagazine's UID - * @param parentTemplate The CylinderMagazine's template - */ - protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; - /** - * Take a record of camoras and merge the compatable shells into one array - * @param camorasWithShells camoras we want to merge into one array - * @returns string array of shells fro luitple camora sources - */ - protected mergeCamoraPoolsTogether(camorasWithShells: Record): string[]; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability @@ -209,6 +29,14 @@ export declare class BotGeneratorHelper { generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; + /** + * Get the chance for the weapon attachment or helmet equipment to be set as activated + * @param botRole role of bot with weapon/helmet + * @param setting the setting of the weapon attachment/helmet equipment to be activated + * @param defaultValue default value for the chance of activation if the botrole or bot equipment role is null + * @returns Percent chance to be active + */ + protected getBotEquipmentSettingFromConfig(botRole: string, setting: keyof EquipmentFilters, defaultValue: number): number; /** * Create a repairable object for a weapon that containers durability + max durability properties * @param itemTemplate weapon object being generated for @@ -224,22 +52,16 @@ export declare class BotGeneratorHelper { */ protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** - * Get a random mod from an items compatible mods Filter array - * @param modTpl ???? - * @param parentSlot item mod will go into, used to get combatible items - * @param modSlot Slot to get mod to fill - * @param items items to ensure picked mod is compatible with - * @returns item tpl - */ - protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; - /** - * Can an item be added to an item without issue - * @param items items to check compatiblilities with - * @param tplToCheck tpl of the item to check for incompatibilities + * Can item be added to another item without conflict + * @param items Items to check compatiblilities with + * @param tplToCheck Tpl of the item to check for incompatibilities * @param equipmentSlot Slot the item will be placed into - * @returns false if no incompatibilties + * @returns false if no incompatibilties, also has incompatibility reason */ - isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): { + incompatible: boolean; + reason: string; + }; /** * Convert a bots role to the equipment role used in config/bot.json * @param botRole Role to convert diff --git a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts index a7f779e..9a43b8e 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts @@ -1,5 +1,6 @@ +import { MinMax } from "../models/common/MinMax"; import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType"; -import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, IBotConfig, RandomisationDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -59,4 +60,29 @@ export declare class BotHelper { * @returns true if should be a pmc */ shouldBotBePmc(botRole: string): boolean; + rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean; + botRoleIsPmc(botRole: string): boolean; + /** + * Get randomisation settings for bot from config/bot.json + * @param botLevel level of bot + * @param botEquipConfig bot equipment json + * @returns RandomisationDetails + */ + getBotRandomisationDetails(botLevel: number, botEquipConfig: EquipmentFilters): RandomisationDetails; + /** + * Choose between sptBear and sptUsec at random based on the % defined in botConfig.pmc.isUsec + * @returns pmc role + */ + getRandomisedPmcRole(): string; + /** + * Get the corrisponding side when sptBear or sptUsec is passed in + * @param botRole role to get side for + * @returns side (usec/bear) + */ + getPmcSideByRole(botRole: string): string; + /** + * Get a randomised PMC side based on bot config value 'isUsec' + * @returns pmc side as string + */ + protected getRandomisedPmcSide(): string; } diff --git a/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts index 7e25f56..b087fa9 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotWeaponGeneratorHelper.d.ts @@ -4,6 +4,7 @@ import { Item } from "../models/eft/common/tables/IItem"; import { Grid, ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ContainerHelper } from "./ContainerHelper"; @@ -16,8 +17,9 @@ export declare class BotWeaponGeneratorHelper { protected randomUtil: RandomUtil; protected hashUtil: HashUtil; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected containerHelper: ContainerHelper; - constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper); + constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, localisationService: LocalisationService, containerHelper: ContainerHelper); /** * Get a randomised number of bullets for a specific magazine * @param magCounts min and max count of magazines diff --git a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts index 88a726e..8f03b81 100644 --- a/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/DialogueHelper.d.ts @@ -4,6 +4,7 @@ import { MessageType } from "../models/enums/MessageType"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { ItemHelper } from "./ItemHelper"; import { NotificationSendHelper } from "./NotificationSendHelper"; @@ -15,8 +16,9 @@ export declare class DialogueHelper { protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected notificationSendHelper: NotificationSendHelper; + protected localisationService: LocalisationService; protected itemHelper: ItemHelper; - constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper); + constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper); createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent; /** * Add a templated message to the dialogue. diff --git a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts index fa25eff..f502c95 100644 --- a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts @@ -1,4 +1,4 @@ -import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; export declare class GameEventHelper { @@ -6,24 +6,4 @@ export declare class GameEventHelper { 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[]; - /** - * Is detection of seasonal events enabled (halloween / christmas) - * @returns true if seasonal events should be checked for - */ - isAutomaticEventDetectionEnabled(): boolean; - /** - * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween - * @param eventName Name of event to get gear changes for - * @returns bots with equipment changes - */ - getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts index 1ab7800..aa329a9 100644 --- a/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HandbookHelper.d.ts @@ -11,6 +11,7 @@ export declare class LookupCollection { } export declare class HandbookHelper { protected databaseServer: DatabaseServer; + protected lookupCacheGenerated: boolean; protected handbookPriceCache: LookupCollection; constructor(databaseServer: DatabaseServer); hydrateLookup(): void; @@ -35,18 +36,18 @@ export declare class HandbookHelper { isCategory(category: string): boolean; childrenCategories(x: string): string[]; /** - * Convert currency into roubles - * @param {number} value - * @param {string} currencyFrom - * @returns get rouble value of inputted currency - */ - inRUB(value: number, currencyFrom: string): number; - /** - * Gets Ruble to Currency conversion Value - * @param {number} value - * @param {string} currencyTo - * @returns number + * Convert non-roubles into roubles + * @param nonRoubleCurrencyCount Currency count to convert + * @param currencyTypeFrom What current currency is + * @returns Count in roubles */ - fromRUB(value: number, currencyTo: string): number; + inRUB(nonRoubleCurrencyCount: number, currencyTypeFrom: string): number; + /** + * Convert roubles into another currency + * @param roubleCurrencyCount roubles to convert + * @param currencyTypeTo Currency to convert roubles into + * @returns currency count in desired type + */ + fromRUB(roubleCurrencyCount: number, currencyTypeTo: string): number; } export {}; diff --git a/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts index 3116c9c..50b7559 100644 --- a/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Effect } from "../models/eft/health/Effect"; import { ISyncHealthRequestData } from "../models/eft/health/ISyncHealthRequestData"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IHealthConfig } from "../models/spt/config/IHealthConfig"; @@ -46,6 +47,6 @@ export declare class HealthHelper { * @param effectBodyPart body part to edit * @param effectType Effect to add to body part */ - protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: string): void; + protected addEffect(pmcData: IPmcData, effectBodyPart: string, effectType: Effect): void; protected isEmpty(map: any): boolean; } diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index 962df38..c7b7329 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; @@ -16,8 +17,9 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected profileFixerService: ProfileFixerService; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService); /** * Check an array of items and add an upd object to money items with a stack count of 1 * Single stack money items have no upd object and thus no StackObjectsCount, causing issues diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index fc88a46..9639923 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -5,12 +5,15 @@ import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; import { RandomUtil } from "../utils/RandomUtil"; +import { HandbookHelper } from "./HandbookHelper"; declare class ItemHelper { protected logger: ILogger; protected hashUtil: HashUtil; @@ -19,8 +22,11 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; + protected handbookHelper: HandbookHelper; + protected itemBaseClassService: ItemBaseClassService; + protected localisationService: LocalisationService; protected localeService: LocaleService; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -31,10 +37,17 @@ declare class ItemHelper { * Check if the tpl / template Id provided is a descendent of the baseclass * * @param {string} tpl the item template id to check - * @param {string} baseclassTpl the baseclass to check for + * @param {string} baseClassTpl the baseclass to check for * @return {boolean} is the tpl a descendent? */ - isOfBaseclass(tpl: string, baseclassTpl: string): boolean; + isOfBaseclass(tpl: string, baseClassTpl: string): boolean; + /** + * Check if item has any of the supplied base clases + * @param tpl Item to check base classes of + * @param baseClassTpls base classes to check for + * @returns true if any supplied base classes match + */ + isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean; /** * Returns the item price based on the handbook or as a fallback from the prices.json if the item is not * found in the handbook. If the price can't be found at all return 0 @@ -179,7 +192,7 @@ declare class ItemHelper { */ replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): any[]; /** - * Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + * WARNING, SLOW. Recursivly loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do * @param {string} tpl * @param {Array} tplsToCheck * @returns boolean diff --git a/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts index a469582..cea210e 100644 --- a/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/PresetHelper.d.ts @@ -5,8 +5,10 @@ export declare class PresetHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected lookup: Record; + protected defaultPresets: Record; constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); hydratePresetStore(input: Record): void; + getDefaultPresets(): Record; isPreset(id: string): boolean; hasPreset(templateId: string): boolean; getPreset(id: string): Preset; diff --git a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts index 9c6560a..7c1b12a 100644 --- a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts @@ -5,7 +5,6 @@ import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNic import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; -import { FenceService } from "../services/FenceService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -20,9 +19,13 @@ export declare class ProfileHelper { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected profileSnapshotService: ProfileSnapshotService; - protected fenceService: FenceService; - constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; + /** + * Get all profiles from server + * @returns Dictionary of profiles + */ + getProfiles(): Record; getCompleteProfile(sessionID: string): IPmcData[]; /** * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index edbd2e1..6bd1444 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -10,6 +10,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -32,10 +33,11 @@ export declare class QuestHelper { protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); /** * Get status of a quest by quest id * @param pmcData Profile to search @@ -66,12 +68,12 @@ export declare class QuestHelper { * @param progressAmount Amount of skill points to add to skill */ rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; - getQuestLocale(questId: string): any; /** - * Debug Routine for showing some information on the - * quest list in question. + * Get quest name by quest id + * @param questId id to get + * @returns */ - dumpQuests(quests: any): void; + getQuestNameFromLocale(questId: string): string; /** * Check if trader has sufficient loyalty to fullfill quest requirement * @param questProperties Quest props diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts index b73f786..95be986 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, 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[]; + getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; /** * Check if trader offers' BuyRestrictionMax value has been reached @@ -64,5 +64,5 @@ export declare class RagfairOfferHelper { protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; - isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + isDisplayableOffer(info: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; } diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts index 91b8a20..60809b5 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts @@ -11,7 +11,21 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Get the percent chance to sell an item based on its average listed price vs player chosen listing price + * @param baseChancePercent Base chance to sell item + * @param averageOfferPriceRub Price of average offer in roubles + * @param playerListedPriceRub Price player listed item for in roubles + * @returns percent value + */ + calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + /** + * Get percent chance to sell an item when price is below items average listing price + * @param playerListedPriceRub Price player listed item for in roubles + * @param averageOfferPriceRub Price of average offer in roubles + * @returns percent value + */ + protected getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub: number, playerListedPriceRub: number): number; /** * Determine if the offer being listed will be sold * @param sellChancePercent chance item will sell diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts index ec388d8..bfe6cc3 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts @@ -42,7 +42,7 @@ export declare class RagfairServerHelper { protected isItemBlacklisted(itemTemplateId: string): boolean; isTrader(userID: string): boolean; isPlayer(userID: string): boolean; - returnItems(sessionID: string, items: any[]): void; + returnItems(sessionID: string, items: Item[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; /** * Choose a currency at random with bias diff --git a/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts index 5b09320..9983d4d 100644 --- a/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RepairHelper.d.ts @@ -15,7 +15,7 @@ export declare class RepairHelper { protected repairConfig: IRepairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * + * Alter an items durability after a repair by trader/repair kit * @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 diff --git a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts index 2a8f0b7..94ec382 100644 --- a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts @@ -6,8 +6,10 @@ import { Item, Upd } from "../models/eft/common/tables/IItem"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTradeRequestData"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; import { RagfairServer } from "../servers/RagfairServer"; import { FenceService } from "../services/FenceService"; import { PaymentService } from "../services/PaymentService"; @@ -20,7 +22,9 @@ export declare class TradeHelper { protected fenceService: FenceService; protected inventoryHelper: InventoryHelper; protected ragfairServer: RagfairServer; - constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer); + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer); /** * Buy item from flea or trader * @param pmcData @@ -33,7 +37,7 @@ export declare class TradeHelper { buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; /** * Sell item to trader - * @param pmcData + * @param pmcData Profile to update * @param body * @param sessionID * @returns diff --git a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts index 025efd6..c3915c6 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts @@ -7,7 +7,9 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { TraderAssortService } from "../services/TraderAssortService"; +import { TraderPurchasePersisterService } from "../services/TraderPurchasePersisterService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -27,11 +29,13 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected localisationService: LocalisationService; + protected traderPurchasePersisterService: TraderPurchasePersisterService; protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, localisationService: LocalisationService, traderPurchasePersisterService: TraderPurchasePersisterService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index 0dc93e8..62a3492 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; @@ -23,11 +24,12 @@ export declare class TraderHelper { protected itemHelper: ItemHelper; protected handbookHelper: HandbookHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -53,19 +55,26 @@ export declare class TraderHelper { getPurchasesData(traderID: string, sessionID: string): Record; /** * Should item be skipped when selling to trader according to its sell categories and other checks - * @param pmcData - * @param item - * @param sellCategory + * @param pmcData Profile + * @param item Item to be checked is sellable to trader + * @param sellCategory categories trader will buy + * @param traderId Trader item is being checked can be sold to * @returns true if should NOT be sold to trader */ - protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[], traderId: string): boolean; /** - * Can this weapon be sold to a trader with its current durabiltiy level - * @param traderID - * @param item - * @returns boolean + * Check if item has durability so low it precludes it from being sold to the trader (inclusive) + * @param item Item to check durability of + * @param traderId Trader item is sold to + * @returns */ - protected isWeaponBelowTraderBuyDurability(traderID: string, item: Item): boolean; + protected itemIsBelowSellableDurabilityThreshhold(item: Item, traderId: string): boolean; + /** + * Get the percentage threshold value a trader will buy armor/weapons above + * @param traderId Trader to look up + * @returns percentage + */ + protected getTraderDurabiltyPurchaseThreshold(traderId: string): number; /** * Get the price of an item and all of its attached children * Take into account bonuses/adjsutments e.g. discounts @@ -113,10 +122,22 @@ export declare class TraderHelper { getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader - * @param traderFilters array of allowed categories + * @param categoriesTraderBuys array of allowed categories * @param tplToCheck itemTpl of inventory - * @returns boolean + * @returns boolean if item can be sold to trader */ - traderFilter(traderFilters: string[], tplToCheck: string): boolean; + doesTraderBuyItem(categoriesTraderBuys: string[], tplToCheck: string): boolean; getLoyaltyLevel(traderID: string, pmcData: IPmcData): LoyaltyLevel; + /** + * Store the purchase of an assort from a trader in the player profile + * @param sessionID Session id + * @param newPurchaseDetails New item assort id + count + */ + addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: { + items: { + item_id: string; + count: number; + }[]; + tid: string; + }): void; } diff --git a/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts index 5101b7b..87b60f9 100644 --- a/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PostDBModLoader.d.ts @@ -4,7 +4,7 @@ import { PreAkiModLoader } from "./PreAkiModLoader"; export declare class PostDBModLoader implements OnLoad { protected preAkiModLoader: PreAkiModLoader; constructor(preAkiModLoader: PreAkiModLoader); - onLoad(): void; + onLoad(): Promise; getRoute(): string; getModPath(mod: string): string; protected executeMods(container: DependencyContainer): void; diff --git a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts index f486a28..212aaf3 100644 --- a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts @@ -34,6 +34,7 @@ export declare class PreAkiModLoader implements IModLoader { * @returns Array of mod names in load order */ getImportedModsNames(): string[]; + getImportedModDetails(): Record; getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; diff --git a/TypeScript/9RouterHooks/types/models/eft/bot/IRandomisedBotLevelResult.d.ts b/TypeScript/9RouterHooks/types/models/eft/bot/IRandomisedBotLevelResult.d.ts new file mode 100644 index 0000000..75bd936 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/bot/IRandomisedBotLevelResult.d.ts @@ -0,0 +1,4 @@ +export interface IRandomisedBotLevelResult { + level: number; + exp: number; +} 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 2b418c1..1c28ae0 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -107,7 +107,6 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { - discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts index 55b4bd9..e02d990 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts @@ -57,6 +57,10 @@ export interface ModsChances { mod_pistol_grip: number; mod_reciever: number; mod_scope: number; + mod_scope_000: number; + mod_scope_001: number; + mod_scope_002: number; + mod_scope_003: number; mod_sight_front: number; mod_sight_rear: number; mod_stock: number; @@ -152,4 +156,4 @@ export interface Items { SpecialLoot: string[]; TacticalVest: string[]; } -export declare type Mods = Record>; +export type Mods = Record>; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts index c5b1cb2..d538126 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IQuest.d.ts @@ -37,7 +37,7 @@ export interface Conditions { export interface AvailableForConditions { _parent: string; _props: AvailableForProps; - dynamicLocale: boolean; + dynamicLocale?: boolean; } export interface AvailableForProps { id: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts index e23ec73..6a02958 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -25,7 +25,7 @@ export interface IPmcDataRepeatableQuest { endTime: number; changeRequirement: TChangeRequirementRecord; } -export declare type TChangeRequirementRecord = Record; +export type TChangeRequirementRecord = Record; export interface IChangeRequirement { changeCost: IChangeCost[]; changeStandingCost: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts index 37b2d61..246a5b8 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts @@ -54,8 +54,9 @@ export interface Repair { currency: string; currency_coefficient: number; excluded_category: string[]; + /** Doesn't exist in client object */ excluded_id_list: any[]; - quality: string; + quality: number; } export interface ITraderAssort { nextResupply: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts index fe6888c..cbb909d 100644 --- a/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -1,4 +1,4 @@ export interface IGetSuitsResponse { _id: string; - suits: string[]; + suites: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/eft/dialog/IChatServer.d.ts b/TypeScript/9RouterHooks/types/models/eft/dialog/IChatServer.d.ts new file mode 100644 index 0000000..48cacc4 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/dialog/IChatServer.d.ts @@ -0,0 +1,16 @@ +export interface IChatServer { + _id: string; + RegistrationId: number; + VersionId: string; + Ip: string; + Port: number; + DateTime: number; + Chats: IChat[]; + Regions: string[]; + /** Possibly removed */ + IsDeveloper?: boolean; +} +export interface IChat { + _id: string; + Members: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/dialog/IGetFriendListDataResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/dialog/IGetFriendListDataResponse.d.ts index 8a29319..f8d700c 100644 --- a/TypeScript/9RouterHooks/types/models/eft/dialog/IGetFriendListDataResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/dialog/IGetFriendListDataResponse.d.ts @@ -1,7 +1,7 @@ import { MemberCategory } from "../../enums/MemberCategory"; export interface IGetFriendListDataResponse { Friends: Friend[]; - Ignore: any[]; + Ignore: string[]; InIgnoreList: string[]; } export interface Friend { diff --git a/TypeScript/9RouterHooks/types/models/eft/game/IGameConfigResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/game/IGameConfigResponse.d.ts index eb37a39..e1b7587 100644 --- a/TypeScript/9RouterHooks/types/models/eft/game/IGameConfigResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/game/IGameConfigResponse.d.ts @@ -7,11 +7,13 @@ export interface IGameConfigResponse { activeProfileId: string; backend: Backend; utc_time: number; + /** Total in game time */ totalInGame: number; reportAvailable: boolean; twitchEventMember: boolean; } export interface Backend { + Lobby: string; Trading: string; Messaging: string; Main: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts index ce878be..9295fb1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/hideout/IHideoutProduction.d.ts @@ -3,7 +3,7 @@ export interface IHideoutProduction { areaType: number; requirements: Requirement[]; productionTime: number; - boosters: any; + boosters?: any; endProduct: string; continuous: boolean; count: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts b/TypeScript/9RouterHooks/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts index bf209c6..4579fdb 100644 --- a/TypeScript/9RouterHooks/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/insurance/IGetInsuranceCostResponseData.d.ts @@ -1 +1 @@ -export declare type IGetInsuranceCostResponseData = Record>; +export type IGetInsuranceCostResponseData = Record>; diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts index 53db97a..61516d6 100644 --- a/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IAddItemRequestData.d.ts @@ -1,4 +1,9 @@ export interface IAddItemRequestData { tid: string; - items: any[]; + items: AddItem[]; +} +export interface AddItem { + count: number; + isPreset?: boolean; + item_id: string; } diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts index b45e459..6d7c190 100644 --- a/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IInventoryBaseActionRequestData.d.ts @@ -16,7 +16,7 @@ export interface ToLocation { export interface Container { id: string; container: string; - location: Location | number; + location?: Location | number; } export interface Location { x: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 60ab284..6b18df3 100644 --- a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -7,7 +7,7 @@ export interface IItemEventRouterBase { warnings: Warning[]; profileChanges: TProfileChanges | ""; } -export declare type TProfileChanges = Record; +export type TProfileChanges = Record; export interface Warning { index: number; errmsg: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/launcher/IRemoveProfileData.d.ts b/TypeScript/9RouterHooks/types/models/eft/launcher/IRemoveProfileData.d.ts index d31c9ac..4cc5618 100644 --- a/TypeScript/9RouterHooks/types/models/eft/launcher/IRemoveProfileData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/launcher/IRemoveProfileData.d.ts @@ -1,2 +1,2 @@ import { ILoginRequestData } from "./ILoginRequestData"; -export declare type IRemoveProfileData = ILoginRequestData; +export type IRemoveProfileData = ILoginRequestData; diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts index cf28c12..2cea0c8 100644 --- a/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IAkiProfile.d.ts @@ -11,6 +11,12 @@ export interface IAkiProfile { vitality: Vitality; inraid: Inraid; insurance: Insurance[]; + /** Assort purchases made by player since last trader refresh */ + traderPurchases?: Record>; +} +export declare class TraderPurchaseData { + count: number; + purchaseTimestamp: number; } export interface Info { id: string; @@ -93,6 +99,13 @@ export interface DateTime { } export interface Aki { version: string; + mods?: ModDetails[]; +} +export interface ModDetails { + name: string; + version: string; + author: string; + dateAdded: number; } export interface Vitality { health: Health; diff --git a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts index 4eb6f7e..7d11510 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BaseClasses.d.ts @@ -8,6 +8,8 @@ export declare enum BaseClasses { BACKPACK = "5448e53e4bdc2d60728b4567", VISORS = "5448e5724bdc2ddf718b4568", FOOD = "5448e8d04bdc2ddf718b4569", + GAS_BLOCK = "56ea9461d2720b67698b456f", + RAIL_COVER = "55818b1d4bdc2d5b648b4572", DRINK = "5448e8d64bdc2dce718b4568", BARTER_ITEM = "5448eb774bdc2d0a728b4567", INFO = "5448ecbe4bdc2d60728b4568", @@ -36,6 +38,7 @@ export declare enum BaseClasses { THROW_WEAPON = "543be6564bdc2df4348b4568", FOOD_DRINK = "543be6674bdc2df1348b4569", PISTOL = "5447b5cf4bdc2d65278b4567", + REVOLVER = "617f1ef5e8b54b0998387733", SMG = "5447b5e04bdc2d62278b4567", ASSAULT_RIFLE = "5447b5f14bdc2d61278b4567", ASSAULT_CARBINE = "5447b5fc4bdc2d87278b4567", @@ -73,9 +76,10 @@ export declare enum BaseClasses { TACTICAL_COMBO = "55818b164bdc2ddc698b456c", FLASHLIGHT = "55818b084bdc2d5b648b4571", MAGAZINE = "5448bc234bdc2d3c308b4569", - LIGHT_LASER = "55818b0e4bdc2dde698b456e", + LIGHT_LASER_DESIGNATOR = "55818b0e4bdc2dde698b456e", FLASH_HIDER = "550aa4bf4bdc2dd6348b456b", COLLIMATOR = "55818ad54bdc2ddc698b4569", + IRON_SIGHT = "55818ac54bdc2d5b648b456e", COMPACT_COLLIMATOR = "55818acf4bdc2dde698b456b", COMPENSATOR = "550aa4af4bdc2dd4348b456e", OPTIC_SCOPE = "55818ae44bdc2dde698b456c", diff --git a/TypeScript/9RouterHooks/types/models/enums/ExitStatis.d.ts b/TypeScript/9RouterHooks/types/models/enums/ExitStatis.d.ts new file mode 100644 index 0000000..78d9733 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/ExitStatis.d.ts @@ -0,0 +1,7 @@ +export declare enum ExitStatus { + SURVIVED = 0, + KILLED = 1, + LEFT = 2, + RUNNER = 3, + MISSINGINACTION = 4 +} diff --git a/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts b/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts index 3b4a56a..64a37d6 100644 --- a/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/HttpFramework.d.ts @@ -1,6 +1,6 @@ /// import { IncomingMessage, ServerResponse } from "http"; -export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +export 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 diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts new file mode 100644 index 0000000..26571a2 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/bots/BotGenerationDetails.d.ts @@ -0,0 +1,18 @@ +export interface BotGenerationDetails { + /** Should the bot be generated as a PMC */ + isPmc: boolean; + /** assault/pmcBot etc */ + role: string; + /** Side of bot */ + side: string; + /** Active players current level */ + playerLevel: number; + /** Delta of highest level of bot */ + botRelativeLevelDeltaMax: number; + /** How many to create and store */ + botCountToGenerate: number; + /** Desired difficulty of the bot */ + botDifficulty: string; + /** Will the generated bot be a player scav */ + isPlayerScav: boolean; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/callbacks/IDataCallbacks.d.ts b/TypeScript/9RouterHooks/types/models/spt/callbacks/IDataCallbacks.d.ts index a098560..b4f4f8c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/callbacks/IDataCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/callbacks/IDataCallbacks.d.ts @@ -6,7 +6,6 @@ import { IHideoutProduction } from "../../eft/hideout/IHideoutProduction"; import { IHideoutScavCase } from "../../eft/hideout/IHideoutScavCase"; import { IHideoutSettingsBase } from "../../eft/hideout/IHideoutSettingsBase"; import { IGetBodyResponseData } from "../../eft/httpResponse/IGetBodyResponseData"; -import { ILanguageBase } from "../server/ILocaleBase"; import { ISettingsBase } from "../server/ISettingsBase"; export interface IDataCallbacks { getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -20,7 +19,7 @@ export interface IDataCallbacks { getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts index d6fa5e0..4b1a621 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts @@ -66,10 +66,11 @@ export interface LootNvalue { } export interface EquipmentFilters { weaponModLimits: ModLimits; - randomisedWeaponModSlots?: string[]; - randomisedArmorSlots?: string[]; + weaponSightWhitelist: Record; faceShieldIsActiveChancePercent?: number; lightLaserIsActiveChancePercent?: number; + nvgIsActiveChancePercent?: number; + randomisation: RandomisationDetails[]; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; clothing: WeightingAdjustmentDetails[]; @@ -81,6 +82,15 @@ export interface ModLimits { /** How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT */ lightLaserLimit?: number; } +export interface RandomisationDetails { + levelRange: MinMax; + randomisedWeaponModSlots?: string[]; + randomisedArmorSlots?: string[]; + /** Equipment chances */ + equipment?: Record; + /** Modc chances */ + mods?: Record; +} export interface EquipmentFilterDetails { levelRange: MinMax; equipment: Record; @@ -88,6 +98,11 @@ export interface EquipmentFilterDetails { } export interface WeightingAdjustmentDetails { levelRange: MinMax; + ammo?: AdjustmentDetails; + equipment?: AdjustmentDetails; + clothing?: AdjustmentDetails; +} +export interface AdjustmentDetails { add: Record>; edit: Record>; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts index 0551d57..a012fae 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILocationConfig.d.ts @@ -1,8 +1,16 @@ +import { BossLocationSpawn, Wave } from "../../../models/eft/common/ILocationBase"; import { IBaseConfig } from "./IBaseConfig"; export interface ILocationConfig extends IBaseConfig { kind: "aki-location"; looseLootMultiplier: LootMultiplier; staticLootMultiplier: LootMultiplier; + customWaves: CustomWaves; + /** Open zones to add to map */ + openZones: Record; +} +export interface CustomWaves { + boss: Record; + normal: Record; } export interface LootMultiplier { bigmap: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts index 48601b2..979122c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts @@ -16,6 +16,7 @@ export interface IPmcConfig { maxVestLootTotalRub: number; convertIntoPmcChance: Record; enemyTypes: string[]; + botRelativeLevelDeltaMax: number; } export interface PmcTypes { usec: string; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts index 45c9aae..951f1a7 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts @@ -4,6 +4,7 @@ export interface IQuestConfig extends IBaseConfig { kind: "aki-quest"; redeemTime: number; repeatableQuests: IRepeatableQuestConfig[]; + locationIdMap: Record; bearOnlyQuests: string[]; usecOnlyQuests: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts index 8342c99..b1ec484 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts @@ -1,10 +1,13 @@ +import { MinMax } from "../../../models/common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface ITraderConfig extends IBaseConfig { kind: "aki-trader"; updateTime: UpdateTime[]; updateTimeDefault: number; + /** What % of max durability an item needs to sell to a trader*/ + durabilityPurchaseThreshhold: Record; traderPriceMultipler: number; - minDurabilityForSale: number; + persistPurchaseDataInProfile: boolean; fence: FenceConfig; } export interface UpdateTime { @@ -17,6 +20,8 @@ export interface FenceConfig { assortSize: number; maxPresetsPercent: number; presetPriceMult: number; + armorMaxDurabilityPercentMinMax: MinMax; + presetMaxDurabilityPercentMinMax: MinMax; itemPriceMult: number; regenerateAssortsOnRefresh: boolean; itemTypeLimits: Record; diff --git a/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts index 6e20b89..3cdaf6f 100644 --- a/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts @@ -1,49 +1,5 @@ export interface ILocaleBase { - global: Record; + global: Record>; menu: Record; - languages: ILanguageBase[]; -} -export interface ILocaleGlobalBase { - interface: Record; - enum: any[]; - mail: Record; - quest: Record; - preset: Record; - handbook: Record; - season: Record; - customization: Record; - repeatableQuest: Record; - templates: Record; - locations: Record; - banners: Record; - trading: Record; -} -export interface ILocaleQuest { - name: string; - description: string; - note: string; - failMessageText: string; - startedMessageText: string; - successMessageText: string; - conditions: Record; - location: string; -} -export interface ILocalePreset { - Name: string; -} -export interface ILocaleProps { - Name: string; - ShortName: string; - Description: string; -} -export interface ILocaleTradingProps { - FullName: string; - FirstName: string; - Nickname: string; - Location: string; - Description: string; -} -export interface ILanguageBase { - ShortName: string; - Name: string; + languages: Record; } diff --git a/TypeScript/9RouterHooks/types/models/spt/server/ISettingsBase.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/ISettingsBase.d.ts index c067cda..625ad5c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/server/ISettingsBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/server/ISettingsBase.d.ts @@ -11,6 +11,7 @@ export interface Config { FramerateLimit: FramerateLimit; GroupStatusInterval: number; KeepAliveInterval: number; + LobbyKeepAliveInterval: number; Mark502and504AsNonImportant: boolean; MemoryManagementSettings: MemoryManagementSettings; NVidiaHighlights: boolean; @@ -18,7 +19,10 @@ export interface Config { PingServerResultSendInterval: number; PingServersInterval: number; ReleaseProfiler: ReleaseProfiler; + RequestConfirmationTimeouts: number[]; + RequestsMadeThroughLobby: string[]; SecondCycleDelaySeconds: number; + ShouldEstablishLobbyConnection: boolean; TurnOffLogging: boolean; WeaponOverlapDistanceCulling: number; WebDiagnosticsEnabled: boolean; diff --git a/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts index e80d16c..a9338ab 100644 --- a/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/ItemEventRouter.d.ts @@ -1,14 +1,16 @@ -import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ProfileHelper } from "../helpers/ProfileHelper"; import { ItemEventRouterDefinition } from "../di/Router"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { EventOutputHolder } from "./EventOutputHolder"; export declare class ItemEventRouter { protected logger: ILogger; protected profileHelper: ProfileHelper; protected itemEventRouters: ItemEventRouterDefinition[]; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], eventOutputHolder: EventOutputHolder); + constructor(logger: ILogger, profileHelper: ProfileHelper, itemEventRouters: ItemEventRouterDefinition[], localisationService: LocalisationService, eventOutputHolder: EventOutputHolder); handleEvents(info: IItemEventRouterRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts b/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts index c93864b..f49654a 100644 --- a/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts @@ -4,6 +4,7 @@ import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairRequiredItemsService } from "../services/RagfairRequiredItemsService"; @@ -14,13 +15,14 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected localisationService: LocalisationService; protected traderHelper: TraderHelper; protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); - load(): void; - update(): void; + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, localisationService: LocalisationService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); + load(): Promise; + update(): Promise; /** * Get traders who need to be periodically refreshed * @returns string array of traders diff --git a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts index ae72cc3..ef3b504 100644 --- a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts @@ -1,21 +1,41 @@ -import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; +import { BotHelper } from "../helpers/BotHelper"; +import { EquipmentChances, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; +import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; + protected botHelper: BotHelper; protected configServer: ConfigServer; protected botConfig: IBotConfig; protected botEquipmentConfig: Record; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, botHelper: BotHelper, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig * @param baseBotNode bots json data to filter - * @param playerLevel Level of the currently playing player - * @param isPmc Is the bot we're filtering a PMC - * @param role Role of the bot we're filtering + * @param botLevel Level of the bot + * @param botGenerationDetails details on how to generate a bot */ - filterBotEquipment(baseBotNode: IBotType, playerLevel: number, isPmc: boolean, role: string): void; + filterBotEquipment(baseBotNode: IBotType, botLevel: number, botGenerationDetails: BotGenerationDetails): void; + /** + * Iterate over the changes passed in and alter data in baseValues + * @param equipmentChanges Changes to apply + * @param baseValues Values to update + */ + protected adjustChances(equipmentChanges: Record, baseValues: EquipmentChances | ModsChances): void; + /** + * Get equipment settings for bot + * @param botEquipmentRole equipment role to return + * @returns EquipmentFilters object + */ + getBotEquipmentSettings(botEquipmentRole: string): EquipmentFilters; + /** + * Get weapon sight whitelist for a specific bot type + * @param botEquipmentRole equipment role of bot to look up + * @returns Dictionary of weapon type and their whitelisted scope types + */ + getBotWeaponSightWhitelist(botEquipmentRole: string): Record; /** * Get an object that contains equipment and cartridge blacklists for a specified bot type * @param botRole Role of the bot we want the blacklist for @@ -66,5 +86,5 @@ export declare class BotEquipmentFilterService { * @param weightingAdjustments Weighting change to apply to bot * @param botItemPool Bot item dictionary to adjust */ - protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; + protected adjustWeighting(weightingAdjustments: AdjustmentDetails, botItemPool: Record, showEditWarnings?: boolean): void; } diff --git a/TypeScript/9RouterHooks/types/services/BotEquipmentModPoolService.d.ts b/TypeScript/9RouterHooks/types/services/BotEquipmentModPoolService.d.ts new file mode 100644 index 0000000..adf59ff --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/BotEquipmentModPoolService.d.ts @@ -0,0 +1,65 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Mods } from "../models/eft/common/tables/IBotType"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { VFS } from "../utils/VFS"; +/** Store a mapping between weapons, their slots and the items that fit those slots */ +export declare class BotEquipmentModPoolService { + protected logger: ILogger; + protected vfs: VFS; + protected itemHelper: ItemHelper; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + protected weaponModPool: Mods; + protected gearModPool: Mods; + protected weaponPoolGenerated: boolean; + protected armorPoolGenerated: boolean; + constructor(logger: ILogger, vfs: VFS, itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Store dictionary of mods for each item passed in + * @param items items to find related mods and store in modPool + */ + protected generatePool(items: ITemplateItem[], poolType: string): void; + /** + * Empty the mod pool + */ + resetPool(): void; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsForWeaponSlot(itemTpl: string, slotName: string): string[]; + /** + * Get array of compatible mods for an items mod slot (generate pool if it doesnt exist already) + * @param itemTpl item to look up + * @param slotName slot to get compatible mods for + * @returns tpls that fit the slot + */ + getCompatibleModsFoGearSlot(itemTpl: string, slotName: string): string[]; + /** + * Get mods for a piece of gear by its tpl + * @param itemTpl items tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForGearSlot(itemTpl: string): Record; + /** + * Get mods for a weapon by its tpl + * @param itemTpl Weapons tpl to look up mods for + * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value + */ + getModsForWeaponSlot(itemTpl: string): Record; + /** + * Create weapon mod pool and set generated flag to true + */ + protected generateWeaponPool(): void; + /** + * Create gear mod pool and set generated flag to true + */ + protected generateGearPool(): void; +} diff --git a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts index 0be0576..a491b03 100644 --- a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts @@ -3,32 +3,34 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class BotGenerationCacheService { protected logger: ILogger; protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected botHelper: BotHelper; protected storedBots: Map; - constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, localisationService: LocalisationService, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage * @param botsToStore Bots we want to store in the cache */ - storeBots(botsToStore: IBotBase[]): void; + storeBots(key: string, botsToStore: IBotBase[]): void; /** * Find and return a bot based on its role * Remove bot from internal array so it can't be retreived again - * @param role role to retreive (assault/bossTagilla etc) + * @param key role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase; + getBot(key: string): IBotBase; /** * Remove all cached bot profiles */ clearStoredBots(): void; /** - * Does cache have bots - * @returns true if empty + * Does cache have a bot with requested key + * @returns false if empty */ - cacheHasBotOfRole(role: string): boolean; + cacheHasBotOfRole(key: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts index 00ffb9c..dab7c6d 100644 --- a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts @@ -5,15 +5,17 @@ import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; + protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ diff --git a/TypeScript/9RouterHooks/types/services/BotWeaponModLimitService.d.ts b/TypeScript/9RouterHooks/types/services/BotWeaponModLimitService.d.ts new file mode 100644 index 0000000..f8ebc2f --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/BotWeaponModLimitService.d.ts @@ -0,0 +1,54 @@ +import { ItemHelper } from "../helpers/ItemHelper"; +import { Item } from "../models/eft/common/tables/IItem"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class BotModLimits { + scope: ItemCount; + scopeMax: number; + scopeBaseTypes: string[]; + flashlightLaser: ItemCount; + flashlightLaserMax: number; + flashlgihtLaserBaseTypes: string[]; +} +export declare class ItemCount { + count: number; +} +export declare class BotWeaponModLimitService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected itemHelper: ItemHelper; + protected botConfig: IBotConfig; + constructor(logger: ILogger, configServer: ConfigServer, itemHelper: ItemHelper); + /** + * Initalise mod limits to be used when generating a weapon + * @param botRole "assault", "bossTagilla" or "pmc" + * @returns BotModLimits object + */ + getWeaponModLimits(botRole: string): BotModLimits; + /** + * Check if weapon mod item is on limited list + has surpassed the limit set for it + * Exception: Always allow ncstar backup mount + * Exception: Always allow scopes with a scope for a parent + * Exception: Always disallow mounts that hold only scopes once scope limit reached + * Exception: Always disallow mounts that hold only flashlights once flashlight limit reached + * @param botRole role the bot has e.g. assault + * @param modTemplate mods template data + * @param modLimits limits set for weapon being generated for this bot + * @param modsParent The parent of the mod to be checked + * @returns true if over item limit + */ + weaponModHasReachedLimit(botRole: string, modTemplate: ITemplateItem, modLimits: BotModLimits, modsParent: ITemplateItem, weapon: Item[]): boolean; + /** + * Check if the specific item type on the weapon has reached the set limit + * @param modTpl log mod tpl if over type limit + * @param currentCount current number of this item on gun + * @param maxLimit mod limit allowed + * @param botRole role of bot we're checking weapon of + * @returns true if limit reached + */ + protected weaponModLimitReached(modTpl: string, currentCount: { + count: number; + }, maxLimit: number, botRole: string): boolean; +} diff --git a/TypeScript/9RouterHooks/types/services/CustomLocationWaveService.d.ts b/TypeScript/9RouterHooks/types/services/CustomLocationWaveService.d.ts new file mode 100644 index 0000000..7d14f07 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/CustomLocationWaveService.d.ts @@ -0,0 +1,42 @@ +import { BossLocationSpawn, Wave } from "../models/eft/common/ILocationBase"; +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +export declare class CustomLocationWaveService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + /** + * Add a boss wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Boss wave to add to map + */ + addBossWaveToMap(locationId: string, waveToAdd: BossLocationSpawn): void; + /** + * Add a normal bot wave to a map + * @param locationId e.g. factory4_day, bigmap + * @param waveToAdd Wave to add to map + */ + addNormalWaveToMap(locationId: string, waveToAdd: Wave): void; + /** + * Clear all custom boss waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearBossWavesForMap(locationId: string): void; + /** + * Clear all custom normal waves from a map + * @param locationId e.g. factory4_day, bigmap + */ + clearNormalWavesForMap(locationId: string): void; + /** + * Add custom boss and normal waves to maps found in config/location.json to db + */ + applyWaveChangesToAllMaps(): void; +} diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index bdcdeb2..cb20500 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -15,6 +15,7 @@ import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { ItemFilterService } from "./ItemFilterService"; +import { LocalisationService } from "./LocalisationService"; /** * Handle actions surrounding Fence * e.g. generating or refreshing assorts / get next refresh time @@ -30,11 +31,12 @@ export declare class FenceService { protected itemHelper: ItemHelper; protected presetHelper: PresetHelper; protected itemFilterService: ItemFilterService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; protected nextMiniRefreshTimestamp: number; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, localisationService: LocalisationService, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; /** * Get assorts player can purchase @@ -91,9 +93,9 @@ export declare class FenceService { */ getOfferCount(): number; /** - * Create a trader assort for fence + * Create trader assorts for fence and store in fenceService cache */ - generateFenceAssortCache(): void; + generateFenceAssorts(): void; /** * Create skeleton to hold assort items * @returns ITraderAssort object diff --git a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts index 6be8a2f..9328b54 100644 --- a/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/InsuranceService.d.ts @@ -1,4 +1,5 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; +import { HandbookHelper } from "../helpers/HandbookHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; @@ -12,6 +13,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class InsuranceService { protected logger: ILogger; protected databaseServer: DatabaseServer; @@ -21,14 +23,16 @@ export declare class InsuranceService { protected saveServer: SaveServer; protected traderHelper: TraderHelper; protected dialogueHelper: DialogueHelper; + protected handbookHelper: HandbookHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected insured: Record>; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, configServer: ConfigServer); insuranceExists(sessionId: string): boolean; insuranceTraderArrayExists(sessionId: string, traderId: string): boolean; getInsurance(sessionId: string): Record; - getInsuranceItems(sessionId: string, traderId: string): any[]; + getInsuranceItems(sessionId: string, traderId: string): Item[]; resetInsurance(sessionId: string): void; resetInsuranceTraderArray(sessionId: string, traderId: string): void; addInsuranceItemToArray(sessionId: string, traderId: string, itemToAdd: any): void; diff --git a/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts b/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts new file mode 100644 index 0000000..d7bc4bc --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/ItemBaseClassService.d.ts @@ -0,0 +1,39 @@ +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +/** + * Cache the baseids for each item in the tiems db inside a dictionary + */ +export declare class ItemBaseClassService { + protected logger: ILogger; + protected localisationService: LocalisationService; + protected databaseServer: DatabaseServer; + protected itemBaseClassesCache: Record; + protected cacheGenerated: boolean; + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); + /** + * Create cache and store inside ItemBaseClassService + */ + hydrateItemBaseClassCache(): void; + /** + * Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary + * @param itemIdToUpdate item tpl to store base ids against in dictionary + * @param item item being checked + * @param allDbItems all items in db + */ + protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem, allDbItems: Record): void; + /** + * Does item tpl inherit from the requested base class + * @param itemTpl item to check base classes of + * @param baseClass base class to check for + * @returns true if item inherits from base class passed in + */ + itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean; + /** + * Get base classes item inherits from + * @param itemTpl item to get base classes for + * @returns array of base classes + */ + getItemBaseClasses(itemTpl: string): string[]; +} diff --git a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts index 8275b75..09c658b 100644 --- a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts +++ b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts @@ -1,5 +1,4 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; -import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,9 +13,9 @@ export declare class LocaleService { constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - * @returns ILocaleGlobalBase + * @returns dictionary */ - getLocaleDb(): ILocaleGlobalBase; + getLocaleDb(): Record; /** * Gets the game locale key from the locale.json file, * if value is 'system' get system locale diff --git a/TypeScript/9RouterHooks/types/services/OpenZoneService.d.ts b/TypeScript/9RouterHooks/types/services/OpenZoneService.d.ts new file mode 100644 index 0000000..8e70b94 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/OpenZoneService.d.ts @@ -0,0 +1,28 @@ +import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { LocalisationService } from "./LocalisationService"; +/** Service for adding new zones to a maps OpenZones property */ +export declare class OpenZoneService { + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected configServer: ConfigServer; + protected locationConfig: ILocationConfig; + constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add open zone to specified map + * @param locationId map location (e.g. factory4_day) + * @param zoneToAdd zone to add + */ + addZoneToMap(locationId: string, zoneToAdd: string): void; + /** + * Add open zones to all maps found in config/location.json to db + */ + applyZoneChangesToAllMaps(): void; +} diff --git a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts index c9ce95a..26f1952 100644 --- a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts @@ -60,9 +60,9 @@ export declare class PaymentService { /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container - * @param a Firsat money stack item + * @param a First money stack item * @param b Second money stack item - * @returns sorted item + * @returns sort order */ - protected moneySort(a: Item, b: Item): number; + protected prioritiseStashSort(a: Item, b: Item): number; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts index 86c1e52..133e6a7 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts @@ -1,3 +1,4 @@ +import { RagfairOfferHolder } from "../utils/RagfairOfferHolder"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; @@ -26,10 +27,9 @@ export declare class RagfairOfferService { protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected expiredOffers: Item[]; - /** offerId, offer */ - protected offers: Record; + protected expiredOffers: Record; protected ragfairConfig: IRagfairConfig; + protected ragfairOfferHandler: RagfairOfferHolder; constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers @@ -45,7 +45,7 @@ export declare class RagfairOfferService { * Get an array of expired items not yet processed into new offers * @returns items that need to be turned into offers */ - getExpiredOffers(): Item[]; + getExpiredOfferItems(): Item[]; resetExpiredOffers(): void; /** * Does the offer exist on the ragfair @@ -64,12 +64,6 @@ export declare class RagfairOfferService { traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; - /** - * Get an array of stale offers that are still shown to player - * @returns IRagfairOffer array - */ - protected getStaleOffers(): IRagfairOffer[]; - protected isStale(offer: IRagfairOffer, time: number): boolean; protected processStaleOffer(staleOffer: IRagfairOffer): void; protected returnPlayerOffer(offer: IRagfairOffer): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts index 4ac7794..cf0459c 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts @@ -11,6 +11,9 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RandomUtil } from "../utils/RandomUtil"; import { OnLoad } from "../di/OnLoad"; +/** + * Stores flea prices for items as well as methods to interact with them + */ export declare class RagfairPriceService implements OnLoad { protected handbookHelper: HandbookHelper; protected databaseServer: DatabaseServer; @@ -24,12 +27,18 @@ export declare class RagfairPriceService implements OnLoad { protected generatedStaticPrices: boolean; protected prices: IRagfairServerPrices; constructor(handbookHelper: HandbookHelper, databaseServer: DatabaseServer, logger: ILogger, itemHelper: ItemHelper, presetHelper: PresetHelper, randomUtil: RandomUtil, configServer: ConfigServer); - onLoad(): void; + /** + * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + */ + onLoad(): Promise; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache */ generateStaticPrices(): void; + /** + * Create a dictionary and store prices from prices.json in it + */ protected generateDynamicPrices(): void; /** * Get the dynamic price for an item. If value doesn't exist, use static (handbook0) value. @@ -51,6 +60,10 @@ export declare class RagfairPriceService implements OnLoad { * @returns price in roubles */ getStaticPriceForItem(itemTpl: string): number; + /** + * Get prices for all items on flea, priorities dynamic prices from prices.json, use handbook prices if missing + * @returns Dictionary of item tpls and rouble cost + */ getAllFleaPrices(): Record; /** * Get the percentage difference between two values @@ -59,7 +72,18 @@ export declare class RagfairPriceService implements OnLoad { * @returns different in percent */ protected getPriceDifference(a: number, b: number): number; + /** + * Get the rouble price for an assorts barter scheme + * @param barterScheme + * @returns Rouble price + */ getBarterPrice(barterScheme: IBarterScheme[]): number; + /** + * Generate a currency cost for an item and its mods + * @param items Item with mods to get price for + * @param desiredCurrency Currency price desired in + * @returns cost of item in desired currency + */ getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json diff --git a/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts index b05fc65..95c3ddb 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairRequiredItemsService.d.ts @@ -7,6 +7,6 @@ export declare class RagfairRequiredItemsService { protected ragfairOfferService: RagfairOfferService; protected requiredItemsCache: {}; constructor(logger: ILogger, paymentHelper: PaymentHelper, ragfairOfferService: RagfairOfferService); - getRequiredItems(searchId: string): any; + getRequiredItemsById(searchId: string): any; buildRequiredItemTable(): void; } diff --git a/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts b/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts new file mode 100644 index 0000000..ac765ff --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/SeasonalEventService.d.ts @@ -0,0 +1,72 @@ +import { BotHelper } from "../helpers/BotHelper"; +import { Config } from "../models/eft/common/IGlobals"; +import { Inventory } from "../models/eft/common/tables/IBotType"; +import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; +export declare class SeasonalEventService { + protected logger: ILogger; + protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected seasonalEventConfig: ISeasonalEventConfig; + constructor(logger: ILogger, databaseServer: DatabaseServer, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + protected get events(): Record; + protected get christmasEventItems(): string[]; + /** + * Get an array of christmas items found in bots inventories as loot + * @returns array + */ + getChristmasEventItems(): string[]; + itemIsChristmasRelated(itemId: string): boolean; + /** + * is christmas event active + * @returns true if active + */ + christmasEventEnabled(): boolean; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + protected getEventBotGear(eventName: string): Record>>; + /** + * Get the dates each seasonal event starts and ends at + * @returns Record with event name + start/end date + */ + getEventDetails(): ISeasonalEvent[]; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + */ + checkForAndEnableSeasonalEvents(): void; + /** + * Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + * @param nodeInventory Bots inventory to iterate over + * @param botRole the role of the bot being processed + */ + removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ + protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + protected addPumpkinsToScavBackpacks(): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ + protected enableDancingTree(): void; +} diff --git a/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts b/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts new file mode 100644 index 0000000..7e7c88f --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/TraderPurchasePersisterService.d.ts @@ -0,0 +1,34 @@ +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { TraderPurchaseData } from "../models/eft/profile/IAkiProfile"; +import { ITraderConfig } from "../models/spt/config/ITraderConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { TimeUtil } from "../utils/TimeUtil"; +/** + * Help with storing limited item purchases from traders in profile to persist them over server restarts + */ +export declare class TraderPurchasePersisterService { + protected logger: ILogger; + protected timeUtil: TimeUtil; + protected profileHelper: ProfileHelper; + protected configServer: ConfigServer; + protected traderConfig: ITraderConfig; + constructor(logger: ILogger, timeUtil: TimeUtil, profileHelper: ProfileHelper, configServer: ConfigServer); + /** + * Get the purchases made from a trader for this profile before the last trader reset + * @param sessionId Session id + * @param traderId Trader to loop up purchases for + * @returns Dict of assort id and count purchased + */ + getProfileTraderPurchases(sessionId: string, traderId: string): Record; + /** + * Remove all trader purchase records from all profiles that exist + * @param traderId Traders id + */ + resetTraderPurchasesStoredInProfile(traderId: string): void; + /** + * Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time + * @param traderId Trader id + */ + removeStalePurchasesFromProfiles(traderId: string): void; +} diff --git a/TypeScript/9RouterHooks/types/services/mod/onLoad/OnLoadMod.d.ts b/TypeScript/9RouterHooks/types/services/mod/onLoad/OnLoadMod.d.ts index 53fb062..82909c3 100644 --- a/TypeScript/9RouterHooks/types/services/mod/onLoad/OnLoadMod.d.ts +++ b/TypeScript/9RouterHooks/types/services/mod/onLoad/OnLoadMod.d.ts @@ -3,6 +3,6 @@ export declare class OnLoadMod extends OnLoad { private onLoadOverride; private getRouteOverride; constructor(onLoadOverride: () => void, getRouteOverride: () => string); - onLoad(): void; + onLoad(): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/services/mod/onUpdate/OnUpdateMod.d.ts b/TypeScript/9RouterHooks/types/services/mod/onUpdate/OnUpdateMod.d.ts index ee89043..edd2a2c 100644 --- a/TypeScript/9RouterHooks/types/services/mod/onUpdate/OnUpdateMod.d.ts +++ b/TypeScript/9RouterHooks/types/services/mod/onUpdate/OnUpdateMod.d.ts @@ -3,6 +3,6 @@ export declare class OnUpdateMod extends OnUpdate { private onUpdateOverride; private getRouteOverride; constructor(onUpdateOverride: (timeSinceLastRun: number) => boolean, getRouteOverride: () => string); - onUpdate(timeSinceLastRun: number): boolean; + onUpdate(timeSinceLastRun: number): Promise; getRoute(): string; } diff --git a/TypeScript/9RouterHooks/types/utils/App.d.ts b/TypeScript/9RouterHooks/types/utils/App.d.ts index cc8a5af..b947c83 100644 --- a/TypeScript/9RouterHooks/types/utils/App.d.ts +++ b/TypeScript/9RouterHooks/types/utils/App.d.ts @@ -11,7 +11,7 @@ export declare class App { protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); - load(): void; - protected update(onUpdateComponents: OnUpdate[]): void; + load(): Promise; + protected update(onUpdateComponents: OnUpdate[]): Promise; protected logUpdateException(err: any, updateable: OnUpdate): void; } diff --git a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts index 31670ae..0c39aa8 100644 --- a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts @@ -14,13 +14,24 @@ export declare class DatabaseImporter extends OnLoad { protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); - onLoad(): void; + onLoad(): Promise; /** * Read all json files in database folder and map into a json object * @param filepath path to database folder */ - protected hydrateDatabase(filepath: string): void; + protected hydrateDatabase(filepath: string): Promise; getRoute(): string; + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns + */ + loadRecursiveAsync(filepath: string): Promise; + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ loadRecursive(filepath: string): IDatabaseTables; loadImages(filepath: string): void; } diff --git a/TypeScript/9RouterHooks/types/utils/JsonUtil.d.ts b/TypeScript/9RouterHooks/types/utils/JsonUtil.d.ts index 71e95f6..2591142 100644 --- a/TypeScript/9RouterHooks/types/utils/JsonUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/JsonUtil.d.ts @@ -6,6 +6,7 @@ export declare class JsonUtil { protected hashUtil: HashUtil; protected logger: ILogger; protected fileHashes: any; + protected jsonCacheExists: boolean; constructor(vfs: VFS, hashUtil: HashUtil, logger: ILogger); /** * From object to string diff --git a/TypeScript/9RouterHooks/types/utils/Logger.d.ts b/TypeScript/9RouterHooks/types/utils/Logger.d.ts index 3d9013f..1088701 100644 --- a/TypeScript/9RouterHooks/types/utils/Logger.d.ts +++ b/TypeScript/9RouterHooks/types/utils/Logger.d.ts @@ -53,6 +53,12 @@ export declare class WinstonLogger implements ILogger { warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + /** + * Log to console text with a customisable text and background color. Background defaults to black + * @param data text to log + * @param textColor color of text + * @param backgroundColor color of background + */ logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } diff --git a/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts new file mode 100644 index 0000000..46d9e23 --- /dev/null +++ b/TypeScript/9RouterHooks/types/utils/RagfairOfferHolder.d.ts @@ -0,0 +1,24 @@ +import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +export declare class RagfairOfferHolder { + private offersById; + private offersByTemplate; + private offersByTrader; + constructor(); + getOfferById(id: string): IRagfairOffer; + getOffersByTemplate(templateId: string): Array; + getOffersByTrader(traderId: string): Array; + getOffers(): Array; + addOffers(offers: Array): void; + addOffer(offer: IRagfairOffer): void; + removeOffer(offer: IRagfairOffer): void; + removeOffers(offers: Array): void; + removeOfferByTrader(traderId: string): void; + /** + * Get an array of stale offers that are still shown to player + * @returns IRagfairOffer array + */ + getStaleOffers(time: number): Array; + private addOfferByTemplates; + private addOfferByTrader; + protected isStale(offer: IRagfairOffer, time: number): boolean; +} diff --git a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts index e02eba2..f870cf1 100644 --- a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts +++ b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts @@ -30,7 +30,11 @@ export declare class Watermark { * @returns string */ getVersionTag(withEftVersion?: boolean): string; - getVersionLabel(): string; + /** + * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used + * @returns string + */ + getInGameVersionLabel(): string; /** Set window title */ setTitle(): void; /** Reset console cursor to top */